From 353419f82d3575dc45631750a8cf08aa4826ec4c Mon Sep 17 00:00:00 2001 From: Marc Tiehuis Date: Thu, 23 Aug 2018 21:42:09 +1200 Subject: [PATCH] Default to strict IEEE floating point Closes #1227. --- doc/langref.html.in | 10 +++++----- src/all_types.hpp | 4 ++-- src/codegen.cpp | 6 +++--- src/ir.cpp | 10 +++++----- std/fmt/errol/index.zig | 4 ---- std/math/ceil.zig | 2 -- std/math/complex/exp.zig | 2 -- std/math/cos.zig | 2 -- std/math/exp.zig | 4 ---- std/math/exp2.zig | 4 ---- std/math/expm1.zig | 4 ---- std/math/floor.zig | 2 -- std/math/ln.zig | 4 ---- std/math/pow.zig | 2 -- std/math/round.zig | 12 ++---------- std/math/sin.zig | 2 -- std/math/sinh.zig | 2 -- std/math/tan.zig | 2 -- 18 files changed, 17 insertions(+), 61 deletions(-) diff --git a/doc/langref.html.in b/doc/langref.html.in index e34ab677f6..8bce703112 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -744,19 +744,19 @@ const yet_another_hex_float = 0x103.70P-5; {#code_end#} {#header_close#} {#header_open|Floating Point Operations#} -

By default floating point operations use Optimized mode, - but you can switch to Strict mode on a per-block basis:

+

By default floating point operations use Strict mode, + but you can switch to Optimized mode on a per-block basis:

{#code_begin|obj|foo#} {#code_release_fast#} const builtin = @import("builtin"); const big = f64(1 << 40); export fn foo_strict(x: f64) f64 { - @setFloatMode(this, builtin.FloatMode.Strict); return x + big - big; } export fn foo_optimized(x: f64) f64 { + @setFloatMode(this, builtin.FloatMode.Optimized); return x + big - big; } {#code_end#} @@ -5948,7 +5948,7 @@ pub const FloatMode = enum { {#code_end#}