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/basic_usage.rs (line 13)
6fn main() {
7    assert_eq!(gcd(54, 24), 6);
8    assert_eq!(lcm(6, 15), 30);
9    assert!(is_divisible_by(84, 7));
10    assert!(is_even(12));
11    assert!(is_odd(7));
12    assert_eq!(div_floor(-7, 3), -3);
13    assert_eq!(mod_floor(-7, 3), 2);
14    assert_eq!(checked_add(u8::MAX, 1), None);
15    assert_eq!(saturating_add(u8::MAX, 1), u8::MAX);
16    assert_eq!(wrapping_mul(200_u8, 2), 144);
17}