On 03/10/2015 05:05 PM, Jason Ekstrand wrote:
> 
> 
> On Tue, Mar 10, 2015 at 4:50 PM, Matt Turner <matts...@gmail.com
> <mailto:matts...@gmail.com>> wrote:
> 
>     On Tue, Mar 10, 2015 at 4:20 PM, Ian Romanick <i...@freedesktop.org
>     <mailto:i...@freedesktop.org>> wrote:
>     > On 02/28/2015 12:19 PM, Matt Turner wrote:
>     >> On Sat, Feb 28, 2015 at 11:47 AM, Thomas Helland
>     >> <thomashellan...@gmail.com <mailto:thomashellan...@gmail.com>> wrote:
>     >>> On Feb 28, 2015 8:39 PM, "Jason Ekstrand" <ja...@jlekstrand.net 
> <mailto:ja...@jlekstrand.net>> wrote:
>     >>>>
>     >>>> Both patches are
>     >>>>
>     >>>> Reviewed-by: Jason Ekstrand <jason.ekstr...@intel.com 
> <mailto:jason.ekstr...@intel.com>>
>     >>>
>     >>> Could you commit them?
>     >>> I don't have commit access.
>     >>
>     >> I'd like to wait a few days to see if there are any comments about the
>     >> floating-point optimizations. If not, I'll commit them. (The integer
>     >> parts are surely fine)
>     >
>     > Hmm... does the GLSL spec say anything about integer overflow?  For
>     > large values, (a*b)+(a*c) can produce dramatically different results
>     > than a*(b+c).
> 
>     It says (in 4.1.3 Integers)
> 
>     """
>     Addition, subtraction, and shift operations resulting in overflow or
>     underflow will not cause any exception, nor will they saturate, rather
>     they will “wrap” to yield the low-order 32 bits of the result.
>     Division and multiplication operations resulting in overflow or
>     underflow will not cause any exception but will result in an undefined
>     value.
>     """
> 
>     More thinking required?
> 
> 
> Actually.... Assuming that everything's 32-bit, it's 100% ok.  A fun and
> somewhat surprising fact about modular arithmetic is that it is that
> multiplication is still distributive.  Yes, it can wrap around, but it
> will always wrap around "the same way".

Now that I think about it some more, that does seem obviously true.

> --Jason

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to