diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-04-26 10:13:55 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-04-27 12:20:44 -0700 |
| commit | 41dd2beaacade94c5c98400a4a655aea07b9e2f3 (patch) | |
| tree | d7cd75c3ded0e8517e801f62dbb883d93f3cd585 /lib/std/fmt/errol.zig | |
| parent | 6f4343b61afe36a709e713735947561a2b76bce8 (diff) | |
| download | zig-41dd2beaacade94c5c98400a4a655aea07b9e2f3.tar.gz zig-41dd2beaacade94c5c98400a4a655aea07b9e2f3.zip | |
compiler-rt: math functions reorg
* unify the logic for exporting math functions from compiler-rt,
with the appropriate suffixes and prefixes.
- add all missing f128 and f80 exports. Functions with missing
implementations call other functions and have TODO comments.
- also add f16 functions
* move math functions from freestanding libc to compiler-rt (#7265)
* enable all the f128 and f80 code in the stage2 compiler and behavior
tests (#11161).
* update std lib to use builtins rather than `std.math`.
Diffstat (limited to 'lib/std/fmt/errol.zig')
| -rw-r--r-- | lib/std/fmt/errol.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/std/fmt/errol.zig b/lib/std/fmt/errol.zig index 29dd2b7a63..1ce72de0fc 100644 --- a/lib/std/fmt/errol.zig +++ b/lib/std/fmt/errol.zig @@ -113,7 +113,7 @@ fn errolSlow(val: f64, buffer: []u8) FloatDecimal { // normalize the midpoint const e = math.frexp(val).exponent; - var exp = @floatToInt(i16, math.floor(307 + @intToFloat(f64, e) * 0.30103)); + var exp = @floatToInt(i16, @floor(307 + @intToFloat(f64, e) * 0.30103)); if (exp < 20) { exp = 20; } else if (@intCast(usize, exp) >= lookup_table.len) { @@ -170,10 +170,10 @@ fn errolSlow(val: f64, buffer: []u8) FloatDecimal { // digit generation var buf_index: usize = 0; while (true) { - var hdig = @floatToInt(u8, math.floor(high.val)); + var hdig = @floatToInt(u8, @floor(high.val)); if ((high.val == @intToFloat(f64, hdig)) and (high.off < 0)) hdig -= 1; - var ldig = @floatToInt(u8, math.floor(low.val)); + var ldig = @floatToInt(u8, @floor(low.val)); if ((low.val == @intToFloat(f64, ldig)) and (low.off < 0)) ldig -= 1; if (ldig != hdig) break; @@ -187,7 +187,7 @@ fn errolSlow(val: f64, buffer: []u8) FloatDecimal { } const tmp = (high.val + low.val) / 2.0; - var mdig = @floatToInt(u8, math.floor(tmp + 0.5)); + var mdig = @floatToInt(u8, @floor(tmp + 0.5)); if ((@intToFloat(f64, mdig) - tmp) == 0.5 and (mdig & 0x1) != 0) mdig -= 1; buffer[buf_index] = mdig + '0'; |
