Navigation

Operators and Keywords

Function List:

C++ API

: signbit (x)

Return logical true if the value of x has its sign bit set and false otherwise.

This behavior is consistent with the other logical functions. See ‘Logical Values’. The behavior differs from the C language function which returns nonzero if the sign bit is set.

This is not the same as x < 0.0, because IEEE 754 floating point allows zero to be signed. The comparison -0.0 < 0.0 is false, but signbit (-0.0) will return a nonzero value.

See also: sign.

Package: octave