On Thu, 22 Aug 2019, Tejas Joshi wrote:

> > I'm concerned that this would produce +0.0 for an argument of -0.5 (via
> > -0.5 - 0.5 - -1.0 producing +0.0) when it needs to produce -0.0.
> 
> Would the following overhaul be acceptable as the condition is
> specialized for -0.5 and +0.5 only. This seems to solve the problem. I
> did test the roundeven tests and it passes the tests.

I think that would be reasonable with a comment added to explain that it's 
ensuring the correct sign of a zero result.

>   if (__builtin_copysign (1, __builtin_roundeven (-0.5)) != -1)
>     link_error (__LINE__);

I think you should have at least four tests of sign of zero result 
(arguments -0.5, -0.0, 0.0 and 0.5).  Probably also tests of values 
between +/- 0.5 and 0, e.g. test -0.25 and 0.25 as well.

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to