Skip to content

standard library hex float parsing incorrect value #10737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
andrewrk opened this issue Jan 30, 2022 · 1 comment
Closed

standard library hex float parsing incorrect value #10737

andrewrk opened this issue Jan 30, 2022 · 1 comment
Labels
bug Observed behavior contradicts documented or intended behavior contributor friendly This issue is limited in scope and/or knowledge of Zig internals. standard library This issue involves writing Zig code for the standard library.
Milestone

Comments

@andrewrk
Copy link
Member

Zig Version

0.10.0-dev.493+91ad96b88

Steps to Reproduce

Apply this diff to get a new test case:

--- a/lib/std/fmt/parse_hex_float.zig
+++ b/lib/std/fmt/parse_hex_float.zig
@@ -338,6 +338,7 @@ test "f128" {
         // // Min denormalized value.
         .{ .s = "0x1p-16494", .v = math.f128_true_min },
         .{ .s = "-0x1p-16494", .v = -math.f128_true_min },
+        .{ .s = "0x1.edcb34a235253948765432134674fp-1", .v = 0x1.edcb34a235253948765432134674fp-1 },
     };
 
     for (cases) |case| {

Run the standard library tests:

$ ./zig test ../lib/std/std.zig 

Expected Behavior

All tests passed.

Actual Behavior

New test case fails:

Test [876/2176] fmt.parse_hex_float.test "f128"... expected 85065030167199919517705913334175581812, found 85065030167199919517705913334175581813
Test [877/2176] fmt.parse_hex_float.test "f128"... FAIL (TestExpectedEqual)
@andrewrk andrewrk added bug Observed behavior contradicts documented or intended behavior contributor friendly This issue is limited in scope and/or knowledge of Zig internals. standard library This issue involves writing Zig code for the standard library. labels Jan 30, 2022
@andrewrk andrewrk added this to the 0.10.0 milestone Jan 30, 2022
@schmee
Copy link
Contributor

schmee commented Feb 1, 2022

Closed by #10743?

@Vexu Vexu closed this as completed Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior contributor friendly This issue is limited in scope and/or knowledge of Zig internals. standard library This issue involves writing Zig code for the standard library.
Projects
None yet
Development

No branches or pull requests

3 participants