Function extprim::i128::div_rem
[−]
[src]
pub fn div_rem(numerator: i128, denominator: i128) -> (i128, i128)
Computes the divisor and remainder simultaneously. Returns (a/b, a%b)
.
Unlike the primitive types, calling this is likely faster than calling a/b
and a%b
separately.
Panics
This function will panic if denominator
is 0. If debug assertions is enabled, this function
will also panic on overflow (when computing div_rem(MIN, -1)
).
Examples
use extprim::i128::{div_rem, i128}; assert_eq!(div_rem(i128::new(100), i128::new(-8)), (i128::new(-12), i128::new(4)));