-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve averageBigInteger and sumBigInteger precision/conversion (#286)
This commit improves the precision and conversion behavior of `MathFlux` `sumBigInteger` and `averageBigInteger` methods. These method better deal with fractional types by internally summing using a `BigDecimal` rather than a `BigInteger`. As a result, the only lossy step is at the end when the result is effectively presented as a `BigInteger`: - `sum`: remaining fractional part of the BigDecimal sum is dropped - `average`: the division by `count` is applied, then the result's fractional part is dropped Previously the fractional part would be progressively dropped by implicit conversion of each incoming element to `long`. Similar to precision improvement done in #260/#261 and earlier iteration done in #284.
- Loading branch information
1 parent
ebdd035
commit 0bcce82
Showing
4 changed files
with
113 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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