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

Possible loss of value when converting BigDecimal to BigInteger

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0
    • 3.0
    • None

    Description

      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?

      Attachments

        Activity

          People

            henrib Henri Biestro
            dmitri_blinov Dmitri Blinov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: