Open
Description
Our documentation for impl Rem for {f16, f32, f64, f128}
says:
The remainder has the same sign as the dividend and is computed as:
x - (x / y).trunc() * y
.
But that's not true. E.g.:
fn main() {
let (x, y) = (11f64, 1.1f64);
assert_eq!(x - (x / y).trunc() * y, x % y);
//~^ PANIC
// assertion `left == right` failed
// left: 0.0
// right: 1.0999999999999992
}
This mismatch creates a hazard when trying to correctly encode algorithms that rely on this semantic.
This tripped me up, e.g., when authoring: