commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From José Pinto (JIRA) <j...@apache.org>
Subject [jira] Created: (IO-101) The method EndianUtils.writeSwappedDouble() and EndianUtils.readSwappedDouble() do not match!
Date Mon, 04 Dec 2006 20:49:22 GMT
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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message