Steve,

On a slight aside, this problem may not be so bad for you.  Digital
representation of any floating point number is really an approximation.
But, our convention for writing floating point numbers (not on a computer)
actually allows for two representations for any non-zero number that
"terminates". (The term "terminates" is somewhat misleading, since
technically it doesn't really terminate.  It has an infinite sequence of 0's
after some finite number of digits other than zero).

The proof of this is:

let x = 0.9999999999...
=> 10x = 9.999999999...
=> 10x - x = 9.999999999... - 0.9999999999...
=> 9x = 9
=> x = 1

therefore 1.0000000... = 0.999999999...

This may not be of much help to you, but I always thought it was
interesting.  I'm not saying you don't have a problem, only that it may not
be as bad as you though.


-Andy


> -----Original Message-----
> From: Steve Curry [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 03, 1998 10:52 AM
> To: [EMAIL PROTECTED]
> Subject: Java 1.1.6 can't add!
>
>
> I have installed JDK 1.1.6 on my RedHat 5.0 Linux box and when performing
> mathmatical calculations in java I get incorrect results. Take for example
> (float)14.39 I can do a basic System.out.println and it will print out on
> the command line: 14.3899999999999. What is wrong with my JDK 1.1.6? I am
> new to Java so hopefully I'm just missing something small here.
>
>
> Steve
>
>

Reply via email to