• Post Reply Bookmark Topic Watch Topic
  • New Topic

data types

 
Thimal Deemantha
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



Why the output is 3.2300000190734863
except 3.23
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 15713
73
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because the float and double data types are not infinitely precise; you can get rounding errors when you start doing calculations with them.
 
Thimal Deemantha
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jesper de Jong wrote:Because the float and double data types are not infinitely precise; you can get rounding errors when you start doing calculations with them.


THANK YOU
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!