commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <>
Subject [JEXL] 2.0 incompatible change of number coercion behaviour
Date Sun, 13 Sep 2009 23:37:29 GMT
Recent changes to the arithmetical operations mean that many
arithmetic operation results are now coerced to Integer, even if both
input variables are Long.

This is unexpected behaviour - e.g. Commons Jelly expects that Long*2 => Long

Seems to me that the result of an arithmetic op should generally be
the same as the "bigger" type, i.e the combinations should be treated
as follows:

Integer op Integer => Integer
Long op Integer|Long => Long
BigInteger op Integer|Long|Biginteger => BigInteger
BigDecimal op Integer|Long|Biginteger|BigDecimal => BigDecimal

As before, I suggest we keep:
Float|Double,anything => Double

Numeric Literals were (and are) treated as Integer, which works well
with the above scheme.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message