OxL Reference

method i16.checked_div

Checked division (truncating toward zero): the quotient, or none on division by zero and on MIN / -1, whose quotient does not fit.

Example:

oxl✓ checked in CI
fn main() io {
  print("{(7 as i16).checked_div(2)} {(7 as i16).checked_div(0)}")
}
Output
3 none
pub(api) fn checked_div(o: i16) -> i16?

Complexity. O(1).

Since. 1.0.0-beta

Parameters

NameType
oi16

Returns

i16?

Effects

none declared (pure unless the body says otherwise)

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

See also