CATEGORY: Calculations
CLASS: Operators
info@dwaynewright.com
FileMaker mathematical operators are used to perform arithmetic operations within a calculation field. These operators include precedence, addition, subtraction, multiplication, division and exponentiation. Addition ... ( + ) ... The addition operator is quite familiar and is used to add two numbers together such as 2 + 2 = 4.
Subtraction ... ( - ) ... Subtraction is also quite familiar and is used to take on value from another such as 10 - 7 = 3.
Multiplication ... ( * ) ... The multiplication operator is used to multiple two numbers together such as 2 * 5 = 10.
Division ... ( / ) ... Division is used to divide one number from another such as 25 / 5 = 5
Exponentiation ... ( ^ ) ... Used to raise a number to the power of the exponent such as 4^2 = 16 ... four to the second power
Precedence ... ( ) ... By default, calculations are read from left to right. Parenthesized expressions are calculated first and then the calculation goes back to reading from left to right. So a calculation of 2 + (2 * 4) would be calculated with the parenthesized expression first ( 2 * 4) and then that result is added by two. So our returned value would be 10. This is because two multiplied by four equals eight. The we go to the left of the calculation and add two, which of course is 2 + 8.
Here is an example of both precedence and exponentiation. What do you think the calculation of ( 20 / 5 ) ^ 4 would return? Our calculation inside of the parenthesis gives us a 4. We then raise it to the fourth power.
To the first power ... 4
To the second power ... 16
To the third power ... 64
To the fourth power ... 256
So the answer here is 256!
Now lets take way the precedence. What do you think the calculation of 20 / 5 ^ 4 would return? Here we are taking twenty and dividing by 5 raised to the fourth power.
To the first power ... 5
To the second power ... 25
To the third power ... 125
To the fourth power ... 625
20 / 625 = .032
So the answer here is .032!
So you can see that precedence clearly changed the entire calculation.
ADVERTISEMENT ==================
Help support this blog by considering a donating to its ongoing growth. For more details, please visit http://www.dwaynewright.com/donate.html