[1655] in java-interest
Floating point inaccuracies?
daemon@ATHENA.MIT.EDU (Nicholas Geh)
Wed Sep 13 12:52:27 1995
Date: Wed, 13 Sep 1995 19:00:05 +0900 (SDT)
From: Nicholas Geh <nik@mailhub.ncb.gov.sg>
To: java-interest@java.sun.com
In-Reply-To: <199509130520.WAA00408@usr2.primenet.com>
Hello Java programmers,
I don't usually program in floating point arithmetic, nor do I
particularly enjoy it, but I have a question that may well be an inherent
problem in other programming languages:
Why does (int)(19.8 * 100) produce 1979? Test it out on your java compilers!
As a point of interest, 19.8*100 produces 1980 as expected.
Is there any typecasting that I missed out?
Thanks
Nik
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com