Topic: Does the 'pow' function use repeated squaring ?
Author: mahendra@cs.umbc.edu (Arungundram C Mahendran)
Date: 10 Dec 1994 00:53:31 -0500 Raw View
Hello,
I just wanted to know if the 'pow' func in C/C++ uses
repeated squaring for its implementation !
Mahendran
Author: lehotsky@max.tiac.net (Alan Lehotsky)
Date: 10 Dec 1994 15:53:13 GMT Raw View
In article <3cbforINNk2i@bandit.cs.umbc.edu>,
Arungundram C Mahendran <mahendra@cs.umbc.edu> wrote:
>Hello,
> I just wanted to know if the 'pow' func in C/C++ uses
>repeated squaring for its implementation !
>
>Mahendran
There's no requirement on the implementation of pow(), so
library vendors may use any algorithm they want.
No quality implementation would use this algorithm. It is
slow and probably causes nasty problems maintaining precision.
Any BSD derived pow() uses a fairly complex algorithm that
handles multiple special cases (based on sign and range of the
input arguments, I think.
If you really want to know,
Use the Source, Luke!
-- Al Lehotsky
ex OSF/1 libm hacker....
======================================================================
Quality Software Management
8 Tucker Ave.
Lexington, MA 02173
lehotsky@tiac.net Voice: (617)862-5418 Fax: (617)674-1096
Software Process Improvement and Management Consulting