Mathimatics mercedes, toyota

One factor important with regards to both operators and conditions is that of precedence. Precedence implies that one operator is executed before another. Enclosing part of an expression in brackets (parentheses in mathematical jargon) forces that part of the expression to be executed first, starting with the lowest nested or parenthesized level. Let’s look at arithmetic operator precedence to explain this concept. In this first example expression, the multiplication will execute before the addition because multiplication has higher precedence than (is executed before) addition, even though reading from left to right, addition appears before multiplication.
x + y × z
Now let’s fix the precedence problem and force addition to execute first by using parentheses.
( x + y ) × z
Similarly applying nesting of precedence in the next example, the subtraction will be executed first, followed by the addition and finally the multiplication, regardless of the precedence of the different operators.
( x + ( y - p )) × z
That is precedence. Simple, right? Now let’s go onto operators.

Posted by admin on April 24th, 2008 No Comments