Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-1445

NumberUtils.createNumber() incorrectly creates BigDecimal when a double type is specified

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.8.1
    • None
    • lang.math.*
    • None

    Description

      NumberUtils.createNumber(Double.valueOf(Double.MIN_VALUE).toString() + "D")

      and

      NumberUtils.createNumber(Double.valueOf(Double.MIN_VALUE).toString() + "F")

      are incorrectly creating BigDecimals.

      This is due to a bug:

      if (!(d.isInfinite() || d.floatValue() == 0.0D && !allZeros)) {

      which should be:

      if (!(d.isInfinite() || d.doubleValue() == 0.0D && !allZeros)) {

      A patch has been attached.

      Attachments

        Activity

          People

            Unassigned Unassigned
            costat Costa Theodosiou
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: