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

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.8.1
    • Fix Version/s: None
    • Component/s: lang.math.*
    • Labels:
      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

            • Assignee:
              Unassigned
              Reporter:
              costat Costa Theodosiou
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: