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


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to