[jira] Updated: (TUSCANY-836) doubleValue() may be inaccurate for Long

2007-03-01 Thread Kelvin Goodson (JIRA)

 [ 
https://issues.apache.org/jira/browse/TUSCANY-836?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kelvin Goodson updated TUSCANY-836:
---

Fix Version/s: (was: Java-SCA-Mx)
   Java-SDO-M3

 doubleValue() may be inaccurate for Long
 

 Key: TUSCANY-836
 URL: https://issues.apache.org/jira/browse/TUSCANY-836
 Project: Tuscany
  Issue Type: Bug
  Components: Java SDO Implementation
Affects Versions: Java-SCA-Mx
 Environment: Sun JRE 1.5.0_07-b03
Reporter: Yang ZHONG
 Fix For: Java-SDO-M3

 Attachments: Long2BigDecimalTestCase.java


 assertSame(DataObjectUtil.getBigDecimal(new 
 Long(Long.MAX_VALUE)).longValue(), Long.MAX_VALUE);
 complains
 junit.framework.AssertionFailedError: expected 
 same:-9223372036854775808 was not:9223372036854775807
 Potential fix:
 if (value instanceof Long)
 {
   return new BigDecimal(((Long)value).longValue());
 }
 before
 if (value instanceof Number)
 {
   return new BigDecimal(((Number)value).doubleValue());
 }
 Thanks to Marcelo Palladino.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Updated: (TUSCANY-836) doubleValue() may be inaccurate for Long

2006-10-12 Thread Yang ZHONG (JIRA)
 [ http://issues.apache.org/jira/browse/TUSCANY-836?page=all ]

Yang ZHONG updated TUSCANY-836:
---

Attachment: Long2BigDecimalTestCase.java

Could someone commit the new Test Case or its variation please?

 doubleValue() may be inaccurate for Long
 

 Key: TUSCANY-836
 URL: http://issues.apache.org/jira/browse/TUSCANY-836
 Project: Tuscany
  Issue Type: Bug
  Components: Java SDO Implementation
Affects Versions: Java-Mx
 Environment: Sun JRE 1.5.0_07-b03
Reporter: Yang ZHONG
 Attachments: Long2BigDecimalTestCase.java


 assertSame(DataObjectUtil.getBigDecimal(new 
 Long(Long.MAX_VALUE)).longValue(), Long.MAX_VALUE);
 complains
 junit.framework.AssertionFailedError: expected 
 same:-9223372036854775808 was not:9223372036854775807
 Potential fix:
 if (value instanceof Long)
 {
   return new BigDecimal(((Long)value).longValue());
 }
 before
 if (value instanceof Number)
 {
   return new BigDecimal(((Number)value).doubleValue());
 }
 Thanks to Marcelo Palladino.

-- 
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



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]