An unsigned integer stores nonnegative whole numbers within a fixed bit width. Julia names these types by prefixing the width with U: UInt8, UInt16, UInt32, UInt64, and UInt128. section 2.3
Use unsigned integers with awareness of their representation and limits:
- Check a type's limits with typemin and typemax when the available range matters. section 2.3
- Construct a specific width explicitly, such as UInt8(13); an out-of-range conversion such as UInt8(256) raises an InexactError. section 2.3
- Expect unsigned values to display in hexadecimal: the 8-bit value 13 appears as 0x0d, while binary, octal, hexadecimal, and decimal forms can represent the same value. section 2.3.1
- Prefer signed integers for ordinary work; choose unsigned integers when the problem or performance requirements make their nonnegative fixed-width representation useful. section 2.6
julia> y = Int8(42) 42 julia> typeof(y) Int8 julia> typeof(Int16(4)) Int16 julia> UInt8(256) ERROR: InexactError: trunc(UInt8, 256)
Compare explicit integer construction with a failed conversion beyond UInt8's capacity. section 2.3
julia> Int(0b1101) 13 julia> Int(0x0d) 13 julia> UInt8(13) 0x0d
See decimal, binary, and hexadecimal spellings resolve to the same stored value. section 2.3.1








