Re: c vs java floating point errors under windows XP
From: ak (ak_at_workmail
Date: 06/12/04
- Next message: Edward G. Nilges: "Re: Aspiring highest-order programmer"
- Previous message: Bill Godfrey: "Re: OT - Software engineering guild?"
- In reply to: valis: "c vs java floating point errors under windows XP"
- Next in thread: Jack Klein: "Re: c vs java floating point errors under windows XP"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 12 Jun 2004 08:07:55 +0800
On 11 Jun 2004 11:50:27 -0700, howe.charles@mayo.edu (valis) wrote:
>>I have an application that requires between 10^12 and 10^15 iterations
>>of a floating point calculation. The precision of the numbers must be
>>at least 20 digits for the math to work out. I have written an
>>algorithm in java and in C to accomplish this calculation. Under
>>Linux, both algorithms appear to work fine, and the accumulated error
>>does not impact on the outcome. However, in Windows, the java
>>algorithm seems to run fine but the C calculation (compiled with gcc
>>under MinGW) suffers from extreme error that renders the calculation
>>completely useless. Can anyone explain to me what the difference might
>>be between the java code (compiled under jdk1.3.1_03) and the C code
>>in terms of the floating point calculations? Also, what is the
>>difference between running the calculation on Linux vs WinXP? The
>>reason I cannot simply use the java algorithm is that the large number
>>of iterations takes several days in java, but only several hours in C.
>>
>>Thanx.
I believe the implementation of the floating point data type is OS dependent
e.g. little endian/big endian between HP Unix and Windows. In windows you
would get a max precision of 15-16 digits using double.
Java has a higher precision on their floats(IEEE 754) and is OS independent so
that is why they run (slow) on both machines.
/ak
- Next message: Edward G. Nilges: "Re: Aspiring highest-order programmer"
- Previous message: Bill Godfrey: "Re: OT - Software engineering guild?"
- In reply to: valis: "c vs java floating point errors under windows XP"
- Next in thread: Jack Klein: "Re: c vs java floating point errors under windows XP"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|