[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:
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
Re: support for bitwise comparison of floats, Eric Blake, 2007/03/25
Re: support for bitwise comparison of floats, Paul Eggert, 2007/03/29
- Re: support for bitwise comparison of floats,
Bruno Haible <=