lua-users home
lua-l archive

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


> 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/