1 /* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
3 * Permission to use, copy, modify, and distribute this software
4 * is freely granted, provided that this notice is preserved.
8 <<signbit>>---Does floating-point number have negative sign?
15 int signbit(real-floating <[x]>);
18 The <<signbit>> macro determines whether the sign of its argument value is
19 negative. The macro reports the sign of all values, including infinities,
20 zeros, and NaNs. If zero is unsigned, it is treated as positive. As shown in
21 the synopsis, the argument is "real-floating," meaning that any of the real
22 floating-point types (float, double, etc.) may be given to it.
24 Note that because of the possibilities of signed 0 and NaNs, the expression
25 "<[x]> < 0.0" does not give the same result as <<signbit>> in all cases.
28 The <<signbit>> macro returns a nonzero value if and only if the sign of its
29 argument value is negative.
38 int __signbitf (float x
);
39 int __signbitd (double x
);
48 return (w
& 0x80000000) != 0;
56 GET_HIGH_WORD(msw
, x
);
58 return (msw
& 0x80000000) != 0;