lua-users home
lua-l archive

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


2009/12/3 Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br>:
>> > =(1+1i)^2
>> 1.2246063538224e-016+2i
>>
>> The complex module from numlua doesn't have these problems
>
> I get the same results with my lcomplex. We're probably both using cpow.
> Perhaps numlua converts z^2 to z*z (which does give 0+2i).
>

yes (it uses the usual algorithm for integer powers, cumputing z^2,
(z^2)^2, ((z^2)^2)^2 ... and multiplying the results; generally, all
it's algorithms seem to be optimal)