User manual

mikroBasic PRO for PIC32
MikroElektronika
181
Literals
Literals are tokens representing xed numeric or character values.
The data type of a constant is deduced by the compiler using such clues as numeric value and format used in the
source code.
Long and Unsigned Sufxes
Integral values can be represented in decimal, hexadecimal or binary notation.
In decimal notation, numerals are represented as a sequence of digits (without commas, spaces or dots), with optional
prex + or - operator to indicate the sign. Values default to positive (6258 is equivalent to +6258).
The dollar-sign prex ($) or the prex 0x indicates a hexadecimal numeral (for example, $8F or 0x8F).
The percent-sign prex (%) indicates a binary numeral (for example, %0101).
Here are some examples:
11 ‘ decimal literal
$11 ‘ hex literal, equals decimal 17
0x11 ‘ hex literal, equals decimal 17
%11 ‘ binary literal, equals decimal 3
The allowed range of values is imposed by the largest data type in mikroBasic PRO for PIC32 longword. The
compiler will report an error if the literal exceeds 4294967295 ($FFFFFFFF).
Floating Point Literals
A oating-point value consists of:
- Decimal integer
- Decimal point
- Decimal fraction
- e or E and a signed integer exponent (optional)
You can omit either decimal integer or decimal fraction (but not both).
Negative oating constants are taken as positive constants with the unary operator minus (-) prexed.
mikroBasic PRO for PIC32 limits oating-point constants to the range of ±1.17549435082 * 10
-38
.. ±6.80564774407 * 10
38
.
Here are some examples:
0. ‘ = 0.0
-1.23 ‘ = -1.23
23.45e6 ‘ = 23.45 * 10^6
2e-5 ‘ = 2.0 * 10^-5
3E+10 ‘ = 3.0 * 10^10
.09E34 ‘ = 0.09 * 10^34