Commons Lang
  1. Commons Lang
  2. LANG-70

Adding tolerance to double[] search methods in ArrayUtils

    Details

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

      Operating System: other
      Platform: Other

      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);

        Activity

        Tim O'Brien created issue -
        Hide
        Tim O'Brien added a comment -

        Created an attachment (id=7631)
        tolerance search and unit tests patch

        Show
        Tim O'Brien added a comment - Created an attachment (id=7631) tolerance search and unit tests patch
        Hide
        Stephen Colebourne added a comment -

        Patch committed with changes, thanks.

        (Please no tabs!)

        Show
        Stephen Colebourne added a comment - Patch committed with changes, thanks. (Please no tabs!)
        Henri Yandell made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 22091 12340882
        Henri Yandell made changes -
        Key COM-731 LANG-70
        Assignee Jakarta Commons Developers Mailing List [ commons-dev@jakarta.apache.org ]
        Project Commons [ 12310458 ] Commons Lang [ 12310481 ]
        Affects Version/s unspecified [ 12311647 ]
        Fix Version/s 2.0 Final [ 12311658 ]
        Component/s Lang [ 12311121 ]
        Henri Yandell made changes -
        Fix Version/s 2.0 Final [ 12311706 ]
        Mark Thomas made changes -
        Workflow jira [ 12369787 ] Default workflow, editable Closed status [ 12602456 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Tim O'Brien
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development