Jump to content
  • 0

How to convert a float to an int?


RobotMonkeyHead

Question

4 answers to this question

Recommended Posts

  • 1

floor() or ceil(). Unfortunately, there is no "round" or I'd easily suggest that. floor() will drop all digits past the decimal point and ceil() will round up and return the least possible Int.

Think of floor() as rounding down and ceil() as rounding up. I think that's the easiest way to explain it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...