You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Yang ZHONG (JIRA)" <tu...@ws.apache.org> on 2006/10/13 02:36:35 UTC

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

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


    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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


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

Posted by "Kelvin Goodson (JIRA)" <tu...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/TUSCANY-836?page=all ]

Kelvin Goodson resolved TUSCANY-836.
------------------------------------

    Fix Version/s: Java-Mx
       Resolution: Fixed

applied fix and test

> 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
>             Fix For: Java-Mx
>
>         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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


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

Posted by "Yang ZHONG (JIRA)" <tu...@ws.apache.org>.
     [ 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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


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

Posted by "Kelvin Goodson (JIRA)" <tu...@ws.apache.org>.
     [ 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: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org