lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, Apr 11, 2014 at 8:01 PM, Coda Highland <chighland@gmail.com> wrote:
> On Fri, Apr 11, 2014 at 7:23 PM, Peng Zhicheng
> <pengzhicheng1986@gmail.com> wrote:
>> is the gain (if any) of a special integer pow operation worth the semantic
>> change?
>
> It's probably faster, but the problem can be addressed by also using
> the floating-point version when the RHS operand is negative. It seems
> a simple enough change to me.

I also forgot: It preserves accuracy in the result for values that
need more than 52 but less than 65 bits to express. So it's more than
just performance; it's semantic correctness.

Of course, if the code doesn't handle overflow (I haven't looked) then
that's actually a weakness of using ints instead of floats.

/s/ Adam