-
Notifications
You must be signed in to change notification settings - Fork 40
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: handling of double and integer #316
Conversation
Hey @apulbere, thanks for the PR. Someone will review it shortly. |
Codecov Report
@@ Coverage Diff @@
## main #316 +/- ##
============================================
- Coverage 91.80% 91.41% -0.40%
+ Complexity 213 212 -1
============================================
Files 23 23
Lines 488 489 +1
Branches 31 31
============================================
- Hits 448 447 -1
Misses 24 24
- Partials 16 18 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Value doubleValue = new Value(innerDoubleValue); | ||
assertTrue(doubleValue.isNumber()); | ||
assertEquals(1, doubleValue.asInteger()); // should be rounded | ||
assertEquals(.75, doubleValue.asDouble()); | ||
assertEquals(1, doubleValue.asInteger()); // the double value represented by this object converted to type int |
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.
Thanks for linking the spec related to this rounding "toward zero". I was not aware of this nuance.
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.
Nice work. Yes it makes sense to store Number type instead of double.
@justinabrahms any concerns? |
Signed-off-by: apulbere <[email protected]>
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
This PR
Notes
This is a proposal