• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Rounding Down To 2 Decimal Places

 
Luke Shannon
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello;

I have a double:

1.44565655755

I would like to round it up to:

1.45

Math.round turn it into a long. Is there not a round method somewhere that I can specify home many numbers after the decimal I would like?

ie: Math.round(1.444455676767, 3) return 1.444


Thanks,

Luke
 
Marilyn de Queiroz
Sheriff
Posts: 9066
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the NumberFormat class.
 
Luke Shannon
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic