• Post Reply Bookmark Topic Watch Topic
  • New Topic

cut off decimals of a float number  RSS feed

 
Graziani Gabriele
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've to print a float number.
i've a float like 0.02999, how can i cut off the decimals to round it to 0.03 ?
Thanks.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the DecimalFormat class:
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!