You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Costa Theodosiou (JIRA)" <ji...@apache.org> on 2019/04/09 06:13:00 UTC

[jira] [Created] (LANG-1445) NumberUtils.createNumber() incorrectly creates BigDecimal when a double type is specified

Costa Theodosiou created LANG-1445:
--------------------------------------

             Summary: NumberUtils.createNumber() incorrectly creates BigDecimal when a double type is specified
                 Key: LANG-1445
                 URL: https://issues.apache.org/jira/browse/LANG-1445
             Project: Commons Lang
          Issue Type: Bug
          Components: lang.math.*
    Affects Versions: 3.8.1
            Reporter: Costa Theodosiou
         Attachments: NumberUtils_createNumber()_incorrectly_creates_BigDecimal_when_a_double_type_is_specified.patch

{{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.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)