[ 
https://issues.apache.org/jira/browse/NUMBERS-77?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17329187#comment-17329187
 ] 

Matt Juntunen commented on NUMBERS-77:
--------------------------------------

bq. Could the functionality be used as is in [Geometry]?

Yes, I believe so.

bq. Maybe the name is still not right.

Are we sure that {{PrecisionContext}} isn't the best option? This interface is 
essentially a configurable wrapper around the {{Precision}} methods. The 
"context" in this case is the configuration that has been applied at 
instantiation, i.e. the epsilon value.

bq. there is no need for the AbstractPrecisionComparator when all the methods 
can be default methods in the interface

I agree. That is much cleaner.

bq. Or maybe signum(double a) was actually intended , in which case the return 
type should also be changed.

I was picturing this as an easy way to compare to zero. You can see it used 
[here|https://github.com/apache/commons-geometry/blob/master/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/partitioning/AbstractHyperplane.java#L39].
 It's essentially a signum but returning an int for strict equality checking 
(eg, {{cmp == 0}}).  It could easily be written as
{code:java}

default int sign(double a) {
    return compare(a, 0.0);
}

{code}
In regard to the handling of -0.0, that is entirely up to the implementation. 
If {{compare(d, -0.0)}} returns 0, then so should this method.

> Move utilities from "Commons Geometry"
> --------------------------------------
>
>                 Key: NUMBERS-77
>                 URL: https://issues.apache.org/jira/browse/NUMBERS-77
>             Project: Commons Numbers
>          Issue Type: Task
>            Reporter: Gilles Sadowski
>            Priority: Major
>             Fix For: 1.1
>
>         Attachments: NUMBERS-77.diff
>
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> "Commons Geometry" defines utilities that would be a better fit in this 
> component.
> Duplication of general-purpose codes should be avoided, in order to benefit 
> from consolidated usage (bug reporting, performance enhancements, ...).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to