Random of zero

Raymond E. Griffith rgriffit at ctc.net
Wed May 14 11:59:00 EDT 2003


on 5/14/03 6:41 AM, Shari at gypsyware at earthlink.net wrote:

>> There are several little niggly things in programming that violate, say, the
>> algebraic order of operations.
> 
> Oh you've peaked my curiousity!  Give an example :-)
> 
> Shari C

OK, here's the most glaring one.

In algebra, the order of operations is Parentheses, Exponents,
Multiplication and Division from left to right, Addition and Subtraction
from left to right.

Negative numbers are considered to be the product of the positive number and
-1. (Hold this thought).

Algebraically, -2^4 means -1*2^4. The exponent only affects what it is
attached to. -2^4 = -16.

With computers, however, -2^4 = 16. The computer does the negation before
the exponent, even though negation algebraically is multiplication. It makes
sense, since the representation of negative integers in binary reveals no
"negative" sign. It is just another number.

Raymond





More information about the metacard mailing list