Image bm251.GIF Arithmetic Operations
Calculations
 
Image bm275.GIF add
Image bm276.GIF subtract
Image bm277.GIF multiply
Image bm278.GIF divide
Image bm279.GIF modulo
Image bm280.GIF power
 
The arithmetic operations provide the possibility to calculate numeric terms. As operator parameters one or several numeric terms can be given. Operations with operands are carried out gradually from above downwards, the result of a calculation carried out with two operands being used as the first operand for the next calculation. Entering one operand only has a special significance. For one operand only, the difference operator will return the operand's negative value, the quotient operator will return the operand's reciprocal.
 
The modulo operator calculates the rest after dividing the first (positive) operand by the other one. As an example, the term 8 mod 3 will return the value of 2 as the calculation result (= 8 - 3 - 3). For negative numbers supplement of the operand will be used; the term -8 mod 3 will return 1 (= 3 - (8 mod 3) = -8 + 3 + 3 + 3). This operation proves as cutting the number into the interval 0 to second_operand and can be used as e.g. an angle normalization.

Full Html Context Help of The Peter - Gemtree Software & Children Programming