• Post Reply Bookmark Topic Watch Topic
  • New Topic

Decimal Subtraction  RSS feed

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to subtract decimal numbers but I'm not getting the desired results. For instance when I subtract 12 from 12.92 I should get 0.92 instead I the answer is 0.9199999999999999999.
What can I do to get 0.92? If I round it off I'll get 1 which is not the answer i want.
Your help will be highly appreciated.
 
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at #20 in the http://faq.javaranch.com/java/JavaBeginnersFaq
 
Hlumela Bongobi
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much, I checked it out.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!