about summary refs log tree commit diff
path: root/tests/ui/numbers-arithmetic/apfloat-modulo-wrong.rs
diff options
context:
space:
mode:
authoryukang <moorekang@gmail.com>2023-03-25 00:59:57 +0800
committerWesley Wiser <wesleywiser@microsoft.com>2023-07-26 13:31:54 -0400
commit98dd81e4e306c85fc6e76893779e147ede0f3ddf (patch)
tree318f41e5ea93a4c08f52b17a3c104f734bcc9c57 /tests/ui/numbers-arithmetic/apfloat-modulo-wrong.rs
parent47a4484a78471e87862bdb340ada960b4d78fd30 (diff)
downloadrust-98dd81e4e306c85fc6e76893779e147ede0f3ddf.tar.gz
rust-98dd81e4e306c85fc6e76893779e147ede0f3ddf.zip
Add test case for #109567
Diffstat (limited to 'tests/ui/numbers-arithmetic/apfloat-modulo-wrong.rs')
-rw-r--r--tests/ui/numbers-arithmetic/apfloat-modulo-wrong.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/numbers-arithmetic/apfloat-modulo-wrong.rs b/tests/ui/numbers-arithmetic/apfloat-modulo-wrong.rs
new file mode 100644
index 00000000000..64ff1f8b1d2
--- /dev/null
+++ b/tests/ui/numbers-arithmetic/apfloat-modulo-wrong.rs
@@ -0,0 +1,15 @@
+// run-pass
+// check-run-results
+// regression test for issue #109567
+
+fn f() -> f64 {
+    std::hint::black_box(-1.0) % std::hint::black_box(-1.0)
+}
+
+const G: f64 = -1.0 % -1.0;
+
+pub fn main() {
+    assert_eq!(-1, G.signum() as i32);
+    assert_eq!((-0.0_f64).to_bits(), G.to_bits());
+    assert_eq!(f().signum(), G.signum());
+}