Re: [Mesa-dev] [PATCH 1/3] mesa: Replace _mesa_round_to_even() with _mesa_roundeven().

2015-03-18 Thread Carl Worth
On Wed, Mar 18 2015, Matt Turner wrote: This patch implements _mesa_roundeven{f,}, a function similar to the roundeven function added by a yet unimplemented technical specification (ISO/IEC TS 18661-1:2014), with a small difference in behavior -- we don't bother raising the inexact exception,

[Mesa-dev] [PATCH 1/3] mesa: Replace _mesa_round_to_even() with _mesa_roundeven().

2015-03-18 Thread Matt Turner
Eric's initial patch adding constant expression evaluation for ir_unop_round_even used nearbyint. The open-coded _mesa_round_to_even implementation came about without much explanation after a reviewer asked whether nearbyint depended on the application not modifying the rounding mode. Of course

Re: [Mesa-dev] [PATCH 1/3] mesa: Replace _mesa_round_to_even() with _mesa_roundeven().

2015-03-13 Thread Carl Worth
On Fri, Mar 13 2015, Matt Turner wrote: Perhaps something like the following? Round \x to the nearest even integer (returned in floating-point format). I didn't read this closely enough the first time, but if I had I think I could have short circuited a lot of the confusion.

Re: [Mesa-dev] [PATCH 1/3] mesa: Replace _mesa_round_to_even() with _mesa_roundeven().

2015-03-13 Thread Matt Turner
On Thu, Mar 12, 2015 at 2:59 PM, Carl Worth cwo...@cworth.org wrote: On Thu, Mar 12 2015, Matt Turner wrote: +/* The C standard library has functions round()/rint()/nearbyint() that round + * their arguments according to the rounding mode set in the floating-point + * control register. While

[Mesa-dev] [PATCH 1/3] mesa: Replace _mesa_round_to_even() with _mesa_roundeven().

2015-03-12 Thread Matt Turner
Eric's initial patch adding constant expression evaluation for ir_unop_round_even used nearbyint. The open-coded _mesa_round_to_even implementation came about without much explanation after a reviewer asked whether nearbyint depended on the application not modifying the rounding mode. Of course

Re: [Mesa-dev] [PATCH 1/3] mesa: Replace _mesa_round_to_even() with _mesa_roundeven().

2015-03-12 Thread Roland Scheidegger
Am 12.03.2015 um 23:53 schrieb Carl Worth: On Thu, Mar 12 2015, Matt Turner wrote: I think you misread. rint() *does* provide the behavior we want (round-to-nearest, half to even) when the rounding mode is the default round-to-nearest. Thanks. I did at least verify that behaviorally as I

Re: [Mesa-dev] [PATCH 1/3] mesa: Replace _mesa_round_to_even() with _mesa_roundeven().

2015-03-12 Thread Matt Turner
On Thu, Mar 12, 2015 at 3:53 PM, Carl Worth cwo...@cworth.org wrote: On Thu, Mar 12 2015, Matt Turner wrote: I think you misread. rint() *does* provide the behavior we want (round-to-nearest, half to even) when the rounding mode is the default round-to-nearest. Thanks. I did at least verify

Re: [Mesa-dev] [PATCH 1/3] mesa: Replace _mesa_round_to_even() with _mesa_roundeven().

2015-03-12 Thread Matt Turner
On Thu, Mar 12, 2015 at 2:59 PM, Carl Worth cwo...@cworth.org wrote: On Thu, Mar 12 2015, Matt Turner wrote: +/* The C standard library has functions round()/rint()/nearbyint() that round + * their arguments according to the rounding mode set in the floating-point + * control register. While

Re: [Mesa-dev] [PATCH 1/3] mesa: Replace _mesa_round_to_even() with _mesa_roundeven().

2015-03-12 Thread Carl Worth
On Thu, Mar 12 2015, Matt Turner wrote: I think you misread. rint() *does* provide the behavior we want (round-to-nearest, half to even) when the rounding mode is the default round-to-nearest. Thanks. I did at least verify that behaviorally as I just mentioned in a separate mail. As Eric

Re: [Mesa-dev] [PATCH 1/3] mesa: Replace _mesa_round_to_even() with _mesa_roundeven().

2015-03-12 Thread Carl Worth
On Thu, Mar 12 2015, Matt Turner wrote: +/* The C standard library has functions round()/rint()/nearbyint() that round + * their arguments according to the rounding mode set in the floating-point + * control register. While there are trunc()/ceil()/floor() functions that do + * a specific

Re: [Mesa-dev] [PATCH 1/3] mesa: Replace _mesa_round_to_even() with _mesa_roundeven().

2015-03-12 Thread Carl Worth
On Thu, Mar 12 2015, Carl Worth wrote: But beyond that, I'm actually confused---how can the default rounding mode (rounding toward nearest number, right?) give us an adequate implementation for roundeven()? Of course, I had asked for (and received) a patch with a test. And the test verifies