Julia Int function

Are there any major changes for the Int function?

This below script worked in previous versions. Now I’m getting lots of errors for the latest version of Julia:
Cruise = Int.(TT[:,1]),

I’m currently on Version 1.7.2

What errors? Int only works if the numbers can be actually converted to Integers without loss of precision:

julia> Int(1.0)
1

julia> Int(1.1)
ERROR: InexactError: Int64(1.1)
Stacktrace:
 [1] Int64(x::Float64)
   @ Base ./float.jl:788
 [2] top-level scope
   @ REPL[62]:1

Maybe you want round instead:

julia> round(Int, 1.1)
1

I don’t think anything changed here.

3 Likes

Many thanks! The round function works much better.