How do I convert a Float64 number to Int64?

If the number doesn’t have an integer value (like 6.0), you must round. Then you must decide what sort of rounding you want:

round(Int, x)  # closest int
floor(Int, x)  # downwards 
ceil(Int, x) # upwards

There are some more variations, like trunc.

5 Likes