Signed Integers
Signed Integers represent a number which is divisible by one and could be negative.
You can tell a Datatype represents a signed integer if its name has the i
prefix.
The number afterward tells you how many bits the Datatype uses to represent values
sent over the network.
Size Index
Name | Size | Maximum Int | Minimum Int |
---|---|---|---|
i8 |
1 byte |
(2^7)-1 (127) |
-(2^7) (-128) |
i16 |
2 bytes |
(2^15)-1 (32,767) |
-(2^15) (-32,768) |
i24 |
3 bytes |
(2^23)-1 (8,388,607) |
-(2^23) (-8,388,608) |
i32 |
4 bytes |
(2^31)-1 (2,147,483,647) |
-(2^31) (-2,147,483,648) |
i40 |
5 bytes |
(2^39)-1 (549,755,813,887) |
-(2^39) (-549,755,813,888) |
i48 |
6 bytes |
(2^47)-1 (140,737,488,355,327) |
-(2^47) (-140,737,488,355,328) |
i53 |
7 bytes |
(2^53)-1 (9,007,199,254,740,991) |
-(2^53) (-9,007,199,254,740,992) |
You can access each one with light.datatypes.<Name>
.
The set of possible values is defined as -2 ^ (bits - 1)
to 2 ^ (bits - 1) - 1
.