[Mesa-dev] [PATCH 1/3] glsl: Add support for constant expression evaluation on round(), roundEven().

Henri Verbeet hverbeet at gmail.com
Mon Oct 3 19:42:55 PDT 2011


On 4 October 2011 00:41, Eric Anholt <eric at anholt.net> wrote:
> They're both implemented the same in GLSL IR (since round() has
> undefined behavior for n + 0.5).  The specification of the C function
> in use here is a bit unclear: rint(3) says that nearbyint() is like
> rint() in that it uses the current rounding direction from
> fesetround(3).  fesetround(3) says behavior is according to
> FLT_ROUNDS, which on this system is 1 ("Rounding is toward nearest
> number"), but doesn't specify behavior for n + 0.5 in that case.
> However, round(3) says that rint(3) has roundEven()'s behavior for n +
> 0.5.
>
Does this depend on applications not touching the rounding mode?


More information about the mesa-dev mailing list