Odd example :-)

hmmm… I assume because min trasforming the int to a float round it up a little and doing that it brings it over the value of typemax… any nice workaround rather than manually remove values ?

julia> Int(typemax(Int64))
9223372036854775807

julia> Int(min(typemax(Int64),Inf))
ERROR: InexactError: Int64(9.223372036854776e18)
Stacktrace:
 [1] Int64(x::Float64)
   @ Base ./float.jl:788
 [2] top-level scope
   @ REPL[29]:1

Got it…

julia> Int(min(maxintfloat(Float64),Inf))
9007199254740992