lua-users home
lua-l archive

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


On 04/07/2014 12:51 PM, Luiz Henrique de Figueiredo wrote:
There are subtle numerical reasons to avoid these definitions. These
are handled in libc, as they should. See for instance the Cephes
Mathematical Library at http://www.netlib.org/cephes/ .

Ok, I see it. Adding very big and very small numbers means trouble in float.

This is the main reason why providing a math library in Lua is probably
not a good idea: the result would either have low quality or be quite
complex and obscure, in the interest of precision.

I imagine doing it in pure Lua would be extremely hard not knowing exactly what number representation the VM is built with. That probably means that a full math library will always be inherently less portable than a Lua script.

Jorge