Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-70

Adding tolerance to double[] search methods in ArrayUtils

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0
    • Component/s: None
    • Labels:
      None
    • Environment:

      Operating System: other
      Platform: Other

    • Bugzilla Id:
      22091

      Description

      It is sometimes useful to for the presence of a double within a given tolerance.
      For example, does this double[] array contain 3.054 +/- 0.001?

      The patch attached adds new methods which use the DoubleRange test elements of
      an array:

      ArrayUtils.indexOf(double[] array, double valueToFind, double tolerance)

      ArrayUtils.indexOf(double[] array, double valueToFind, int startIndex, double
      tolerance);

      ArrayUtils.lastIndexOf(double[] array, double valueToFind, int startIndex,
      double tolerance);

      ArrayUtils.contains(double[] array, double valueToFind, double tolerance);

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              tobrien@discursive.com Tim O'Brien
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: