User`s manual

For signed types :
dim B_ as integer
dim A_ as short
...
A_ = -10
B_ = A_
' B becomes -10
In hex representation, this means that the higher byte is sign extended.
C = expression
Calculated value of the expression will be assigned to the destination. Part of the
information may be lost if the destination cannot properly represent the result of
the expression (i.e. if result can't fit in range of destination data type). Browse
through examples for more details.
For example (this is correct):
C = A + B
C is byte, so its range is 0 .. 255. If (A + B) fits in this range you will get the cor-
rect value in C.
A = 123
B = 90
C = A + B
' C becomes 213
But what happens when A + B exceeds the destination range? Let's assume the
following:
A = 241
B = 128
C = A + B
' C becomes 113, obviously incorrect
See the following figure for closer explanation.
mikroBASIC
- Basic Compiler for Microchip PIC microcontrollers
66
mikroBASIC
MikroElektronika: Development tools - Books - Compilers
making it simple...
page