You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Henri Yandell (JIRA)" <ji...@apache.org> on 2011/04/20 08:28:05 UTC
[jira] [Commented] (LANG-693) Method createNumber from NumberUtils
doesn't work for floating point numbers other than Float
[ https://issues.apache.org/jira/browse/LANG-693?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13021987#comment-13021987 ]
Henri Yandell commented on LANG-693:
------------------------------------
Can you provide more data? If I run the following test it looks to happily be returning Doubles (and already had a test for BigDecimal):
// LANG-693
assertEquals("createNumber(String) LANG-693 failed", Double.MAX_VALUE, NumberUtils
.createNumber("" + Double.MAX_VALUE));
System.err.println( NumberUtils.createNumber(""+Double.MAX_VALUE));
System.err.println( NumberUtils.createNumber(""+Double.MAX_VALUE).getClass()); // prints java.lang.Double
> Method createNumber from NumberUtils doesn't work for floating point numbers other than Float
> ---------------------------------------------------------------------------------------------
>
> Key: LANG-693
> URL: https://issues.apache.org/jira/browse/LANG-693
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.math.*
> Affects Versions: 2.6
> Reporter: Carlos Rego
> Priority: Minor
>
> Method createNumber from NumberUtils is trying to parse a string with a floating point number always first as a Float, that will cause that if we send a string with a number that will need a Double or even a BigDecimal the number will be truncate to accommodate into the Float without an exception to be thrown, so in fact we will no be returning ever neither a Double nor a BigDecimal.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira