Uploaded image for project: 'Commons JEXL'
  1. Commons JEXL
  2. JEXL-87

Inconsistent behaviour of arithmetical operations

    Details

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

      Description

      BigInteger(7) / BigInteger(2) == 3
      whereas
      BigDecimal(7) / BigDecimal(2) == 4, because the result is rounded up.

      I would expect the results to be the same.

      Rather worse is:

      BigDecimal(7) % BigDecimal(2) == -1

      which makes no sense at all.

      Seems to me that the arithmetic "rules" need revisiting and rationalising - for example why should Integer be treated as double?

      At present literal numbers are treated as Integer or Float; there's no option to generate Long or Double literals.

        Attachments

          Activity

            People

            • Assignee:
              henrib Henri Biestro
              Reporter:
              sebb Sebb
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: