Message Font: Serif | Sans-Serif
 
UnThreaded | Threaded | Whole Thread (17) | Ignore Thread Prev | Next
Author: rev2217 Big gold star, 5000 posts Old School Fool Add to my Favorite Fools Ignore this person (you won't see their posts anymore) Number: of 5858  
Subject: Re: A (complex) puzzle Date: 9/26/2011 11:46 PM
Post New | Post Reply | Reply Later | Create Poll . Report this Post | Recommend it!
Recommendations: 0
Loren,

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.

Norm.
Post New | Post Reply | Reply Later | Create Poll . Report this Post | Recommend it!
Print the post  
UnThreaded | Threaded | Whole Thread (17) | Ignore Thread Prev | Next

Announcements

Post of the Day:
Macro Economics

U.S. Stable, Europe Stalling
What was Your Dumbest Investment?
Share it with us -- and learn from others' stories of flubs.
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.
Community Home
Speak Your Mind, Start Your Blog, Rate Your Stocks

Community Team Fools - who are those TMF's?
Contact Us
Contact Customer Service and other Fool departments here.
Work for Fools?
Winner of the Washingtonian great places to work, and "#1 Media Company to Work For" (BusinessInsider 2011)! 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.
Advertisement