-
-
Notifications
You must be signed in to change notification settings - Fork 446
Add round and sumAll functions to BigDecimal
#4920
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
Add round and sumAll functions to BigDecimal
#4920
Conversation
The `round` function supports rounding at an arbitrary scale/position and 10 rounding mode: - `ceil`: round towards positive infinity - `floor`: round towards negative infinity - `to-zero`: round towards zero - `from-zero`: round away from zero - `half-ceil`: round to the nearest neighbor; if equidistant round towards positive infinity - `half-floor`: round to the nearest neighbor; if equidistant round towards negative infinity - `half-to-zero`: round to the nearest neighbor; if equidistant round towards zero - `half-from-zero`: round to the nearest neighbor; if equidistant round away from zero - `half-even`: round to the nearest neighbor; if equidistant round to the neighbor with an even digit - `half-odd`: round to the nearest neighbor; if equidistant round to the neighbor with an odd digit The default scale is `0` (round to integer), and the default mode is `half-from-zero`.
🦋 Changeset detectedLatest commit: b4d1d24 The changes in this PR will be included in the next version bump. This PR includes changesets to release 32 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Thanks! Support for rounding has been sorely missing. |
fubhy
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.
Can you make these rounding functions dual (data last)
59ef614 to
7d8c110
Compare
|
@fubhy Thank you for looking into this so quickly. I have now:
|
|
This last fix to the docs should get the builds working. Please let me know if there are any other changes you would like to see. |
fubhy
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.
This looks great. Thanks!
Co-authored-by: Sebastian Lorenz <fubhy@fubhy.com>
Co-authored-by: Sebastian Lorenz <fubhy@fubhy.com>
Co-authored-by: Sebastian Lorenz <fubhy@fubhy.com>
Co-authored-by: Sebastian Lorenz <fubhy@fubhy.com>
Co-authored-by: Sebastian Lorenz <fubhy@fubhy.com>
Co-authored-by: Sebastian Lorenz <fubhy@fubhy.com>
Co-authored-by: Sebastian Lorenz <fubhy@fubhy.com>
Add
roundandsumAllfunctions toBigDecimalType
Description
The
roundfunction supports rounding at an arbitrary scale/position and the following 10 rounding modes:ceil: round towards positive infinityfloor: round towards negative infinityto-zero: round towards zerofrom-zero: round away from zerohalf-ceil: round to the nearest neighbor; if equidistant round towards positive infinityhalf-floor: round to the nearest neighbor; if equidistant round towards negative infinityhalf-to-zero: round to the nearest neighbor; if equidistant round towards zerohalf-from-zero: round to the nearest neighbor; if equidistant round away from zerohalf-even: round to the nearest neighbor; if equidistant round to the neighbor with an even digit at the specified scalehalf-odd: round to the nearest neighbor; if equidistant round to the neighbor with an odd digit at the specified scaleThe default scale is
0(round to integer), and the default mode ishalf-from-zero.The
sumAllfunction mirrors that ofBigInt.sumAll.Related
None