• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

float arithmetic

 
Manisha Abhyankar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Trailboss
Pie
Posts: 21390
Firefox Browser IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which assignment is this for?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic