You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Henri Yandell (JIRA)" <ji...@apache.org> on 2006/12/06 01:27:24 UTC

[jira] Resolved: (IO-101) The method EndianUtils.writeSwappedDouble() and EndianUtils.readSwappedDouble() do not match!

     [ http://issues.apache.org/jira/browse/IO-101?page=all ]

Henri Yandell resolved IO-101.
------------------------------

    Resolution: Fixed

svn ci -m "Committing my patch from #IO-101, fixing an <int> overrun in readSwappedLong. Many thanks to José Pinto for finding this" src/

Sending        src/java/org/apache/commons/io/EndianUtils.java
Sending        src/test/org/apache/commons/io/EndianUtilsTest.java
Transmitting file data ..
Committed revision 482841.

----

It'll be available in the nightly build tonight José, and in IO 1.3 which should get released sometime this month (IO-99 willing).

> The method EndianUtils.writeSwappedDouble() and EndianUtils.readSwappedDouble() do not match!
> ---------------------------------------------------------------------------------------------
>
>                 Key: IO-101
>                 URL: http://issues.apache.org/jira/browse/IO-101
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Streams/Writers
>    Affects Versions: 1.2
>         Environment: I was running Windows XP SP2 and using Commons IO 1.2, Java 1.5 update 9 when I got this problem.
>            Reporter: José Pinto
>            Priority: Critical
>             Fix For: 1.3
>
>         Attachments: IO-101.patch
>
>
> Code:
> public static void main(String[] args) {
> 		double[] tests = new double[] {34.345, -345.5645, 545.12, 10.043, 7.123456789123};
> 		for (int i = 0; i< tests.length ;i++) {
> 			byte[] buffer = new byte[8];			
> 			EndianUtils.writeSwappedDouble(buffer, 0, tests[i]);
> 			double val = EndianUtils.readSwappedDouble(buffer, 0);
> 			System.out.println(val);	
> 		}
> 		 
> }
> Result:
> 34.344969482421874
> -345.5645
> 545.11951171875
> 10.043
> 7.123456789123
> Note:
> In my opinion the values shouldn't be changed at all.

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