-
Notifications
You must be signed in to change notification settings - Fork 170
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
AvgOf produces overflow for large values #532
Comments
@yegor256 please, pay attention to this issue |
@vmotsak definitely a bug, thanks for reporting (although, I have no idea how this can be fixed) |
Job |
@yegor256 i suppose you will have to use BigInteger/BigDecimal for your computations. Having the usual performance impact surely. But if performance is not key here this would have the highest accuracy. |
This can be fixed by calculating the mean value, something like
|
Mathematically correct but you might run into strange double precision problems though. Probably not with your example but to have AvgOf work consistently correct you have to go with the highest precision.
about this. There is way more mathematically advanced stuff about this out there. |
Please see the average of Another one: |
@yegor256 : I have created an example of what IMO could be done with the AvgOf code to fix number overflow, fix precisions problem and cut some code repetitions. Please have a look here: svendiedrichsen@358b7f1 It is still not the most elegant piece of code and surely deserves some more refactoring. But i think it is better than before. |
@yegor256 please have a look at my latest comment on this issue. |
@0crat waiting |
@0crat waiting |
@0crat status |
Are you speaking to me or about me? You must always start your message with my name if you want to address it to me, see §1. |
@0crat status |
@0crat waiting |
@0crat status |
@fabriciofx This is what I know about this job, as in §32: |
The job #532 is now out of scope |
@0crat status |
returns an
Infinity
but should beDouble.MAX_VALUE
The text was updated successfully, but these errors were encountered: