Fix for printing long doubles bug in dump_float#3929
Conversation
When you use long double as a floating point type with the current version of this file and try to dump json it prints trash instead of actual number. This if-else fixes the problem. On using long double you just need to add an 'L' modifier before 'g' in format string. Signed-off-by: Kirill Lokotkov <klokotkov@ya.ru>
🔴 Amalgamation check failed! 🔴The source code has not been amalgamated. @RUSLoker Please read and follow the Contribution Guidelines. |
nlohmann
left a comment
There was a problem hiding this comment.
The library targets C++11. Please adjust the code.
Signed-off-by: Kirill Lokotkov <klokotkov@ya.ru>
🔴 Amalgamation check failed! 🔴The source code has not been amalgamated. @RUSLoker Please read and follow the Contribution Guidelines. |
Signed-off-by: Kirill Lokotkov <klokotkov@ya.ru>
🔴 Amalgamation check failed! 🔴The source code has not been amalgamated. @RUSLoker Please read and follow the Contribution Guidelines. |
Signed-off-by: rusloker <klokotkov@ya.ru>
|
I think a test is missing or? |
|
Yes, a test is definitely required. There is also #3906 that I need to take care of to finally have a green CI again. I'm busy right now, so sorry for delays. |
|
Please update to recent develop version - the CI is fixed there (see #3906). |
|
@nlohmann, it asks for your approval to run CI workflows. |
|
@nlohmann, @gregmarr, what's wrong with Cirrus CI / check? |
Looks like a glitch. |
|
I think this can be closed in favor of #5169. |
|
Sounds good, so please update to the latest develop branch. |
# Conflicts: # include/nlohmann/detail/output/serializer.hpp # single_include/nlohmann/json.hpp
Signed-off-by: rusloker <klokotkov@ya.ru>
|
@nlohmann, added fix to your solution. Reason described in the code comment. |
…type safety Signed-off-by: rusloker <klokotkov@ya.ru>
Signed-off-by: rusloker <klokotkov@ya.ru>
Signed-off-by: rusloker <klokotkov@ya.ru>
|
Please check the DCO requirements. |
30dd3ba to
ecafc47
Compare
|
Yeeeeah, finally my fix would be merged after 3 years :) Danke! |
|
Thank you! |
When you use long double as a floating point type with the current version of include/nlohmann/detail/output/serializer.hpp and try to dump json it prints trash instead of actual number. This if-else fixes the problem. On using long double you just need to add an 'L' modifier before 'g' in format string.