[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: a complex number library
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Tue, 4 Jan 2011 18:58:45 -0200
> I wrote a simple complex number library in pure lua.
Nice. It's an alternative to my C binding, which depends on C99:
http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/#lcomplex
The only thing I've noticed in your code is that it is not paranoid about
numerical subtleties. For instance, the code for abs is simply
math.sqrt(x.r*x.r+x.i*x.i)
which can overflow even if the result does not. For high-quality numerical
algorithms for complex math, see the Cephes library from Netlib:
http://www.netlib.org/cephes/