aboutsummaryrefslogtreecommitdiff
path: root/std/math/round.zig
diff options
context:
space:
mode:
authorMarc Tiehuis <marctiehuis@gmail.com>2018-08-23 21:42:09 +1200
committerMarc Tiehuis <marctiehuis@gmail.com>2018-08-23 22:54:46 +1200
commit353419f82d3575dc45631750a8cf08aa4826ec4c (patch)
treee8fcd1fe3d71d1086ddb1425e58cb74bf63e921b /std/math/round.zig
parent4b68ef45af54abd7ba56878f93132ca608891cf1 (diff)
downloadzig-353419f82d3575dc45631750a8cf08aa4826ec4c.tar.gz
zig-353419f82d3575dc45631750a8cf08aa4826ec4c.zip
Default to strict IEEE floating point
Closes #1227.
Diffstat (limited to 'std/math/round.zig')
-rw-r--r--std/math/round.zig12
1 files changed, 2 insertions, 10 deletions
diff --git a/std/math/round.zig b/std/math/round.zig
index c8d9eb4fd4..4fe35365c8 100644
--- a/std/math/round.zig
+++ b/std/math/round.zig
@@ -35,11 +35,7 @@ fn round32(x_: f32) f32 {
return 0 * @bitCast(f32, u);
}
- {
- @setFloatMode(this, builtin.FloatMode.Strict);
- y = x + math.f32_toint - math.f32_toint - x;
- }
-
+ y = x + math.f32_toint - math.f32_toint - x;
if (y > 0.5) {
y = y + x - 1;
} else if (y <= -0.5) {
@@ -72,11 +68,7 @@ fn round64(x_: f64) f64 {
return 0 * @bitCast(f64, u);
}
- {
- @setFloatMode(this, builtin.FloatMode.Strict);
- y = x + math.f64_toint - math.f64_toint - x;
- }
-
+ y = x + math.f64_toint - math.f64_toint - x;
if (y > 0.5) {
y = y + x - 1;
} else if (y <= -0.5) {