Crates.io | abs |
lib.rs | abs |
version | 0.1.1 |
source | src |
created_at | 2022-03-24 06:16:03.95017 |
updated_at | 2022-03-27 04:02:23.052874 |
description | generic absolute value |
homepage | |
repository | |
max_upload_size | |
id | 555617 |
size | 1,702 |
Example usage:
#[test]
fn it_works_for_f64_1() {
assert_ne!(abs(3.1f64, 2.5f64), 0.6f64);
assert_eq!(abs(3.1f64, 2.5f64), 0.6000000000000001f64);
}
#[test]
fn it_works_for_i32() {
assert_eq!(abs(42i32, 69i32), 27i32);
}
#[test]
fn it_works_for_u8() {
assert_eq!(abs(42u8, 69u8), 27u8);
}