mathtools.sign

abjad.tools.mathtools.sign(n)

Return -1, 0, 1 for negative, zero, positive numbers, respectively.

abjad> mathtools.sign(-96.2)
-1
abjad> mathtools.sign(0)
0
abjad> mathtools.sign(Rational(9, 8))
1

Note

mathtools.sign(n) aliases built-in cmp(n, 0).

Previous topic

mathtools.remove_powers_of_two

Next topic

measuretools.beam

This Page