On Tuesday, May 27, 2003, at 08:29 PM, Raymond E. Griffith wrote:
On Thursday, May 22, 2003, at 11:32 AM, David Squance wrote:

-10*-10 is ambiguous, since you have two operations adjacent to each
other
(ultra picky, I know)
Assuming *-10 is meant to be *(-10), -10*-10 = -(-100) = 100

I'm having trouble seeing an alternate meaning.
...
Here is the issue:

I'm sorry; in my brevity I was not clear. I wandered off the -10^2 subject. What I meant is that I don't see what is ambiguous about -10*-10. One meaning suggested is (-10)*(-10). If it is ambiguous, then there must be an alternative meaning. I don't see one.


But since computers see numerical representation differently, the negation
of a number is not a real "operation" to a computer. -10 is a single unit.

Negation has been a primitive machine instructions on must computers where I have programmed in machine language or assembler. (I would also think that both negation and negative numbers have a place in mathematics.)


So -10^2 in computer languages will always mean (-10)^2.

This seems too strong of a generalization. One can design a computer language in which that is not so. More so, at compile time it is straightforward for for negation of a constant to be pre-computed (optimized) to a representation of a negative number. I believe Fortran will do exponentiation and multiplication and division before negation. I think in Basic it is exponentiation, negation and then multiplication and division.


But if the engine were rewritten to check and correct
for this algebraically, it would run a lot slower.

I doubt this would run any slower than what we get when we put the parentheses where we want them.


Better for us just to
recognize the difficulty and code around it.

Yes, we must code around it. But the difficulty that causes it is not something inherent in the computer, but a tradition among computer languages in both C and Pascal families. In particular, in the Hypercard heritage the order is negation, exponentiation, and then multiplication and division.


We agree in that we work around it. I use parentheses and intermediate values in variables.

Dar Scott

_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to