June 2019
Intermediate to advanced
218 pages
5h 19m
English
Not only does Julia use machine representation to store integers and floats, it also uses machine arithmetic for all basic mathematical operations. In particular, the operations on integer types do not perform overflow checks. Let's discuss what this means in practice.
With a fixed number of bytes available to represent integers of a particular type, the possible values are bounded. These bounds can be viewed using the typemax and typemin functions:
julia> typemax(Int64)9223372036854775807julia> bitstring(typemax(Int32))"0111111111111111111111111111111111111111111111111111111111111111"julia> typemin(Int64)-9223372036854775808julia> bitstring(typemin(Int32))"1000000000000000000000000000000000000000000000000000000000000000" ...
Read now
Unlock full access