Skip to content

f80 float round-trip failure on windows x86_64 #20619

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

Open
tiehuis opened this issue Jul 13, 2024 · 0 comments
Open

f80 float round-trip failure on windows x86_64 #20619

tiehuis opened this issue Jul 13, 2024 · 0 comments
Labels
bug Observed behavior contradicts documented or intended behavior os-windows
Milestone

Comments

@tiehuis
Copy link
Member

tiehuis commented Jul 13, 2024

Zig Version

0.14.0-dev.283+1d20ff11d

Steps to Reproduce and Observed Behavior

When adding f80 support (#20462) there were CI failures on the windows x86_64 build when performing round-trip checks on f80. This specific case has been disabled. Other platforms correctly round-trip these.

An example of a specific failing test case:

C:\Users\ci\george2\_work\zig\zig\build-release\zig-local-cache\o\ef0547664f7b4931546bf402c80a8059\test.exe --listen=- 
test
+- test-std
   +- run test std-x86_64-windows.win11_ge...win11_ge-gnu-skylake-Debug 2657/2724 passed, 1 failed, 66 skipped
error: 'fmt.format_float.test.format f80' failed: expected 907682844368439810595840, found 907682844368439810596864
C:\Users\ci\george2\_work\zig\zig\lib\std\testing.zig:93:17: 0xe829e3 in expectEqualInner__anon_35380 (test.exe.obj)
                return error.TestExpectedEqual;
                ^
C:\Users\ci\george2\_work\zig\zig\lib\std\fmt\format_float.zig:1530:9: 0x12db79a in check__anon_46210 (test.exe.obj)
        try std.testing.expectEqual(value_bits, o_bits);
        ^
C:\Users\ci\george2\_work\zig\zig\lib\std\fmt\format_float.zig:1655:5: 0x12dcd86 in test.format f80 (test.exe.obj)
    try check(f80, -2.109808898695963e16, "-2.109808898695963e16");
    ^
input = -2.109808898695963e16

i = 907682844368439810595840 // in
r = 907682844368439810596864 // reparsed

i = 0xc03595e9334703be1c00
r = 0xc03595e9334703be2000

i_man = 0x95e9334703be1c00
i_exp = 0x4035 (16437)
i_int = 1
i_sgn = 1
 
r_man = 0x95e9334703be2000
r_exp = 0x4035 (16437)
r_int = 1
r_sgn = 1

Note that r_man - i_man = 1024 = 2^8 which seems a little suspect.

Expected Behavior

We should be able to round-trip all f80's:

if (T == f80 and builtin.target.os.tag == .windows and builtin.target.cpu.arch == .x86_64) return;

@tiehuis tiehuis added bug Observed behavior contradicts documented or intended behavior os-windows labels Jul 13, 2024
@Vexu Vexu added this to the 0.15.0 milestone Jul 14, 2024
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 os-windows
Projects
None yet
Development

No branches or pull requests

2 participants