Math module

signbit

procedure · 1 overloadSource

1 when the sign bit of x is set and 0 otherwise, as a u64. Unlike x < 0 it tells -0.0 from 0.0 and sees the sign of a NaN. Only float64.

ExampleOpen in playground ↗
assert(signbit(cast(float64) -1) == 1 && signbit(cast(float64) 1) == 0);
assert(signbit(cast(float64) -0.0) == 1);
signbit :: (x: float64) -> u64

The sign bit of x: 1 for negative numbers (and -0), 0 otherwise.

Parameters

x: float64
the value.

Returns

u64

See also