Re: [Mesa-dev] [PATCH v2] glsl: Improve precision of mod(x,y)

2015-01-20 Thread Ian Romanick
On 01/20/2015 08:09 AM, Iago Toral Quiroga wrote: > Currently, Mesa uses the lowering pass MOD_TO_FRACT to implement > mod(x,y) as y * fract(x/y). This implementation has a down side though: > it introduces precision errors due to the fract() operation. Even worse, > since the result of fract() is

[Mesa-dev] [PATCH v2] glsl: Improve precision of mod(x,y)

2015-01-20 Thread Iago Toral Quiroga
Currently, Mesa uses the lowering pass MOD_TO_FRACT to implement mod(x,y) as y * fract(x/y). This implementation has a down side though: it introduces precision errors due to the fract() operation. Even worse, since the result of fract() is multiplied by y, the larger y gets the larger the precisio