diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-11-07 18:52:09 -0500 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-11-08 15:57:25 -0500 |
| commit | aa0daea5415dd2a20e4d7c2fd047b7bcee6c9ea4 (patch) | |
| tree | b8634d38380eb6fd32ca614678785f36167ca7b2 /lib/std/fmt/parse_float.zig | |
| parent | a2acc2787242fdee189ec4197c0dd847b8245139 (diff) | |
| download | zig-aa0daea5415dd2a20e4d7c2fd047b7bcee6c9ea4.tar.gz zig-aa0daea5415dd2a20e4d7c2fd047b7bcee6c9ea4.zip | |
update more of the std lib to use `@as`
Diffstat (limited to 'lib/std/fmt/parse_float.zig')
| -rw-r--r-- | lib/std/fmt/parse_float.zig | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/std/fmt/parse_float.zig b/lib/std/fmt/parse_float.zig index aa3ac6d458..78ce0b7d0a 100644 --- a/lib/std/fmt/parse_float.zig +++ b/lib/std/fmt/parse_float.zig @@ -375,7 +375,7 @@ pub fn parseFloat(comptime T: type, s: []const u8) !T { return switch (try parseRepr(s, &r)) { ParseResult.Ok => convertRepr(T, r), ParseResult.PlusZero => 0.0, - ParseResult.MinusZero => -T(0.0), + ParseResult.MinusZero => -@as(T, 0.0), ParseResult.PlusInf => std.math.inf(T), ParseResult.MinusInf => -std.math.inf(T), }; @@ -426,8 +426,8 @@ test "fmt.parseFloat" { expect(approxEq(T, try parseFloat(T, "1234e-2"), 12.34, epsilon)); expect(approxEq(T, try parseFloat(T, "123142.1"), 123142.1, epsilon)); - expect(approxEq(T, try parseFloat(T, "-123142.1124"), T(-123142.1124), epsilon)); - expect(approxEq(T, try parseFloat(T, "0.7062146892655368"), T(0.7062146892655368), epsilon)); + expect(approxEq(T, try parseFloat(T, "-123142.1124"), @as(T, -123142.1124), epsilon)); + expect(approxEq(T, try parseFloat(T, "0.7062146892655368"), @as(T, 0.7062146892655368), epsilon)); } } } |
