English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

With order of operation on computers/calculators.

I've seen things such as

A * B / C + D
which is take to mean AB/(C+D)
or I've seen

5 * 1 + 4 / 2 * 2 = ?

Which would be 9

but some people say 6..

I know in math the denominator is used ..but
it's not on a slant ---so there's an invisible pair of brackets- -so can someone clear this up for me

thanks

for ex. in physics
1 Tesla = 1 N / A* M

but that can cause some confusion
if / is meant to be divide then
1 T = 1N / (A * M) not (N/A) * M

2007-05-13 17:01:16 · 3 answers · asked by Anonymous in Science & Mathematics Mathematics

3 answers

Computer programing follow the same rules as math. The rule say that you should do operations in the following order. Parenthesis , exponents, multiplication or division, addition or subtraction.

So, 5 * 1 + 4 / 2 * 2 = 9 because of the order of priority listed above. Multiplication and division come first, then addition and subtraction.

5 + 2*2
5+4 =9

The thing is that 4 is divisible by two so this is what is causing your confusion. Remember that the denominator have to be the same only in addition and subtraction, not in multiplication and division. So you could do it this way.

5*1 + (4*2)/2

5 + 8/2 // I'll add the numbers without simpifying

10/2 + 8/2 // remember than in order to add fractions the denominator must be tha same. In order for that to happen you must multiply the numerator by the same number that you used to make the denominator equal to the number you where looking for. In our case by 2 because 1*2 = 2. Thats what we wanted on the denominator a 2. To get that two we just so happen that we multiplied by 2. So multiply the numerator by 2 and you get 10/2

Continuing. 10/2 +8/2 = 18/2

but isn't 18/2 the same as 9.

2007-05-13 17:13:31 · answer #1 · answered by mr_gees100_peas 6 · 0 0

Depends on the convention of the programming language or program. In written equations, parenthesis define how things are to be calculated. without parenthesis, Almost all the time, things are set up so that formulas are translated in this order. Exponentiation, mulitiplication, addition. so in you r example its 2*2 first then 5*1 and 4/(4), then add them. But its just a convention, and you have to check the rules of the particular language before assuming how to interpret things.

2007-05-13 17:07:44 · answer #2 · answered by squeezie_1999 7 · 0 0

it truly is a mathematical convention. it is not in any respect an axiom of math. it is in simple terms defining what you do whilst an expression is ambiguous, so i assume it is extra like a definition of mathematical notation.

2016-12-29 03:22:56 · answer #3 · answered by ? 3 · 0 0

fedest.com, questions and answers