-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue of binary_float_op when result of rem is zero
- Loading branch information
1 parent
c90eb48
commit 99f7fb0
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// run-pass | ||
// check-run-results | ||
|
||
pub fn f() -> f64 { | ||
std::hint::black_box(-1.0) % std::hint::black_box(-1.0) | ||
} | ||
|
||
pub fn g() -> f64 { | ||
-1.0 % -1.0 | ||
} | ||
|
||
pub fn main() { | ||
assert_eq!(-1, g().signum() as i32); | ||
assert_eq!((-0.0_f64).to_bits(), f().to_bits()); | ||
assert_eq!(f().signum(), g().signum()); | ||
} |