Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.


ID: 17492, A faster Power function

by Patrick Van Laake Email: Anonymous


The Power function in the Math unit could be optimized by avoiding the call to Exp and doing the processing inline.
Download Details
FTP  download also available 0 bytes
CDN Login Required to Download. (You will be redirected to the login page if you click on the Download Link)
To download this, you must have registered:
A free membership

For Delphi, Version 1.0  to 5.0 10 downloads
Copyright: No significant restrictions


Size: 0 bytes
Updated on Fri, 01 Feb 2002 16:03:57 GMT
Originally uploaded on Fri, 01 Feb 2002 16:07:49 GMT
Description
Intel-class processors have no built-in support for exponentiation. The Power function in the Match unit implements real-type exponentiation by exploiting the equivalence x^y == e^(y ln(x)). The term y ln(x) is computed first and this is then passed to the Exp function. However, the first thing that happens to this term in the Exp function is that it is converted to a base-2 exponentiation, something that binary computers are inherently good at. So why not exploit the equivalence x^y == 2^(y log2(x)) in the first place??? Efficiently implemented, the operations count goes from 20 to 12, saving a call, a load operation and a multiplication. An application that uses both the Exp and Power functions will be about 60 bytes larger, but if you depend on the Power function for some part of your functionality (as in signal processing, f.i.) the deal looks sweet.

   Latest Comments  View All Add New

Move mouse over comment to see the full text
Reply  Posted by Sejmur Farsijew on Feb 17 2008
A faster Power function

Server Response from: ETNACDC04