-
Notifications
You must be signed in to change notification settings - Fork 145
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
16-bit float support #296
16-bit float support #296
Conversation
I would argue that the test is incorrect, parsing |
@dalle Thanks. I will have a look shortly. Note that I do not trust the tests that I had included. We need to validate. |
@lemire Do you know a path forward on this? |
@dalle I was hoping to have a look today (yeah, not kidding). As you realize, we need to validate the tests carefully and this must be done manually. :-) |
|
Ok. So The For reference, let us consider float32... the smallest value that can be represented is std::string special_case = "0.000000000000000000000000000000000000000000000700649232162408535461864791644958065640130970938257885878534141944895541342930300743319094181060791015625";
float parsed;
fast_float::from_chars(special_case.data(), special_case.data() + special_case.size(), parsed);
std::cout << std::hexfloat << parsed << std::endl; We get zero. So I think that the failing test is indeed correct. So there is at least one bug remaining... although it might be the only one! |
So what happens here is that we effectively have a round-to-even case together with a subnormal. This breaks our assumption. fast_float/include/fast_float/decimal_to_binary.h Lines 160 to 162 in 1d50f57
So additional math work is needed. |
I am still merging, but I will open an issue. |
Potential fix for issue #148
Augmenting initial work done in pull request #264
Still some issues remain.