[
https://issues.apache.org/jira/browse/MATH-1470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16637042#comment-16637042
]
Gilles commented on MATH-1470:
------------------------------
Hi.
Thanks for the report and analysis.
Class {{Precision}} has been [moved to the "Commons Numbers"
project|https://git1-us-west.apache.org/repos/asf?p=commons-numbers.git;a=blob;f=commons-numbers-core/src/main/java/org/apache/commons/numbers/core/Precision.java;h=11fe704383e46ee421a1c0c344dd86d86a2bcdbc;hb=HEAD],
and so won't be part of the next major release (v4.0) of "Commons Math".
Could you please file an issue in the [bug tracking system for
"Numbers"|https://issues.apache.org/jira/projects/NUMBERS/issues/], linking
that issue to this one? Thanks.
It would of course be great if you could also provide a fix in the form of
patch (or pull request) containing the necessary code changes and associated
unit test(s).
> Precision.round(double...)'s use of Double.toString(x) rounds twice resulting
> in inaccuracy
> -------------------------------------------------------------------------------------------
>
> Key: MATH-1470
> URL: https://issues.apache.org/jira/browse/MATH-1470
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 3.6.1
> Reporter: George Smith
> Priority: Major
> Original Estimate: 10m
> Remaining Estimate: 10m
>
> The use of Double.toString( x ) in the creation of the BigDecimal used by the
> Precision.round(double...) methods introduces a rounding that can then
> generate incorrect results when the rounding is applied to the BigDecimal.
> Whenever possible rounding should only be applied to the most accurate value
> available. Switching the BigDecimal construction to use the double value
> directly resolves the problem.
>
> This problem can be seen by running the main method of the
> com.altoros.floatingpoint.PrecisionProblem class in the repo hosted at:
> [https://github.com/Altoros/precision-problem]
>
> George
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)