>>>>> hilbrink writes:
>> This most likely has nothing to do with the Java
>> implementation, but of the floating point characteristics of
>> the underlying machine. If you set a double (in C) to 0.3,
>> it's value is not necessarily 0.3 but something very very
>> close:
hilbrink> well yes that is what I would expect, only number ^2
hilbrink> could be represented properly, but what I think happens
hilbrink> is that the 'new' double is not properly initialized, ie
hilbrink> all bytes are not set to '0'. Apparently the exponent
hilbrink> part is transferred correctly, but the mantissa part is
hilbrink> not, hence the error in the mantissa.
No. You already lose precision when you store 0.3 in a float. There
is no way to get higher precision by converting this value to a
double.
0.3f:
0 01111101 00110011001100110011010
(double) 0.3f:
0 01111111101 0011001100110011001101000000000000000000000000000000
0.3d:
0 01111111101 0011001100110011001100110011001100110011001100110011
hilbrink> But what I would like to know is if other people
hilbrink> experience the same, how does a JVM under windows
hilbrink> behave.
The result will be the same.
Juergen
--
Juergen Kreileder, Blackdown Java-Linux Porting Team
http://www.blackdown.org/java-linux.html
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]