commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Loic Guibert (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-1187) Method createNumber from NumberUtils doesn't work for floating point numbers other than Float
Date Tue, 24 Nov 2015 13:43:10 GMT

    [ https://issues.apache.org/jira/browse/LANG-1187?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15024532#comment-15024532
] 

Loic Guibert commented on LANG-1187:
------------------------------------

I just take a quick look and it's seem to be caused by the order of conversion priority for
decimal number (Float > Double > BigDecimal) and the test for select between those types
is based on the number of digits past the decimal point.
But wouldn't it be on significant digits instead ? (if significant digits >=7 there is
a risk that float can be unable to represents the entire number)

> Method createNumber from NumberUtils doesn't work for floating point numbers other than
Float
> ---------------------------------------------------------------------------------------------
>
>                 Key: LANG-1187
>                 URL: https://issues.apache.org/jira/browse/LANG-1187
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.math.*
>    Affects Versions: 3.4
>            Reporter: leizhiyuan
>            Priority: Critical
>
> demo:
>  Number n = org.apache.commons.lang3.math.NumberUtils.createNumber("6264583.33");
>         System.out.println("lang3_createNumber_6264583.33---->" + n);
> while n will be 6264583.5. not 6264583.33



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message