This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

jtextfield parse double  RSS feed

 
Tai Yo
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't understand if I divide 99.88/100, I am getting 0.9987999999999999.
But how can I get 0.9988?

 
Tai Yo
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry I have solved my problem.
 
Campbell Ritchie
Marshal
Posts: 55681
162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot get the exact result with floating‑point arithmetic. You can get exact results using the techniques in the two links in this post.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!