Skip to content
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 BigInteger out of range bug, cause of using long value. #284

Closed
wants to merge 4 commits into from
Closed

Fix BigInteger out of range bug, cause of using long value. #284

wants to merge 4 commits into from

Conversation

Sunshow
Copy link

@Sunshow Sunshow commented Apr 5, 2022

Previous version use number.longValue, and may be out of range, use String to fix it just like BigDecimal.

@pivotal-cla
Copy link

@Sunshow Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@pivotal-cla
Copy link

@Sunshow Thank you for signing the Contributor License Agreement!

@simonbasle
Copy link
Member

@Sunshow thanks ! any chance you can add a test?

@Sunshow
Copy link
Author

Sunshow commented Apr 7, 2022

@simonbasle just commit a new test case named monoBigIntegerRange()

@simonbasle
Copy link
Member

for reference: this is similar to #260 and #261

Copy link
Member

@simonbasle simonbasle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good. one last comment around tests and this is good to merge from my perspective @Sunshow 👍

@simonbasle simonbasle added the type/bug A general bug label Apr 7, 2022
@simonbasle simonbasle added this to the 3.4.8 milestone Apr 7, 2022
@simonbasle
Copy link
Member

if that's all good from your perspective @Sunshow I'll rebase on top of 3.4.x and merge in that branch (will need to do a force-push of your branch, FYI)

@Sunshow
Copy link
Author

Sunshow commented Apr 7, 2022

if that's all good from your perspective @Sunshow I'll rebase on top of 3.4.x and merge in that branch (will need to do a force-push of your branch, FYI)

That's ok, looking forward to the new release.

@simonbasle
Copy link
Member

I cannot rework the PR, either because you haven't authorized maintainers to modify your fork/PR or because this was opened from your fork's main branch. you will need to close that one and reopen a PR that applies the changes in a branch derived from 3.4.x unfortunately, if you want this to ship in next week's 3.4.8 release 😞

@Sunshow
Copy link
Author

Sunshow commented Apr 7, 2022

Complete the PR.

@Sunshow Sunshow closed this Apr 7, 2022
@simonbasle
Copy link
Member

Complete the PR.

I'm assuming you're asking me to add the fix in 3.4.x branch myself?
I can do that and I think it makes sense.

Yet, let me know if you still want to contribute it.

In order to avoid the same confusion in the future, I would suggest always contributing PRs from feature branches (not a direct equivalent of the target maintenance branch) and making sure the "allow maintainers of the project to contribute to that PR" checkbox is checked.

@Sunshow Sunshow reopened this Apr 8, 2022
@Sunshow
Copy link
Author

Sunshow commented Apr 8, 2022

Complete the PR.

I'm assuming you're asking me to add the fix in 3.4.x branch myself? I can do that and I think it makes sense.

Yet, let me know if you still want to contribute it.

In order to avoid the same confusion in the future, I would suggest always contributing PRs from feature branches (not a direct equivalent of the target maintenance branch) and making sure the "allow maintainers of the project to contribute to that PR" checkbox is checked.

My fault, that's my first PR, and I'm busy taking care of my babies, later I will learn how to continue.

@Sunshow Sunshow closed this Apr 8, 2022
@simonbasle
Copy link
Member

that's no problem @Sunshow ! thanks for bringing the issue to our attention, in any case 🙇 👍 I will take care of that one, don't worry

simonbasle added a commit that referenced this pull request Apr 11, 2022
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants