Uploaded image for project: 'Apache Hop (Retired)'
  1. Apache Hop (Retired)
  2. HOP-3435

Add threshold for comparing doubles

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • BACKLOG
    • API
    • None

    Description

      In the IValueMeta there is a compare() method which works fine in general.

      It's used when sorting and for example the Merge Rows transform.
      Unfortunately it uses Double.compare() which doesn't take into account the floating point nature of Number type values.
       
      You get things like 0.999999999 which is an approximation for 1.0 and so if you want to compare 1.0==(1.0000001 - .0000001) you get false pretty much always.
       
      So I think we should add an option to add a global threshold.  Perhaps a variable like HOP_DOUBLE_COMPARE_THRESHOLD would work or a new option in Hop Config.

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            mcasters Matt Casters
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: