lua-users home
lua-l archive

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


> I'm sorry to see some of the math functions go. 

A preview of my mathx library for 5.3 is availabe at
	http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/#lmathx

It also contains a Lua script for generating most of the binding
which may be useful for customization.

Here are the function mathx contains:

abs             cosh            fmod            lgamma          round
acos            deg             frexp           log             scalbn
acosh           erf             gamma           log10           sin
asin            erfc            hypot           log1p           sinh
asinh           exp             isfinite        log2            sqrt
atan            exp2            isinf           logb            tan
atan2           expm1           isnan           modf            tanh
atanh           fdim            isnormal        nearbyint       trunc
cbrt            floor           j0              nextafter       y0
ceil            fma             j1              pow             y1
copysign        fmax            jn              rad             yn
cos             fmin            ldexp           remainder

It includes the Bessel functions j0, j1, jn, y0, y1, yn, which I think are
Posix extensions. The script for generating the binding can be easiy
changed to skip these.

These are present in C99 but have been omitted because I think
they don't make much sense in Lua. Otherwise, please let me know.

	remquo, nan(), ilogb, rint, lrint, lround, scalbln, signbit, fpclassify

These will probably be added in the final release:

	fegetround, fesetround

Some function have been renamed to better names:

	fabs -> abs
	tgamma -> gamma

Perhaps these changes should be done as well:
	atan2 -> atan (as in Lua 5.3)
	fmin -> min 
	fmax -> max 
	log -> accept an optional base

Finally, like previous versions of mathx, this one adds functions the
existing math library, overwriting the functions already there. This
is a problem for abs (which works with integers as well) and log (which
accepts an optional base; this one is easy to fix).

All feedback welcome. Thanks.