Thread: Excel Math Bug
View Single Post
  #22   Report Post  
Posted to microsoft.public.excel.programming
Dana DeLouis[_3_] Dana DeLouis[_3_] is offline
external usenet poster
 
Posts: 690
Default Excel Math Bug

We found another strange thing with double negatives.
It was something like "=--2" yielded a result of "5" or something


Hello. I can't think of anything off hand where "=--2", by itself, would
return 5.
Just some thoughts he =3--2 returns 5 as expected. However, Excel will
accept extra "-" in the equation.

=3---2
returns 1, so a typo will cause a logic error on a worksheet.

In fact, Excel will accept "=3---------2". The merits of this is up to
debate. :) One could argue either case. In mm, you can not do "3--2"
because the "--" is the "Decrement" operator on the 3, and you can't do this
on a number. The correct way is to include a space (3- -2), or better
3-(-2).

Another common use of "--" is to convert Boolean values to numbers. For
example:
=-(32) returns -1, and =--(32) returns +1. This is just a feature of
Excel.

HTH
Dana DeLouis


"fred" wrote in message
...
Yes Dana, that's it. Good deduction.

It cost me $2000, and a week, to find that out.

it happens directly after the leading equal sign or inside prens.

We found another strange thing with double negatives.
It was something like "=--2" yielded a result of "5" or something
along those lines. But we were in the middle of something
and I didn't write it down. Are you familiar with that one?


"Dana DeLouis" wrote in message
...
...the wrong sign a math bug,
...And Mathematica calculates the formula differently (the right way).


Just guessing here. The only thing that comes to mind of hand might be

the
following:

In Excel:
=-5^2
returns +25.

and in mm:
-5^2
-25


<snip