Function lcm
Source pub const fn lcm(left: i128, right: i128) -> Result<u128, IntegerError>
Expand description
Computes the non-negative least common multiple of two signed integers.
ยงErrors
Returns IntegerError::ArithmeticOverflow when the least common multiple does not fit in u128.
examples/basic_usage.rs (
line 8)
3fn main() -> Result<(), use_integer::IntegerError> {
4 assert_eq!(classify_sign(-42), IntegerSign::Negative);
5 assert!(is_divisible_by(42, 6)?);
6 assert!(are_coprime(35, 64));
7 assert_eq!(gcd(-54, 24), 6);
8 assert_eq!(lcm(-6, 15)?, 30);
9
10 Ok(())
11}