OxL Reference

method i16.signum

-1, 0 or 1 for a negative, zero or positive value.

Example:

oxl✓ checked in CI
fn main() io {
  let neg: i16 = -5
  let zero: i16 = 0
  let pos: i16 = 9
  print("{neg.signum()} {zero.signum()} {pos.signum()}")
}
Output
-1 0 1
pub(api) fn signum() -> i16

Complexity. O(1).

Since. 1.0.0-beta

Returns

i16

Effects

none declared (pure unless the body says otherwise)

Defined in: std/core/numbers.oxl:945

See also