[
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