Skip to main content

Numeric Types

Under Construction

Numbers are the base of math and they are needed in every logical process.
The Abstract language allows the user to choose between a long list of numeric types for the best result, performance and memory management for their application.


Integer Numbers

Not Implemented!

The most simple way of representing numbers is with integers. Integers represents an always complete (non-fractional) value, never allowing any decimal point.

For historical, computational and memory optimal reasons, the computer gives an extensive range of possibilities about numeric integer values.

To declare an integer type in the Abstract Language, use the letter i or u to declare the kind of the integer (signed or unsigned) and a number to declare the size, in bits, that this data will occupy in memory.

Examples of valid integer types are:

i8   # signed 8-bit (1 byte) integer
u16 # unsigned 16-bit integer
i128 # signed 128-bit integer

The following table shows every integer type and its corresponding type in the C programming language:

AliasEquivalent in CSizeRangeImplementation
i8int8_t8-bits / 1 byte-128 to 127Std.Types.SignedInteger8
i16int16_t16-bits / 2 bytes-32,768 to 32,767Std.Types.SignedInteger16
i32int32_t32-bits / 4 bytes-2,147,483,648 to 2,147,483,647Std.Types.SignedInteger32
i64int64_t64-bits / 8 bytes-9.2x10¹⁸ to 9.2x10¹⁸Std.Types.SignedInteger64
i128n/a128-bits / 16 bytes-1.7x10³⁸ to 1.7x10³⁸Std.Types.SignedInteger128
iptrintptr_t(target dependent)(target dependent)(target dependent)
u8 (byte)uint8_t8-bits / 1 byte0 to 255Std.Types.UnsignedInteger8
u16uint16_t16-bits / 2 bytes0 to 65,535Std.Types.UnsignedInteger16
u32uint32_t32-bits / 4 bytes0 to 4,294,967,295Std.Types.UnsignedInteger32
u64uint64_t64-bits / 8 bytes0 to 1.8x10¹⁹Std.Types.UnsignedInteger64
u128n/a128-bits / 16 bytes0 to 3.4x10³⁸Std.Types.UnsignedInteger128
uptruintptr_t(target dependent)(target dependent)(target dependent)

The iptr and uptr types are special general-purpose integers that are defined by the target. It is equivalent to the size of a memory pointer on the specific platform or the biggest native integer that the specified target can process. E.g.: If compiling the project to an x86 architecture based machine, iptr will be equivalent to i32 and on an amd64 architecture, it will be equivalent to i64.


Floating Numbers

Not Implemented!

Floating numbers are somewhat complicated numerical values used to reproduce fractions.

As the table above, the Abstract floating types are listed below, with their corresponding type in the C programming language:

AliasEquivalent in CImplementation
f32 (float)floatStd.Types.SingleFloating
f64 (double)doubleStd.Types.DoubleFloating