lua-users home
lua-l archive

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


On Sun, Oct 27, 2019 at 7:29 PM Jasper Klein <> wrote:
> print( ( -1.0702700000075937e-05 ) ^( 1 / 2.19921875 ) ) retults too a
> If I understand this right the result is a -nan because it would be a
> complex number.

It generally is, IIRC if X=1.07...e-5, Y=1/2.199..., and j=sqrt(-1)
you can write that as (X*e^(j*pi))^Y = X^Y* e^(j*pi*y), which gives
you phase and amplitude ( oops, EE deviant, too many modem code
written lately, I think it's called modulus and argument usually ).

Also, IIRC lua docs state somewhere that exponentiation is done by
pow. man 3 pow fives you a nice break down of special things which can
happen, the first of which is, in my system " If x is a finite value
less than 0, and y is a finite noninteger, a domain error occurs, and
a NaN is returned."

Francisco Olarte.