lua-users home
lua-l archive

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


mathx for Lua 5.3 is available at
	http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/5.3/lmathx.tar.gz

This version replaces the provisional one written before Lua 5.3 was released.

mathx is a complete math library for Lua 5.3 with the functions
available in C99. It can replace the standard Lua math library, except
that mathx deals exclusively with floats and mathx does not open itself
inside math. The intent is that mathx is suitable for scientific work
(in as much as C99 is).

mathx includes these functions:

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

The names follow the ones in C99 closely, except that I've used gamma
instead of tgamma. Note that it's fabs, fmax, fmin instead of abs, max, min.
You can always rename any functions to names that you like.

As in math, atan can function as atan2 and log accepts an optional base.

mathx does not include these C99 functions and values:

 fpclassify	 huge		 random		 randomseed	 rint
 signbit

mathx does not include these that are in math because they deal with integers:

 maxinteger	 mininteger	 random		 randomseed	 tointeger
 type		 ult

There is no manual: see a C99 reference manual, e.g.
	http://en.wikipedia.org/wiki/C_mathematical_functions       

All feedback welcome. Enjoy.
--lhf