Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What am i doing wrong ???

 
anuj sahai
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am facing a problem. Please let me know why this is happening and what is the solution to
I enter a value which is 9.99999999999999E14. This is equivalent to 999999999999999(15 9's). When i multiply this amount by 100 the value is changed to 9.9999999999999904E16. The value which i wanted to obtain after the multiplication was 99999999999999900 however it became 99999999999999904 probably cos the precision was lost.
Throughout the value is being assigned to a double
Please let me know how i can workaround this problem ?
 
Wilfried LAURENT
Ranch Hand
Posts: 269
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at
java.math.BigDecimal and java.math.BigInteger.
W.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic