Paul Eggert wrote:
> vasnprintf.c should do this:
> 
>         if (copysignl (1, arg) < 0)
>           {
>             sign = -1;
>             arg = -arg;
>           }
> 
> I think it's much cleaner.  And the code is smaller on my platform,
> anyway: no function call is generated for copysignl.  It should be
> fast enough for vasnprintf.

Yes, I agree.

> This needs copysignl for older platforms, but another gnulib module
> should suffice for that....

It will be an "interesting" module as well, when you see that the Linux
man page of copysignl says:

   NOTES
       The copysign() functions may treat a negative zero as posĀ­
       itive.

and POSIX says:

   On implementations that represent a signed zero but do not treat negative
   zero consistently in arithmetic operations, these functions regard the sign
   of zero as positive.

In other words, the standard allows the function to be buggy...

Bruno



Reply via email to