macro/function
<cmath> <ctgmath>

# signbit

macro ```signbit(x) ```
function ```bool signbit (float x); bool signbit (double x); bool signbit (long double x); ```
Sign bit
Returns whether the sign of x is negative.

This can be also applied to infinites, NaNs and zeroes (if zero is unsigned, it is considered positive).

In C, this is implemented as a macro that returns an `int` value. The type of x shall be `float`, `double` or `long double`.
In C++, it is implemented with function overloads for each floating-point type, each returning a `bool` value.

### Parameters

x
A floating-point value.

### Return value

A non-zero value (`true`) if the sign of x is negative; and zero (`false`) otherwise.

### Example

 ``123456789101112`` ``````/* signbit example */ #include /* printf */ #include /* signbit, sqrt */ int main() { printf ("signbit(0.0) : %d\n",signbit(0.0)); printf ("signbit(1.0/0.0) : %d\n",signbit(1.0/0.0)); printf ("signbit(-1.0/0.0) : %d\n",signbit(-1.0/0.0)); printf ("signbit(sqrt(-1.0)): %d\n",signbit(sqrt(-1.0))); return 0; }``````

Output:
 ``` signbit(0.0) : 0 signbit(1.0/0.0) : 0 signbit(-1.0/0.0) : 1 signbit(sqrt(-1.0): 1 ```