Bruno Haible <[EMAIL PROTECTED]> writes: > In other words, the standard allows the function to be buggy...
The wording you quoted is talking about something else. It is referring to the behavior of the VAX floating point unit, where the hardware representation that one thinks would represent -0.0 behaves sort of like a NaN. To avoid this problem, on a VAX copysign(0, -1) returns +0.0, not the usual -0.0. That is why the C and POSIX standards are worded the way they are. I expect the Linux manual just picked it up from one of the standards. (Does Linux run on a VAX? :-) This problem shouldn't affect us, as the code I proposed doesn't try to compute -0.0. I suggested copysign instead of the signbit macro because copysign has been around a lot longer -- it was in the 1985 IEEE floating point standard -- and is optimized better. But if you want to play it safer (and slower :-) you can use signbit.