POV-Ray : Newsgroups : povray.general : unexpected rotation result : Re: unexpected rotation result Server Time
8 Aug 2024 16:16:58 EDT (-0400)
  Re: unexpected rotation result  
From: Scott Hill
Date: 7 Feb 2001 10:20:51
Message: <3a8167d3@news.povray.org>
"Thorsten Froehlich" <tho### [at] trfde> wrote in message
news:3a815c85@news.povray.org...
> In article <3a80db3a$1@news.povray.org> , "Mark Wagner"
> <mar### [at] gtenet> wrote:
>
> > I just typed the expression 1+2*3-4 into my TI-1795 calculator, and, as
> > expected, got the number 5.
>
> Yes, because you did not calculate the above!  What you calculated* was :
>
> 1+2=3
>
> 3*3=9
>
> 9-4=5
>
> Obviously this cannot be the same as 1+2*3-4.
>
>


    Yeah, but the point is that 5 is just as valid a result as 3, for the
sum 1+2*3-4, if we ignore the 'accepted' operator precedence rules. We could
quite as easily have precedence rules that state that addition and
subtraction is done before multiplication and then everyone would be saying
"But it's not 3, it's -3!". Do you see ? All that makes 1+2*3-4 evaluate to
3, rather than -3, or 5, or -1 is an arbitrary rule about which order the
operations should be done in - change those rules and you change the
answer - but you don't change any fundamental aspect of mathematics.

    There are, unless I've missed some, 5 ways (if we ignore standard
operator order rules) to interpret '1+2*3-4' :

    (1+(2*(3-4))) = -1
    (1+((2*3)-4)) = 3
    ((1+(2*3))-4) = 3
    ((1+2)*(3-4)) = -3
    ((1+2)*3)-4) = 5

    These're all _mathematically_ correct statements, yet we only except one
to be the correct evaluation of '1+2*3-4'. This is not, as I've already
said, because any of the others are wrong, but merely because the statement
is ambiguous and we therefore need some way to de-ambiguate (choose) between
the possible interpretations.

--
Scott Hill.
NC Graphics (Cambridge) Ltd.
http://www.ncgraphics.co.uk

P.S. When will p.o-t be back ?


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.