Skip to main content

mod_floor

Function mod_floor 

Source
pub fn mod_floor(dividend: i64, divisor: i64) -> i64
Expand description

Returns the mathematical floor-style remainder of dividend / divisor.

ยงPanics

Panics when divisor is zero or when the matching quotient does not fit in i64.

Examples found in repository?
examples/facade_arithmetic.rs (line 6)
3fn main() {
4    assert_eq!(checked_add(u8::MAX, 1), None);
5    assert_eq!(div_floor(-7, 3), -3);
6    assert_eq!(mod_floor(-7, 3), 2);
7    assert_eq!(saturating_add(u8::MAX, 1), u8::MAX);
8    assert_eq!(wrapping_mul(200_u8, 2), 144);
9    assert_eq!(use_math::arithmetic::gcd(54, 24), 6);
10    assert_eq!(use_math::arithmetic::lcm(6, 15), 30);
11    assert!(use_math::arithmetic::is_even(12));
12}