You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Dmitri Blinov (JIRA)" <ji...@apache.org> on 2015/07/24 07:41:04 UTC
[jira] [Created] (JEXL-167) Possible loss of value when converting
BigDecimal to BigInteger
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)