commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <>
Subject [jira] Created: (JEXL-87) Inconsistent behaviour of arithmetical operations
Date Thu, 20 Aug 2009 10:47:15 GMT
Inconsistent behaviour of arithmetical operations

                 Key: JEXL-87
             Project: Commons JEXL
          Issue Type: Bug
            Reporter: Sebb

BigInteger(7) / BigInteger(2) == 3
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.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message