-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
fix: prettier floating point numbers #1293
Conversation
@jk-jeon, given your expertise, would you be willing to review this? |
8a3c7b3
to
b81ffd7
Compare
Looks good. Thanks! |
It looks like the indentation style of the new code is inconsistent with that of the rest of the codebase (4 vs 2 spaces). @SGSSGene can you make the style consistent? |
Yes, very good points. Should I also make a |
dda0397
to
1fe5866
Compare
4ccb3a6
to
acf2e70
Compare
I split |
@jbeder an you help me out with the current windows-shared-build errors? (I currently don't have a windows machine at hand). I thought adding |
Honestly I don't know, I don't have a Windows machine any more either :) Maybe ask on Stack Overflow? I'd be shooting in the dark also. |
f40095f
to
f4368b1
Compare
Found the issue: the fptostring.cpp didn't include fptostring.h, which than didnt see the "YAML_CPP_API" declaration, which then didn't export the symbols into the dll. Fixed now! Ready to go from my side :-) |
@jbeder Could you give another round of review, please? Can't wait to stop uglifying my configs :) |
Hi @jbeder , any chance you can take another look? |
Hey @jbeder, a polite reminder that this is still open :-) |
Sorry for the delay. Changes LGTM on my side. @jbeder Can you please take a look at this? |
@jbeder Are there any other blockers before this can be merged? |
@jbeder, any thing we can do, to motivate you looking at this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I've been busy. Also, has the owner of dragonbox approved this PR?
I approved the license notification. |
Add dragonbox to compute the required precision to print floating point numbers. This avoids uglification of floating point numbers that happen by default via std::stringstream. Numbers like 34.34 used to be converted to '34.340000000000003' as strings. With this version they will be converted to the string '34.34'. This fixes issue jbeder#1289
f4368b1
to
bb792ce
Compare
@jbeder Hey jbeder, friendly reminder, I made the adjustments you suggested to make. |
fixes #1289.
This PR adds a new function
fp_to_string
.fp_to_string
internally uses dragonbox to compute the required precision to print floating point numbers. This avoids uglification of floating point numbers that happen by default via std::stringstream.Numbers like 34.34 will be converted to '34.340000000000003' as strings. With this version they will be converted to the string '34.34'.