Skip to content

Number Suffixes

Narta Xaymar Dirks edited this page Nov 2, 2026 · 1 revision

Number suffixes

A plain number is an Int (5) or a Float (5.0), as in the originals. BlitzLLVM can pick the type of a number by writing a suffix directly behind it, with no space. The suffix is not case sensitive.

Suffix Type Suffix Type
i8 Byte .h, .fp16 Half
ui8 UByte .f, .fp32 Float
i16 Short .d, .fp64 Double
ui16 UShort u UInt, or ULong if it needs more than 32 bits
i32 Int
ui32 UInt
i64 Long
ui64 ULong
Local big:Long = 5000000000i64
Local mask:UByte = 255ui8
Local tiny:Byte = -128i8
Local half:Half = 0.5h
Local exact:Double = 0.1.d
Print big
Print mask
Print tiny
Print half
Print exact

Rules

  • The whole number suffixes (i8 to ui64, u) go on whole numbers: decimal, 0x and 0b. The real suffixes (.h, .f, .d, .fp16, .fp32, .fp64) go on every number when they start with a dot: 3.d, 2.5.h, 0b101.f (5.0) and 0xFF.f (255.0). The dot is what keeps them apart from the digits of a 0x number: 0xFFf is just the number 4095. A number that already has a decimal point may leave the dot out: 2.5h, 0.1d and 1.5fp16 are the same as 2.5.h, 0.1.d and 1.5.fp16, while 5h is an error. $FF and %101 take no suffix.
  • The suffix has to end the number: 1foo is still the number 1 followed by a name, as before.
  • A whole number without a suffix should fit into an Int. If it does not (5000000000), it is clamped to the largest Int like in the original, and the compiler warns about it (literal-out-of-range), so a program that expects the real number is not surprised. Write i64 or ui64 (or ui32) behind it to keep the number. A 0x or 0b number of up to 32 bits is an Int with the same bits as $FFFFFFFF, so 0xFFFFFFFF is -1.
  • A number with a suffix has to fit into its type, or it is an error: 300i8 and 70000.h do not compile. A 0x or 0b number is a bit pattern of the type and may use all of its bits, so 0xFFi8 is -1, 0xFFui8 is 255, and 0b11111111i8 is -1.
  • A minus in front of a decimal number with a suffix belongs to the number, so -128i8 is fine. Unsigned types can not be negative.
  • The existing u suffix is unchanged: 5u is a UInt and 5000000000u a ULong.
  • -2147483648 without a suffix is -2147483647 (with the same warning), as in the original, which clamps 2147483648 to the largest Int before it negates it. Write -2147483647 - 1 or -2147483648i32 for the smallest Int.

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally