Function rem

Source
pub fn rem(x: f64, y: f64) -> f64
Expand description

§rem(x, y)

Operation Function

The rem function provides the remainder of dividing x by y, returning a f64 floating-point number.

§Examples

use mathlab::math::{rem, fix64, is_nan_f64, INF_F64};
assert!(is_nan_f64(rem(0.0, 0.0)));
assert!(is_nan_f64(rem(1.0, 0.0)));
assert!(is_nan_f64(rem(INF_F64, 0.0)));
assert!(is_nan_f64(rem(INF_F64, 2.0)));
assert!(is_nan_f64(rem(INF_F64, INF_F64)));
assert!(is_nan_f64(rem(INF_F64, INF_F64)));
assert_eq!(rem(0.0, INF_F64), 0.0);
assert_eq!(rem(2.0, INF_F64), 2.0);
assert_eq!(rem(1.0, 0.1), 0.09999999999999995);
assert_eq!(rem(1.0, 0.1) as f32, 0.1); // f32
assert_eq!(fix64(rem(1.0, 0.1)), 0.1); // f64
assert_eq!(rem(0.0, 3.0), 0.0);
assert_eq!(rem(1.0, 3.0), 1.0);
assert_eq!(rem(2.0, 3.0), 2.0);
assert_eq!(rem(3.0, 3.0), 0.0);
assert_eq!(rem(4.0, 3.0), 1.0);

End Fun Doc