[DLSLUG-Discuss] Java fluke, double precision pitfall
e-mail addresses are not shown in archives
Thu Dec 29 04:00:27 EST 2005
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.
Yahoo! DSL Something to write home about.
Just $16.99/mo. or less.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the DLSLUG-Discuss