| author | |
| committer | |
| log | d1202b1f6627eb1d8955fc8157685871bafe0d24 |
| tree | d8a8b5dd2f734e69e31fa9b2da693431005816ff |
| parent | f9db21f03eaf0b800e531d12c2677d579eceaff0 |
2 files changed, 6 insertions(+), 6 deletions(-)
lib/std/fmt/parse_float.zig+3-1| ... | ... | @@ -306,7 +306,7 @@ fn parseRepr(s: []const u8, n: *FloatRepr) !ParseResult { |
| 306 | 306 | |
| 307 | 307 | State.Exponent => { |
| 308 | 308 | if (isDigit(c)) { |
| 309 | if (exponent < std.math.maxInt(i32)) { | |
| 309 | if (exponent < std.math.maxInt(i32) / 10) { | |
| 310 | 310 | exponent *= 10; |
| 311 | 311 | exponent += @intCast(i32, c - '0'); |
| 312 | 312 | } |
| ... | ... | @@ -417,6 +417,8 @@ test "fmt.parseFloat" { |
| 417 | 417 | expectEqual((try parseFloat(T, "inF")), std.math.inf(T)); |
| 418 | 418 | expectEqual((try parseFloat(T, "-INF")), -std.math.inf(T)); |
| 419 | 419 | |
| 420 | expectEqual(try parseFloat(T, "0.4e0066999999999999999999999999999999999999999999999999999"), std.math.inf(T)); | |
| 421 | ||
| 420 | 422 | if (T != f16) { |
| 421 | 423 | expect(approxEq(T, try parseFloat(T, "1e-2"), 0.01, epsilon)); |
| 422 | 424 | expect(approxEq(T, try parseFloat(T, "1234e-2"), 12.34, epsilon)); |
lib/std/json/test.zig+3-5| ... | ... | @@ -1751,11 +1751,9 @@ test "i_number_double_huge_neg_exp" { |
| 1751 | 1751 | } |
| 1752 | 1752 | |
| 1753 | 1753 | test "i_number_huge_exp" { |
| 1754 | return error.SkipZigTest; | |
| 1755 | // FIXME Integer overflow in parseFloat | |
| 1756 | // any( | |
| 1757 | // \\[0.4e00669999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999969999999006] | |
| 1758 | // ); | |
| 1754 | any( | |
| 1755 | \\[0.4e00669999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999969999999006] | |
| 1756 | ); | |
| 1759 | 1757 | } |
| 1760 | 1758 | |
| 1761 | 1759 | test "i_number_neg_int_huge_exp" { |