Primitive Types

Every primitive type in Rux, by family — 38 of them, every one implemented by rux 0.4.0. The names are predefined type names, not keywords.

TypeFamilyBitsBytesHoldsLiteral
int8Signed integer81−128 to 127i8
int16Signed integer162−32,768 to 32,767i16
int32Signed integer324−231 to 231 − 1i32
int64Signed integer648−263 to 263 − 1i64
int128Signed integer12816−2127 to 2127 − 1i128
int256Signed integer25632−2255 to 2255 − 1i256
int512Signed integer51264−2511 to 2511 − 1i512
intSigned integer648Pointer-sized; as int64 on every supported targeti, or none
uint8Unsigned integer810 to 255u8
uint16Unsigned integer1620 to 65,535u16
uint32Unsigned integer3240 to 232 − 1u32
uint64Unsigned integer6480 to 264 − 1u64
uint128Unsigned integer128160 to 2128 − 1u128
uint256Unsigned integer256320 to 2256 − 1u256
uint512Unsigned integer512640 to 2512 − 1u512
uintUnsigned integer648Pointer-sized; as uint64 on every supported targetu
float8Floating-point81E4M3, with infinities and NaNsf8
float16Floating-point162IEEE 754 binary16f16
float32Floating-point324IEEE 754 binary32f32
float64Floating-point648IEEE 754 binary64f64, or none
float80Floating-point8016x87 extended precision, 80 bits in 16 bytesf80
float128Floating-point12816IEEE 754 binary128f128
float256Floating-point25632IEEE 754 binary256f256
float512Floating-point51264binary512: 23-bit exponent, 489 bits of precisionf512
bool8Boolean81false, truetrue, false
bool16Boolean162false, true—
bool32Boolean324false, true—
bool64Boolean648false, true—
bool128Boolean12816false, true—
bool256Boolean25632false, true—
bool512Boolean51264false, true—
char8Character81A UTF-8 code unit, 0 to 255c8'…'
char16Character162A UTF-16 code unit, 0 to 65,535c16'…'
char32Character324A Unicode scalar valuec32'…', or none
char64Character648A Unicode scalar valuec64'…'
char128Character12816A Unicode scalar valuec128'…'
char256Character25632A Unicode scalar valuec256'…'
char512Character51264A Unicode scalar valuec512'…'

Built-in aliases

AliasSame type as
boolbool8
byteuint8
charchar32
floatfloat64

An alias is another name for its target, not a separate type; see Type Aliases.

Defaults

  • An unsuffixed integer literal is an int, unless its context requires another integer type.
  • An unsuffixed floating-point literal is a float64.
  • An unprefixed character literal is a char32, unless it initialises a char8 or char16.
  • An unprefixed string literal is a char8[..].

Associated constants

Each primitive is extended with constants in Core, available once that extension is imported, as in import Core::int32;. The types themselves are built in and need no import:

FamilyConstants
IntegersBits, Bytes, Min, Max
Floating-pointBits, Bytes, Lowest, Max, MinPositive, Epsilon, Infinity, NaN
BooleansBits, Bytes
CharactersBits, Bytes, Min, Max

See also