An integer is a whole number: positive, negative, or zero, with no fractional part. In Julia, integers are useful for calculator-style arithmetic, but their types also determine which values can be stored. section 2.0 section 2.3
Choose a type only when its range matters:
- Signed types include Int8, Int16, Int32, Int64, and Int128; unsigned versions start with U, such as UInt8. The suffix gives the bit length. section 2.3
- Use typemin and typemax to check limits. Int8 runs from -128 to 127, and typeof(1) returns Int64. section 2.3
- A constructor such as Int8(42) creates a specified type; converting a value outside its range, such as UInt8(256), raises an error. section 2.3
Keep the quotient and remainder
In the Julia REPL, 5/2 gives 2.5, while div(5, 2) gives the integer quotient 2 and rem(5, 2) gives the remainder 1. You can also write the remainder as 5%2. section 2.4.1
Arithmetic does not automatically widen an Int8 result when it overflows. Start with default integer sizes and prefer signed integers unless your problem or performance needs call for another type. For values beyond Int128, BigInt offers arbitrary size at a memory and performance cost. section 2.3 section 2.6
A whole-number result is not always an integer-typed result: floor(3.6) gives 3.0. Use round(Int64, 3.5) to obtain an integer-typed 4. The same value can also be written in different formats: Int(0b1101) and Int(0x0d) both give 13. section 2.5.4 section 2.3.1














