-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Workaround for Windows denormal bug in float_to_str_bytes_common #14080
Conversation
Could a test be added for this, or could a test be un-ignored? Also, if this fails on mingw32, does it pass on mingw-w64? |
Sorry, took some time to get Mingw-w64 set up. Here's what I found. Turns out if I run:
I can get different results depending on the system:
So the patch here should work for all the above cases. (Though, if Rust doesn't support vanilla Mingw then this pull request wouldn't make any difference.) |
Can you add a brief comment on the file explaining this? |
On Windows (MinGW32), `2.0f64.powf(-1074.0)` returns zero instead of a denormal number, which screws up everything later on in `float_to_str_bytes_common`. Changing it to use `powi` works around the problem.
Done. |
Can you add a test as well? |
Currently, the |
Well if it tests for all cases above it should be fine. @alexcrichton: is this ready to land? |
I'm curious why |
I'm not really sure. What implementation of |
|
Not sure which one is the "real" version. Also, it's |
Yeah, it's 4.0.x - mingw 4.0 added mingw 3.x uses Anyway, I'm not sure if we want mingw-specific workaround. We migrated to mingw-w64 partially because mingw has buggy floating point implementation. Should we still support for mingw? I don't have concrete answer now. |
Ah I see. Well, dropping Mingw support would simplify things, and my experience has been that Mingw-compiled Rust seems quite a bit slower than Mingw-w64-compiled Rust. |
The test case that this appears to be fixing seems to be running successfully on our windows bots, running mingw-w64. If this is a bug in the mingw implementation of floating point, then it looks like the bug is with upstream mingw rather than with us, so I'd rather not deviate from the correct implementation (mingw-w64) in all cases where we're compiling on windows. For that reason, I'm going to close this for now. If I misinterpreted what was said, though, feel free to reopen! |
On Windows (MinGW32),
2.0f64.powf(-1074.0)
returns zero instead of a denormal number, which screws up everything later on infloat_to_str_bytes_common
. Changing it to usepowi
works around the problem but breaks the build on Linux (and presumably other systems).Fixes #13439.