commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitri Blinov (JIRA)" <j...@apache.org>
Subject [jira] [Created] (JEXL-167) Possible loss of value when converting BigDecimal to BigInteger
Date Fri, 24 Jul 2015 05:41:04 GMT
Dmitri Blinov created JEXL-167:
----------------------------------

             Summary: Possible loss of value when converting BigDecimal to BigInteger
                 Key: JEXL-167
                 URL: https://issues.apache.org/jira/browse/JEXL-167
             Project: Commons JEXL
          Issue Type: Bug
    Affects Versions: 3.0
            Reporter: Dmitri Blinov


In JexlArithmetic.java method *public BigInteger toBigInteger(Object val)* uses the following
case for BigDecimals as for any other numbers:
...
 else if (val instanceof Number) {
            return BigInteger.valueOf(((Number) val).longValue());
...

For large BigDecimals > Long.MAX_VALUE it may lead to loss of value. Please consider using
BigDecimal.toBigInteger() method for that case?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message