Napkin Math

Y

YouBetcha

Why does 1/2*4 = 0.125 (and not 2)?

It correctly knows that 1 - 2 + 4 = 3 (and not -7)

Is this a bug fixed in the new service pack?
 
D

Don MI

YouBetcha said:
Why does 1/2*4 = 0.125 (and not 2)?

It correctly knows that 1 - 2 + 4 = 3 (and not -7)

Is this a bug fixed in the new service pack?

Perhaps because 1 divided by 8 equals 0.125.
 
E

ekseks

I was always taught the order for processing math functions is:

M, D, A, S (multiplication, then division, then addition, then subtraction)

Looks to me ON is evaluating your equation correctly. If you really want it
to equal 2 you have to force it to evaluate the 1/2 first by (1/2)*4.
 
J

John Waller

I was always taught the order for processing math functions is:
M, D, A, S (multiplication, then division, then addition, then
subtraction)

I've always understood the order of precedence as:

Multiplication (M) and Division (D) = same precedence

followed by

Addition (A) and Subtraction (S) = same precedence

Precedence is then followed by association.

i.e. if M and D (or A and S) are found in the same expression then, in the
absence of parentheses, they're calculated as they are found reading left to
right.

i.e. to me, 1/2*4 is the same as (1/2)*4 which should equate to 2 (yet
ON2007 produces 0.125 = 1/(2*4)).

which is why I always use parentheses where doubt may exist.
 
Y

YouBetcha

John, you are correct (ekseks' response adds a layer of order that shouldn't
be there). But I shouldn't have to add parenthesis to a non-ambiguous
expression where it isn't needed.

So, was this addressed in the service pack?
 
J

John Waller

But I shouldn't have to add parenthesis to a non-ambiguous
expression where it isn't needed.

Agreed, but if I'm looking for the correct answer, it's the most foolproof
way of getting it.
So, was this addressed in the service pack?

No.

Full list of SP1 changes is found in this Excel spreadsheet
(from http://support.microsoft.com/kb/936982):

http://download.microsoft.com/downl...5A/Office 2007 Service Pack 1 Changes_all.xls


Why not post this question to:
http://connect.microsoft.com/onenote
 
J

John Waller

Thanks for chiming in, John.
It is not fixed in SP1.

Surprising since the order of evaluation of arithmetical operators is so
fundamental to even basic maths.
I tend to think of the napkin math functionality as more of a calculator
than a
mathematically rigorous implementation, but there are obviously some cases
which could use fixing up.

Same here although even my limited maths ability tells me that, without
parentheses, 1/2*4=2 ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top