-
Notifications
You must be signed in to change notification settings - Fork 17
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
charconv2 #195
Comments
This is not the first time you have made this claim (see: boostorg/math#1118) without any backing. I ask you please:
As far as I am concerned the standard says there is only implementation specific compatibility for roundtripping values, and I know that qNaNs and sNaNs are distinguished and roundtripped correctly here. Quote from section 22.13.2 Note 1
These are already in the library: https://github.com/boostorg/charconv/blob/develop/include/boost/charconv/from_chars.hpp#L226. I agree it's not an ideal situation but this overload takes
For floating point types? This can also be trivially implemented on the user end by
Are you intending to open a PR in math with the changes?
|
Hello Matt, thx |
That's not a bug that is a deliberate design choice that is legal under C99 definition of My rationale for following the MSVC and Clang handling of qNaN and sNaN is that they are entirely distinct values as defined in IEEE 754, so that should be reflected in the output. |
Hello Matt
This makes sense in principle; see below.
This statement is probably not correct. Only MSVC seems to support the string values "nan(ind)", "nan(snan)" and "-nan(snan)". In any case, gcc, clang and intel do not: https://godbolt.org/z/j7Y3nhEYd Intermediate question about MSVC (I don't have it)
As I said, it is a problem that MSVC (once again) deviates. But how should this be dealt with? There are various possibilities:
This also applies to parsing (from_chars)
This is clearly regulated with my charconv2. The additional parameter specifies whether a distinction should be made between qnan/snan at all:
It might also be possible to provide differently named functions (such as boost::charconv::from_chars_erange), which provide this functionality first. But then boost::charconv::from/to_chars would have to be 100% compatible (with all compilers on all OS) to std::from/to_chars. Hints
regards |
Hello Matt
No, the behavior is different. The values must be fully qualified, i.e. contain at least as many digits as the corresponding type contains relevant bits. All subsequent digits are ignored.
Why do I provide this functionality? regards |
If you open a PR with just this feature, and the associated testing I'll take a look because I can see the utility in it. The rest I can't say I want to pursue. |
Hello Matt,
I would like to provide an extended library boost::charconv2. This implements:
Implementation
I need a few more things:
charconv2.hpp.txt
Examples
Results
What is your opinion on this? I would be delighted to receive your comments.
regards
Gero
Edit
I just realized that this will not work for you. This is because I have rewritten boost::math::cstdfloat -> into a separate library boost::cstdfloat. Why?
Here for example my types.hpp vs. boost::math::cstdfloat::cstdfloat_types.hpp types.hpp.txt
The text was updated successfully, but these errors were encountered: