Types
Ion is statically typed. Every expression has a type. Types constrain the values an expression can hold, and determine the semantics of operations on those values.
Basic data types are called atoms. User defined types are aggregates of basic types.
The following tables show the keywords for built-in Ion types.
Integer Types
Type |
Size, bytes |
Range |
Int8 |
1 |
-128 to 127 |
Int16 |
2 |
-32,768 to 32,767 |
Int32 |
4 |
-2,147,483,648 to 2,147,483,647 |
Int64 |
8 |
-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
Int128 |
16 |
-2127 to 2127-1 |
UInt8 |
1 |
0 to 255 |
UInt16 |
2 |
0 to 65,535 |
UInt32 |
4 |
0 to 4,294,967,295 |
UInt64 |
8 |
0 to 18,446,744,073,709,551,615 |
UInt128 |
16 |
0 to 2128-1 |
Floating-point Types
Type |
Size, bytes |
Range |
Precision, digits |
Float32 |
4 |
±1.5×10−45 to ±3.4×1038 |
~6-9 |
Float64 |
8 |
±5.0×10−324 to ±1.7×10308 |
~15-17 |
Float80 |
10 |
±3.65×10−4951 to ±1.18×104932 |
~18-21 |
Float128 |
16 |
±1.0×10-28 to ±7.9228×1028 |
~18-29 |
Character Types
Type |
Size, bytes |
Range |
Char8 |
1 |
U+00 to U+FF |
Char16 |
2 |
U+0000 to U+FFFF |
Char32 |
4 |
U+00000000 to U+FFFFFFFF |
Boolean Types
Type |
Size, bytes |
Range |
Bool8 |
1 |
false , true |
Bool16 |
2 |
false , true |
Bool32 |
4 |
false , true |
Data Type Aliases
Alias |
Type |
Description |
Int |
Int32 or Int64 |
Max possible signed integer, platform dependent x86, x64 |
UInt |
UInt32 or UInt64 |
Max possible unsigned integer, platform dependent x86, x64 |
Bool |
Bool8 |
Default 8-bit boolean |
Char |
Char8 |
Default 8-bit character |
Float |
Float32 |
32-bit floating-point |
Double |
Float64 |
64-bit floating-point |