Skip to main content

classify_sign

Function classify_sign 

Source
pub const fn classify_sign(value: i128) -> IntegerSign
Expand description

Classifies a signed integer as negative, zero, or positive.

Examples found in repository?
examples/basic_usage.rs (line 4)
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}