Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 64903135C for ; Tue, 26 Apr 2011 10:18:44 +0000 (UTC) Received: (qmail 69550 invoked by uid 500); 26 Apr 2011 10:18:44 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 69475 invoked by uid 500); 26 Apr 2011 10:18:44 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 69467 invoked by uid 99); 26 Apr 2011 10:18:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Apr 2011 10:18:44 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Apr 2011 10:18:41 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 22420B4C54 for ; Tue, 26 Apr 2011 10:18:03 +0000 (UTC) Date: Tue, 26 Apr 2011 10:18:03 +0000 (UTC) From: "Sebb (JIRA)" To: issues@commons.apache.org Message-ID: <1776213633.2006.1303813083137.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1116249105.54618.1302685507354.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (LANG-693) Method createNumber from NumberUtils doesn't work for floating point numbers other than Float MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/LANG-693?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13025161#comment-13025161 ] Sebb commented on LANG-693: --------------------------- I can confirm that "0.9090909090909091" is returned as a float 0.90909094. Whether this is wrong is a different matter. The Javadoc says: {quote} Turns a string value into a java.lang.Number. First, the value is examined for a type qualifier on the end ('f','F','d','D','l','L'). If it is found, it starts trying to create successively larger types from the type specified until one is found that can represent the value. If a type specifier is not found, it will check for a decimal point and then try successively larger types from Integer to BigInteger and from Float to BigDecimal. {quote} > 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