Repository navigation
Merge master (1.4.0) into next - #26
Merged
Merged
Conversation
…actory All additions; the 10,000 call comparison against master shows no difference for existing calls. - divide() takes an optional rounding mode as third argument. Without it the quotient is cut off as before. With it the rounding is decided on whole numbers from the exact remainder, so ties are detected exactly at any scale. - divideWithRemainder() returns the whole number quotient and the remainder, with the same sign rule as mod(). - roundToStep() rounds to a multiple of any positive step, such as 0.05. - createFromFloat() keeps all digits needed to reproduce the float. The constructor casts floats through the precision ini setting and drops digits beyond the 14th by default. The conversion does not depend on LC_NUMERIC. - zero() and one(). allocate() used the declared scale as its unit. A value created with a scale of 0 keeps its decimals in 1.x, so its shares did not sum up. It now uses the decimals actually stored.
Add rounded division, remainder division, step rounding and a float factory
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## next #26 +/- ##
============================================
+ Coverage 97.73% 98.00% +0.27%
- Complexity 171 190 +19
============================================
Files 1 1
Lines 353 401 +48
============================================
+ Hits 345 393 +48
Misses 8 8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brings
nextlevel with the released 1.4.0: roundeddivide(),divideWithRemainder(),roundToStep(),createFromFloat(),zero()andone()with their tests and documentation.Conflicts were limited to two documentation tables, resolved with the 2.0 wording (
mod()at the larger scale,round()applying every mode at the scale).One test differs from
masteron purpose: a value created asnew Decimal('1.5', 0)is1in 2.0, so splitting it in two gives1and0.