Message Font: Serif | Sans-Serif
No. of Recommendations: 0

Looking at it from a programming POV, a standard compiler will evaluate the expression from the inside out, yielding the "real" answer (8). However, a good optimizing compiler will recognize that the two costly exponentiation operators can be combined into one. Such a compiler would presumably (I haven't tested this) produce the "imaginary" answer (-8i), or it might choke on taking a fractional power of a negative number.

The standards of most programming languages, including Fortran and C/C++, explicitly forbid optimizations that fail to preserve the integrity of parentheses in order to give programmers control of the sequence of operations when it matters. Thus, such an optimization is illegal.

Print the post  


When Life Gives You Lemons
We all have had hardships and made poor decisions. The important thing is how we respond and grow. Read the story of a Fool who started from nothing, and looks to gain everything.
Contact Us
Contact Customer Service and other Fool departments here.
Work for Fools?
Winner of the Washingtonian great places to work, and Glassdoor #1 Company to Work For 2015! Have access to all of TMF's online and email products for FREE, and be paid for your contributions to TMF! Click the link and start your Fool career.