Uploaded image for project: 'Commons Numbers'
  1. Commons Numbers
  2. NUMBERS-90

DoublePrecisionContext

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Blocker
    • Resolution: Won't Fix
    • None
    • None
    • None
    • None

    Description

      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:

      // 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) { /* ... */ }
      } 

      Pull request: https://github.com/apache/commons-numbers/pull/28

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mattjuntunen Matt Juntunen
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m