[
https://issues.apache.org/jira/browse/NUMBERS-185?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alex Herbert resolved NUMBERS-185.
----------------------------------
Resolution: Fixed
Fixed in commit:
49d9b54864efeed65ab7366f02ea6aac6591dcc6
> Precision.compareTo with ulps cannot be used for sorting
> --------------------------------------------------------
>
> Key: NUMBERS-185
> URL: https://issues.apache.org/jira/browse/NUMBERS-185
> Project: Commons Numbers
> Issue Type: Bug
> Components: core
> Affects Versions: 1.0
> Reporter: Alex Herbert
> Priority: Trivial
> Fix For: 1.1
>
>
> The Precision.compareTo class was fixed in NUMBERS-154 to allow correct
> handling of NaN values. This fixed was applied to the compareTo with a delta
> but not compareTo using a max ULP argument.
> This can be fixed by using Double.compare (as is done in compareTo(double,
> double, double):
> {code:java}
> public static int compareTo(final double x, final double y, final int
> maxUlps) {
> if (equals(x, y, maxUlps)) {
> return 0;
> } else if (x < y) {
> return -1;
> } else if (x > y) {
> return 1;
> }
> // NaN input.
> return Double.compare(x, y);
> } {code}
>
--
This message was sent by Atlassian Jira
(v8.20.1#820001)