Datasheet
Programming PIC Microcontrollers in BASIC - mikroElektronika
Operator Operation Operand types Result type
+ addition byte, short,
integer, words,
longint
byte, short,
integer, words,
longint
- subtraction byte, short,
integer, words,
longint
byte, short,
integer, words,
longint
* multiplication byte, short,
integer, words
integer, words,
long
div division byte, short,
integer, words
byte, short,
integer, words
mod remainder byte, short,
integer, words
byte, short,
integer, words
A div B is the value of A divided by B rounded down to the nearest integer. The
mod operator returns the remainder obtained by dividing its operands. In other words,
X mod Y = X - (X div Y) * Y.
If 0 (zero) is used explicitly as the second operand (i.e. X div 0), compiler will
report an error and will not generate code. But in case of implicit division by zero : X
div Y , where Y is 0 (zero), result will be the maximum value for the appropriate
type (for example, if X and Y are words, the result will be $FFFF).
If number is converted from less complex to more complex data type, upper bytes are
filled with zeros. If number is converted from more complex to less complex data
type, data is simply truncated (upper bytes are lost).
If number is converted from less complex to more complex data type, upper bytes are
filled with ones if sign bit equals 1 (number is negative). Upper bytes are filled with
zeros if sign bit equals 0 (number is positive). If number is converted from more
complex to less complex data type, data is simply truncated (upper bytes are lost).
http://www.mikroelektronika.co.yu/english/product/books/picbasicbook/03.htm (2 sur 6)05/11/2004 02:14:47