jQuery in Action, 3rd edition
The moose likes Cattle Drive and the fly likes float arithmetic Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "float arithmetic" Watch "float arithmetic" New topic

float arithmetic

Manisha Abhyankar

Joined: Jan 13, 2001
Posts: 1
I am trying to do float arithmetic for dollar amounts. The sum is not precise to the two decimal places of cents. It gets rounded up and the final total is different from the actual total by a few cents or a couple of dollars! Has anyone used float for accumulating totals precise to the two decimal places?
paul wheaton

Joined: Dec 14, 1998
Posts: 20919

Which assignment is this for?

permaculture Wood Burning Stoves 2.0 - 4-DVD set
I agree. Here's the link: http://aspose.com/file-tools
subject: float arithmetic
jQuery in Action, 3rd edition