add setFloatMode builtin and std.math.floor

* skip installing std/rand_test.zig as it's not needed beyond running
   the std lib tests
 * add std.math.floor function
 * add setFloatMode builtin function to choose between
   builtin.FloatMode.Optimized (default) and builtin.FloatMode.Strict
   (Optimized is equivalent to -ffast-math in gcc)
This commit is contained in:
Andrew Kelley
2017-05-20 23:06:32 -04:00
parent 051ee8e626
commit 29b488245d
8 changed files with 328 additions and 24 deletions

View File

@@ -1835,4 +1835,22 @@ pub fn addCases(cases: &tests.CompileErrorContext) {
\\}
,
".tmp_source.zig:3:20: error: cast from 'u16' to 'u8' truncates bits");
cases.add("@setDebugSafety twice for same scope",
\\export fn foo() {
\\ @setDebugSafety(this, false);
\\ @setDebugSafety(this, false);
\\}
,
".tmp_source.zig:3:5: error: debug safety set twice for same scope",
".tmp_source.zig:2:5: note: first set here");
cases.add("@setFloatMode twice for same scope",
\\export fn foo() {
\\ @setFloatMode(this, @import("builtin").FloatMode.Optimized);
\\ @setFloatMode(this, @import("builtin").FloatMode.Optimized);
\\}
,
".tmp_source.zig:3:5: error: float mode set twice for same scope",
".tmp_source.zig:2:5: note: first set here");
}