1.8) Simple Mathematical Operators
Let's assume that "x" and "y" are floating point numbers equal to 2.0 and 3.0 respectively. Using the following mathematical operators applied to "x" and "y":
Operator | Description | Example |
+ | Addition | IDL> print, x + 7IDL prints 5.00000 |
- | Subtraction | IDL> print, x - yIDL prints -1.00000 |
* | Multiplication | IDL> print, x * yIDL prints 6.00000 |
/ | Division | IDL> print, x / yIDL prints 0.666667 |
++ | Increment, (two plus signs) adds one to the operand | IDL> x++IDL> print, xIDL prints 3.00000 |
-- | Decrement, (two minus signs) subtracts one from the operand | IDL> x--IDL> print, xIDL prints 1.00000 |
^ | Exponential, (raise to the power of) | IDL> print, x^yIDL prints 8.00000 |
mod | Modulo, gives the remainder of a division | IDL> print, x mod yIDL prints 2.00000 |