Re: New pow-function
| From: | Andrei Zmievski | Date: | Tue, 03 Jul 2001 19:46:18 +0000 |
| Subject: | Re: New pow-function | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-58818@lists.php.net to get a copy of this message | ||
On Tue, 03 Jul 2001, Jeroen van Wolffelaar wrote:
> Hi,
>
> I've rewritten the pow(base,exp) function. It is attached.
>
> In stead of a mere call to the c-lib function pow, this one actually does
> something more smart. This is to protect those people not knowing that there
> is huge difference between raising to an integer power and raising to a
> fractional power. It will give sensible errors rather than bogus results.
>
> It will also return integer when possible, i.e. pow(5,5) will return the
> INTEGER 3125.
>
> Read the new function for more info, it's richly commented, and for any
> questions: just mail me.
>
> IMPORTANT: I didn't test it yet, I'm not even sure there are no compile
> errors.
> (My linux machine doesn't have libtool 1.4 :-(( )
Please use proper Z_* macros, that is Z_LVAL_PP(exp) instead of
Z_LVAL(*exp).
-Andrei
"In this age, which believes that there is a short cut to everything,
the greatest lesson to be learned is that the most difficult way is, in
the long run, the easiest."
-Henry Miller, The Books in My Life