Thread: Excel Math Bug
View Single Post
  #20   Report Post  
Posted to microsoft.public.excel.programming
Jerry W. Lewis Jerry W. Lewis is offline
external usenet poster
 
Posts: 837
Default Excel Math Bug


Amedee Van Gasse wrote:
....

=-(5^2)
returns +25


I think you meant "returns -25"; +25 would be a bug for this one (but
not one that I can reproduce).

That -5^2 returns +25 is covered by Help for "About calculation
operators" subtopic "The order in which Excel performs operations in
formulas". As Tom noted, different programs may use different orders of
operator precedence. Programmers are responsible for learning the
languages that they use. It is a bit more problematic when one person
provides the formulas (or even the code) and another implements it, but
that is what testing is for.

I once got burned providing an algorithm that someone else then
implemented in a flavor of Basic that evaluated strictly left to right
with no algebraic hierarchy (other than parentheses) at all. I was
irritated that someone would write a language that worked that way, but
they documented how it worked, so our ignorance of their documentation
was not their fault. Fred's consultant should have known better than to
imply that any developer could be sued for producing a package that
operated as documented.

Jerry