-
Notifications
You must be signed in to change notification settings - Fork 649
TrimTrailingZeros and AvoidScientificNotation bool variables #389
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
TrimTrailingZeros and AvoidScientificNotation bool variables #389
Conversation
…ros-global-var String trim trailing zeros global var
|
I added the following tests for handling trailing zeros on negative precision. Such as "1000 to the nearest 100 should serialize as 1.0E2" (for those not familiar with scientific notation usage, it is required when precision is non-fractional. For example, the population of the U.S. is 314.9 million or, more properly This test does not pass the last two. I'll have to edit some code to fix the bug.
|
|
Sadly, it appears that covering both cases breaks backwards compatibility. So, I've separated it out. I've added a As a bonus, I went ahead and made |
mwoss
left a comment
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.
Overall looks solid. I won't block merging it. We could fix this variable name later if needed.
Sorry for late review 🙏
| // | ||
| // For example, 1200 rounded to the nearest 100 cannot accurately be shown as "1200" because the last two | ||
| // digits are unknown. With this set to false, that number would be expressed as "1.2E3" instead. | ||
| var AvoidScientificNotation = true |
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.
Using negative variable names often leads to double negatives in logic (e.g., if (!AvoidScientificNotation)), which can be confusing. Could we use a positive name like UseScientificNotation, WithScientificNotation? jut to decrease congnitive load.
What do you think?
This is a near-duplicate of #296 that preserves the @vasilbeckk 's work and commits. I will now start making the changes requested in #296.