Return-Path: Delivered-To: apmail-db-jdo-dev-archive@www.apache.org Received: (qmail 71718 invoked from network); 12 Dec 2005 00:24:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 12 Dec 2005 00:24:15 -0000 Received: (qmail 96694 invoked by uid 500); 12 Dec 2005 00:24:13 -0000 Mailing-List: contact jdo-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jdo-dev@db.apache.org Delivered-To: mailing list jdo-dev@db.apache.org Received: (qmail 96666 invoked by uid 99); 12 Dec 2005 00:24:13 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 11 Dec 2005 16:24:10 -0800 Received: from ajax.apache.org (ajax.apache.org [127.0.0.1]) by ajax.apache.org (Postfix) with ESMTP id 4D906597 for ; Sun, 11 Dec 2005 23:19:09 +0100 (CET) Message-ID: <4637964.1134339549315.JavaMail.jira@ajax.apache.org> Date: Sun, 11 Dec 2005 23:19:09 +0100 (CET) From: "Erik Bengtson (JIRA)" To: jdo-dev@db.apache.org Subject: [jira] Commented: (JDO-206) JDOQL test NotEquals comparing floating point numbers In-Reply-To: <1929739821.1131170480040.JavaMail.jira@ajax.apache.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/JDO-206?page=comments#action_12360162 ] Erik Bengtson commented on JDO-206: ----------------------------------- I extended the test, and when the JVM converts (float)-234.23 it results in -234.22999572753906. Is that a JVM bug? import org.apache.derby.iapi.error.StandardException; import org.apache.derby.iapi.types.NumberDataType; public class FloatTest { /** * @param args */ public static void main(String[] args) { try { System.out.println(NumberDataType.normalizeDOUBLE((float)-234.23)); //prints -234.22999572753906 float f =(float)-234.23; System.out.println(f); //prints -234.23 System.out.println((double)f); //prints -234.22999572753906 } catch (StandardException e) { e.printStackTrace(); } } } > JDOQL test NotEquals comparing floating point numbers > ----------------------------------------------------- > > Key: JDO-206 > URL: http://issues.apache.org/jira/browse/JDO-206 > Project: JDO > Type: Bug > Components: tck20 > Reporter: Andy Jefferson > Assignee: Erik Bengtson > > The current TCK test (carried over from JDO 1.0) for NotEquals, uses != operator on floating point numbers. This is not a good practice, and is unreliable. Its probably the case that the Equals test uses == on the same content, which also is not a good idea (as noted in the latest spec). These tests need reviewing and a reliable alternate strategy adopting -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira