Skip to main content
gamedev.net
🔒 Locked

[java] trunc-round in java

Started by nerak Mar 12, 2003 at 6:17 PM 0 replies 550+ views
Original Post
nerak
nerak
Is there a trunc function in java? Is there a round function in java?
Kentaro
Kentaro
The round function is a static method of the Math class. If you want to round to an int by truncating the decimals, just cast the float/double to an int. Also, floor and ceiling exist.

This isn''''t life in the fast lane, it''''s life in the oncoming traffic.
-- Terry Pratchett
Over the centuries, mankind has tried many ways of combating the forces of evil...prayer,fasting, good works and so on. Up until Doom, no one seemed to have thought about thedouble-barrel shotgun. Eat leaden death, demon... -- Terry Pratchett

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.