You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Matt Juntunen (JIRA)" <ji...@apache.org> on 2018/12/24 14:25:00 UTC
[jira] [Commented] (NUMBERS-90) DoublePrecisionContext
[ https://issues.apache.org/jira/browse/NUMBERS-90?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16728414#comment-16728414 ]
Matt Juntunen commented on NUMBERS-90:
--------------------------------------
Working on this here: [https://github.com/darkma773r/commons-numbers/tree/numbers-90-working]
It felt best to have these classes in their own package, so I created {{o.a.c.n.core.precision}}. It may be good to move {{Precision}} into this package too, if we want to go this way.
> DoublePrecisionContext
> ----------------------
>
> Key: NUMBERS-90
> URL: https://issues.apache.org/jira/browse/NUMBERS-90
> Project: Commons Numbers
> Issue Type: New Feature
> Reporter: Matt Juntunen
> Priority: Blocker
>
> We should add a new class to commons-numbers-core that encapsulates configurable strategies for comparing doubles. This is required for GEOMETRY-11. Here is what I'm picturing:
> {code:java}
> // abstract class for the general concept of comparisons
> public abstract class DoublePrecisionContext implements Comparator<Double> {
> public abstract boolean equals(double a, double b);
> public int compare(double a, double b) { /* ... */ }
> public int compare(Double a, Double b) { /* ... */ }
> }
> // ...
> // concrete class implementing a specific strategy
> public class EpsilonUlpDoublePrecisionContext extends DoublePrecisionContext {
> public EpsilonUlpDoublePrecisionContext(double eps, double maxUlps) { /* ... */ }
> @Override
> public boolean equals(double a, double b) { /* ... */ }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)