| ... | ... | @@ -37,7 +37,9 @@ |
| 37 | 37 | const std = @import("../std.zig"); |
| 38 | 38 | const ascii = std.ascii; |
| 39 | 39 | |
| 40 | | const max_digits = 25; |
| 40 | // The mantissa field in FloatRepr is 64bit wide and holds only 19 digits |
| 41 | // without overflowing |
| 42 | const max_digits = 19; |
| 41 | 43 | |
| 42 | 44 | const f64_plus_zero: u64 = 0x0000000000000000; |
| 43 | 45 | const f64_minus_zero: u64 = 0x8000000000000000; |
| ... | ... | @@ -409,6 +411,7 @@ test "fmt.parseFloat" { |
| 409 | 411 | expect(approxEq(T, try parseFloat(T, "123142.1"), 123142.1, epsilon)); |
| 410 | 412 | expect(approxEq(T, try parseFloat(T, "-123142.1124"), @as(T, -123142.1124), epsilon)); |
| 411 | 413 | expect(approxEq(T, try parseFloat(T, "0.7062146892655368"), @as(T, 0.7062146892655368), epsilon)); |
| 414 | expect(approxEq(T, try parseFloat(T, "2.71828182845904523536"), @as(T, 2.718281828459045), epsilon)); |
| 412 | 415 | } |
| 413 | 416 | } |
| 414 | 417 | } |