commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Costa Theodosiou (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (LANG-1445) NumberUtils.createNumber() incorrectly creates BigDecimal when a double type is specified
Date Tue, 09 Apr 2019 06:15:00 GMT

     [ https://issues.apache.org/jira/browse/LANG-1445?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Costa Theodosiou updated LANG-1445:
-----------------------------------
    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.

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


> 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
>            Priority: Major
>         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)

Mime
View raw message