[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: support for bitwise comparison of floats

From: Bruno Haible
Subject: Re: support for bitwise comparison of floats
Date: Fri, 30 Mar 2007 03:41:25 +0200
User-agent: KMail/1.5.4

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:

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

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...


reply via email to

[Prev in Thread] Current Thread [Next in Thread]