Uploaded image for project: 'Apache Apex Malhar'
  1. Apache Apex Malhar
  2. APEXMALHAR-665

Support Monetary Calculations in Operators

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • algorithms
    • None

    Description

      Currently Average operator has calculations with double, which in general may not be well suited for monetary operations (this can lead to incorrect results).
      sums += tuple.doubleValue();

      Reason:
      "The float and double types are particularly ill-suited for monetary calculations because it is impossible to represent 0.1 (or any other negative power of ten) as a float or double exactly."

      Solution:
      "Use BigDecimal, int, or long for monetary calculations."

      Reference:
      Bloch, Joshua (2008-05-08). Effective Java (2nd Edition) (Java Series) (p. 218). Pearson Education. Kindle Edition.

      Attachments

        Activity

          People

            akekre Amol Kekre
            davidyan David Yan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: