Numeric types

ezc has 16 numeric types organized into three families. The default, unsuffixed integer type is arbitrary-precision — no silent overflow.

The default: int

A bare integer literal is int — backed by BigInt:

2 100 ^      # → 2¹⁰⁰  (a 31-digit number, exact)

Try the same with a fixed-width type and you'll see overflow:

2u64 100u64 ^   # error: overflow

Three families

FamilyTypes
Integerint (BigInt — default)
Unsignedu8, u16, u32, u64, u128, u256
Signedi8, i16, i32, i64, i128, i256
Floatf16, f32, f64

Typed literals

Suffix a literal with a type name:

42u8       # u8
42i64      # i64
3.14f32    # f32
0xFFu16    # hex literal as u16

Type constructors

Type names are also conversion functions. 42 f32 means "push 42, then convert it to f32":

42 f32      # → 42.0f32
3.7 int     # → 3      (truncates float)
42 str      # → "42"   (number to decimal string)

Arithmetic promotion

Operations within the same family promote to the wider type:

3u8 4u32 +     # → 7u32  (u8 promoted to u32, both unsigned)
1i16 2i64 +    # → 3i64  (i16 promoted to i64, both signed)
1.0f32 2.0f64 +  # → 3.0f64  (f32 promoted to f64, both float)

Cross-family arithmetic is an error — int, unsigned, signed, and float are separate families. You must convert explicitly:

3 4u32 +       # error: int and u32 are different families
3 u32 4u32 +   # → 7u32  (convert 3 to u32 first)
3 4.0 +        # error: int and f64
3 f64 4.0 +    # → 7.0f64

typeof

42 typeof          # → "int"
42u8 typeof        # → "u8"
3.14 typeof        # → "f64"
"hello" typeof     # → "str"
[1 2] typeof       # → "list"
(+) typeof         # → "block"

What's next