[DLSLUG-Discuss] Java fluke, double precision pitfall
Roger
e-mail addresses are not shown in archives
Thu Dec 29 04:00:27 EST 2005
Hello everyone,
Yes, I'm still a Java nut, but...
While I was getting beaten in a TopCoder contest, I discovered this fluke.
I reduced the "fluke" to a few lines of code as possible.
When I ran the enclosed program, I got the following output.
1.2 minus 1.0 = 0.19999999999999996
I'm able to find ways around this by type casting and using the BigDecimal object. I just thought
I would share this random tid bit with you guys.
-Roger
__________________________________________
Yahoo! DSL Something to write home about.
Just $16.99/mo. or less.
dsl.yahoo.com
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: BadDoubleMath.java
Url: http://dlslug.org/pipermail/dlslug-discuss/attachments/20051229/67a4c21a/attachment.pl
More information about the DLSLUG-Discuss
mailing list