Arithmetic Types
The arithmetic type specifiers are built up from the following keywords: void
, char
, int
, float
and double
,
together with the prefixes short
, long
, signed
and unsigned
.
From these keywords you can build both integral and floating-point types.
Due to the code compatibility with other compilers, the size of some integral types and floating point types is user selectable via Edit Project window. Please see the tables below for the corresponding arithmetic types size.
Integral Types
The types char
and int
, together with their variants, are considered to be integral data types. Variants are created by using one of the prefix modifiers short
, long
, signed
and unsigned
.
In the table below is an overview of the integral types – keywords in parentheses can be (and often are) omitted.
The modifiers signed
and unsigned
can be applied to both char
and int
. In the absence of the unsigned
prefix, signed
is automatically assumed for integral types. The only exception is char
, which is unsigned
by default. The keywords signed
and unsigned
, when used on their own, mean signed int
and unsigned int
, respectively.
The modifiers short
and long
can only be applied to int
.
The keywords short
and long
, used on their own, mean short int
and long int
, respectively.
An overview of the integral types is shown in the table below:
mE Integral Type Sizes
Type | Size in bytes | Range |
---|---|---|
bit | 1–bit | 0 or 1 |
sbit | 1–bit | 0 or 1 |
(unsigned) char | 1 | 0 .. 255 |
signed char | 1 | - 128 .. 127 |
(signed) short (int) | 1 | - 128 .. 127 |
unsigned short (int) | 1 | 0 .. 255 |
(signed) int | 2 | -32768 .. 32767 |
unsigned (int) | 2 | 0 .. 65535 |
(signed) long (int) | 4 | -2147483648 .. 2147483647 |
unsigned long (int) | 4 | 0 .. 4294967295 |
(signed) long long | 8 | -9223372036854775808 .. 9223372036854775807 |
unsigned long long | 8 | 0 .. 18446744073709551615 |
non-mE Integral Type Sizes
Type | Size in bytes | Range |
---|---|---|
bit | 1–bit | 0 or 1 |
sbit | 1–bit | 0 or 1 |
(unsigned) char | 1 | 0 .. 255 |
signed char | 1 | - 128 .. 127 |
(signed) short (int) | 2 | -32768 .. 32767 |
unsigned short (int) | 2 | 0 .. 65535 |
(signed) int | 4 | -2147483648 .. 2147483647 |
unsigned (int) | 4 | 0 .. 4294967295 |
(signed) long (int) | 4 | -2147483648 .. 2147483647 |
unsigned long (int) | 4 | 0 .. 4294967295 |
(signed) long long | 8 | -9223372036854775808 .. 9223372036854775807 |
unsigned long long | 8 | 0 .. 18446744073709551615 |
Floating-point Types
The types float
and double
, together with the long double
variant, are considered to be floating-point types. Floating point in the mikroC PRO for ARM is implemented using the 32-bit IEEE 754 format type.
An overview of the floating-point types is shown in the table below:
mE Floating-point Types
Type | Size in bytes | Range |
---|---|---|
float | 4 | -1.5 * 1045 .. +3.4 * 1038 |
double | 4 | -1.5 * 1045 .. +3.4 * 1038 |
long double | 8 | ±2.2250 * 10-308 .. ±1.7976 * 10308 |
non-mE Floating-point Types
Type | Size in bytes | Range |
---|---|---|
float | 4 | -1.5 * 1045 .. +3.4 * 1038 |
double | 8 | ±2.2250 * 10-308 .. ±1.7976 * 10308 |
long double | 8 | ±2.2250 * 10-308 .. ±1.7976 * 10308 |
What do you think about this topic ? Send us feedback!