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:15:00 UTC
[jira] [Updated] (LANG-1445) NumberUtils.createNumber() incorrectly
creates BigDecimal when a double type is specified
[ 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)