Atom

math.sign()

Reports the sign.

Signature

math.sign(x)

Parameters

One ordered number.

Returns

i64 -1, 0 or 1.

Behavior

Both signs of zero return 0.

Errors

NaN or nonnumeric input.

Example

Atom
use math
assert(math.sign(-0.5) == -1)