[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: mathlib
- From: Coda Highland <chighland@...>
- Date: Thu, 3 Apr 2014 15:01:07 -0700
On Thu, Apr 3, 2014 at 2:57 PM, Julien Cornebise
<julien.cornebise@gmail.com> wrote:
> Hi Roberto
>
> Naive question, but doesn't math.pow() implements some fast exponentiation
> scheme (for integer exponents) that would be somewhat annoying to recode
> manually? Similar question for the exponentiation by non-integer exponents:
> I'd assume that math.pow() has some smarter way than exp(a log(x)). Or am I
> missing something obvious when you say it would be trivially done without
> the library?
> All the best,
>
> Julien
>
The thing about math.pow is that Lua has exponentiation available
using the ^ operator -- that is, math.pow(a,b) == a^b. The math
library function is therefore a more verbose and (I think) slightly
slower way of expressing the same thing.
/s/ Adam