Julia provides typemin(type),
typemax(type) function to get min and max values for given type.
julia> print(typemin(Int8)) -128 julia> print(typemin(Int16)) -32768 julia> print(typemin(Int32)) -2147483648 julia> print(typemin(Int64)) -9223372036854775808 julia> print(typemin(Int128)) -170141183460469231731687303715884105728 julia> julia> print(typemin(UInt8)) 0 julia> print(typemin(UInt16)) 0 julia> print(typemin(UInt32)) 0 julia> print(typemin(UInt64)) 0 julia> print(typemin(UInt128)) 0 julia> julia> print(typemax(Int8)) 127 julia> print(typemax(Int16)) 32767 julia> print(typemax(Int32)) 2147483647 julia> print(typemax(Int64)) 9223372036854775807 julia> print(typemax(Int128)) 170141183460469231731687303715884105727 julia> julia> print(typemax(UInt8)) 255 julia> print(typemax(UInt16)) 65535 julia> print(typemax(UInt32)) 4294967295 julia> print(typemax(UInt64)) 18446744073709551615 julia> print(typemax(UInt128)) 340282366920938463463374607431768211455
Integer
overflow
Numbers in Julia are wrap around upon reaching maximum (or) minimum value.
Numbers in Julia are wrap around upon reaching maximum (or) minimum value.
julia> max=typemax(Int64) 9223372036854775807 julia> max+1 -9223372036854775808 julia> max+2 -9223372036854775807 julia> julia> min=typemin(Int64) -9223372036854775808 julia> min-1 9223372036854775807 julia> min-2 9223372036854775806
Reference
No comments:
Post a Comment