aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/floatop.zig
diff options
context:
space:
mode:
authorMarc Tiehuis <marc@tiehu.is>2022-01-15 02:52:34 +1300
committerAndrew Kelley <andrew@ziglang.org>2022-01-14 13:29:58 -0500
commita64989ee704255f61639c9714c5a38b4d6eb0a9e (patch)
tree841aecfa75d79bcc584a4e123ed451462a3829ab /test/behavior/floatop.zig
parentec58ddf46c4e1ac060333c6d0780955acae22442 (diff)
downloadzig-a64989ee704255f61639c9714c5a38b4d6eb0a9e.tar.gz
zig-a64989ee704255f61639c9714c5a38b4d6eb0a9e.zip
stage1: fix bigint_init_bigfloat for single-limb negative floats
Fixes #10592.
Diffstat (limited to 'test/behavior/floatop.zig')
-rw-r--r--test/behavior/floatop.zig6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/behavior/floatop.zig b/test/behavior/floatop.zig
index cbf0d2532b..20ef4ce68d 100644
--- a/test/behavior/floatop.zig
+++ b/test/behavior/floatop.zig
@@ -66,3 +66,9 @@ fn testDifferentSizedFloatComparisons() !void {
// try expect(@nearbyint(a) == -4);
// }
//}
+
+test "negative f128 floatToInt at compile-time" {
+ const a: f128 = -2;
+ var b = @floatToInt(i64, a);
+ try expect(@as(i64, -2) == b);
+}