Commit Graph

148 Commits

Author SHA1 Message Date
Roberto Ierusalimschy
cbe4998bc2 'math.random(n,m)' interval restricted in size, to avoid using conversion
between 'double' and 'unsigned' (which can be slow and unreliable)
2014-04-17 13:09:40 -03:00
Roberto Ierusalimschy
5336cc9d6a math.random: use 'random' when available + changes to work correctly
for any integer interval (up to [minint,maxint])
2014-04-10 14:53:33 -03:00
Roberto Ierusalimschy
fdd137276b more precision for PI + no more RADIANS_PER_DEGREE +
'min/maxint' -> 'min/maxinteger'
2014-04-09 14:29:46 -03:00
Roberto Ierusalimschy
8b45d9806a new constants 'math.maxint'/'math.minint' 2014-04-03 11:18:19 -03:00
Roberto Ierusalimschy
607be77ec8 some details to avoid warnings 2014-04-01 11:39:55 -03:00
Roberto Ierusalimschy
66b7b9b582 math.abs, math.max, and math.min work for integers, too. 2014-03-31 16:00:52 -03:00
Roberto Ierusalimschy
4244da96bf 'debug.subtype' -> 'math.type' (to distinguish integers and floats) 2013-07-22 13:05:53 -03:00
Roberto Ierusalimschy
fcf99bf788 'math.isfloat' replaced by 'debug.subtype' 2013-07-10 17:57:05 -03:00
Roberto Ierusalimschy
cbe164191c new function 'ifloor' 2013-07-03 14:23:19 -03:00
Roberto Ierusalimschy
15fdbd26fe 'numbits' moved from 'math' to 'debug' library 2013-06-25 16:37:00 -03:00
Roberto Ierusalimschy
80cdf39d0e avoid using 'modf' in the implementation of 'math.modf', to avoid
problems with 'double*'. (When using 'float' as lua_Number,
'float*' is not compatible with 'double*'...)
2013-06-25 11:02:18 -03:00
Roberto Ierusalimschy
788b251157 'math.random' operates with integers when used for integer results
(1 or 2 parameters)
2013-06-13 16:32:52 -03:00
Roberto Ierusalimschy
1414b7123c support for the case when 'l_mathop' does not conform to lua_Number
(problem with pointers to lua_Number solved by a typedef selected
automatically by 'l_mathop')
2013-05-26 10:45:24 -03:00
Roberto Ierusalimschy
0233ce0815 new function 'math.numbits' (not a final decision) 2013-05-06 14:22:55 -03:00
Roberto Ierusalimschy
29fe3abda2 new function 'math.isfloat' 2013-05-02 14:31:54 -03:00
Roberto Ierusalimschy
8830901a9c second parameter to 'ldexp' is an integer 2013-03-07 15:21:32 -03:00
Roberto Ierusalimschy
181a837cac small improvement in the support of 'float' as lua_Number 2013-01-29 14:00:40 -02:00
Roberto Ierusalimschy
3ac595da8a allow "long double" precision for PI constant if needed 2012-05-18 14:47:53 -03:00
Roberto Ierusalimschy
79cbc3468c removed and deprecated functions really removed from the code base 2011-07-05 09:49:35 -03:00
Roberto Ierusalimschy
bcce769d29 avoid "unreacheable code" warnings 2010-11-18 16:38:27 -02:00
Roberto Ierusalimschy
a1952d9c41 'l_tvar' renamed to 'l_tg' 2010-11-12 13:47:34 -02:00
Roberto Ierusalimschy
1a46a713d2 new macro 'l_tvar' to easy the use of mathlib with other floating
types (float and long double)
2010-11-11 13:39:12 -02:00
Roberto Ierusalimschy
c6b64ffe65 new type lua_Unsigned and corresponding projection/injection functions 2010-10-25 18:31:11 -02:00
Roberto Ierusalimschy
7192afafee new module policy: C modules do not create globals and do not register
themselves with 'require' (let 'require' do its work); new auxiliary
functions luaL_newlib/luaL_newlibtable/luaL_setfuncs/luaL_requiref.
Old luaL_register will be deprecated.
2010-07-02 08:38:13 -03:00
Roberto Ierusalimschy
a6f465f558 new mark LUAMOD_API for all luaopen_* functions 2009-11-24 10:05:44 -02:00
Roberto Ierusalimschy
3ca739b418 'math.random' uses lua_Number to manage its arguments (there is no
reason to lose range).
2009-03-17 14:55:39 -03:00
Roberto Ierusalimschy
a1d0e1a11a 'log10' is deprecated now 2009-02-18 10:17:10 -03:00
Roberto Ierusalimschy
8975739839 better precision for log(x, 10) 2009-02-18 10:06:05 -03:00
Roberto Ierusalimschy
8d3dd04137 clearing some old compatibility code 2007-06-21 10:52:27 -03:00
Roberto Ierusalimschy
8e36e1fe49 details (randomseed calls rand once to dischard first value) 2007-03-27 09:37:00 -03:00
Roberto Ierusalimschy
5019b2dd20 math.log now accepts an optional base 2006-08-07 16:01:56 -03:00
Roberto Ierusalimschy
3390f9a35a detail 2005-08-26 14:36:32 -03:00
Roberto Ierusalimschy
5e8a9e324c luaL_openlib -> luaL_register, luaL_putchar -> luaL_addchar 2005-08-15 11:12:32 -03:00
Roberto Ierusalimschy
289b5dc67a details (function list in alphabetical order) 2005-07-11 20:58:35 -03:00
Roberto Ierusalimschy
1f9f97e3cf 'math.mod' -> 'math.fmod' 2005-06-13 18:20:14 -03:00
Roberto Ierusalimschy
49f90ffdeb new functions (to complete math.h) 2005-03-04 15:57:03 -03:00
Roberto Ierusalimschy
f61d435a7d a^b calls `pow´ (from math.h) directly 2005-01-07 18:00:33 -02:00
Roberto Ierusalimschy
a17dd24b34 no more USE_DEGREES option 2004-05-10 15:11:32 -03:00
Roberto Ierusalimschy
b4cd38ba6c new scheme for configuration through `luaconf.h' 2004-04-30 17:13:38 -03:00
Roberto Ierusalimschy
fa198197a0 lua_(set)getglobal are ok to use 2003-11-05 09:59:14 -02:00
Roberto Ierusalimschy
533737f26e new functions lua_getfield' and lua_setfield' 2003-10-10 09:57:55 -03:00
Roberto Ierusalimschy
f04fe526cd new functions `lua_tointeger' and lua_pushinteger' 2003-10-07 17:13:41 -03:00
Roberto Ierusalimschy
4039bf457d ^ operator is defined by global `__pow' 2003-03-11 09:30:37 -03:00
Roberto Ierusalimschy
034de1fe73 new names for functions that open C libraries 2003-03-11 09:24:34 -03:00
Roberto Ierusalimschy
32fd039bb5 `openlib' functions return new module 2002-12-20 08:26:33 -02:00
Roberto Ierusalimschy
27c6b4d422 each .c file defines its own name 2002-12-04 15:38:31 -02:00
Roberto Ierusalimschy
097edd3884 better names for auxiliar functions 2002-11-14 13:41:38 -02:00
Roberto Ierusalimschy
aa5b15f271 detail 2002-08-14 17:10:33 -03:00
Roberto Ierusalimschy
653416d5c0 angles in radians(!) 2002-08-14 17:07:43 -03:00
Roberto Ierusalimschy
00a40f4d6a ensure proper rounding 2002-08-07 17:54:38 -03:00
Roberto Ierusalimschy
e182cf452f `^' operator is defined in registry.__pow 2002-06-24 10:54:13 -03:00
Roberto Ierusalimschy
d8678edddc luaL_verror -> luaL_error 2002-06-18 12:16:18 -03:00
Roberto Ierusalimschy
5b8ee9fa8d new names for standard libraries 2002-06-05 14:24:04 -03:00
Roberto Ierusalimschy
71144e3ff0 errors `return' int, to avoid warnings
+ home-made `sprintf' (first version)
2002-05-06 16:05:10 -03:00
Roberto Ierusalimschy
85dcb411a8 all textual errors go through `luaL_verror' 2002-05-02 14:12:27 -03:00
Roberto Ierusalimschy
a2e414d679 `pow' must be global (as the implementation of '^') 2002-04-04 17:20:49 -03:00
Roberto Ierusalimschy
13ab5a6bb1 details 2002-04-02 17:43:08 -03:00
Roberto Ierusalimschy
88c9bf99de standard libraries in packages 2002-03-20 09:54:08 -03:00
Roberto Ierusalimschy
592a309177 tag system replaced by event tables 2001-12-05 18:15:18 -02:00
Roberto Ierusalimschy
72659a0605 no more explicit support for wide-chars; too much troble... 2001-11-28 18:13:13 -02:00
Roberto Ierusalimschy
dd3a63c205 new way to handle `profiles' 2001-03-26 11:31:49 -03:00
Roberto Ierusalimschy
6d4db86888 open functions are lua_Cfunctions 2001-03-06 17:09:38 -03:00
Roberto Ierusalimschy
39b7978329 first (big) step to support wide chars 2001-02-23 14:17:25 -03:00
Roberto Ierusalimschy
5f37134e64 avoid '...' and "..." inside comments 2001-02-22 15:59:59 -03:00
Roberto Ierusalimschy
7e3d3e1f70 details 2001-02-02 17:02:40 -02:00
Roberto Ierusalimschy
4894c27962 lua_Number defined in lua.h (1st version) 2000-12-04 16:33:40 -02:00
Roberto Ierusalimschy
67c1afff59 lua_settagmethod does not return old tag method 2000-10-31 11:10:24 -02:00
Roberto Ierusalimschy
2cbbf3933a new macro LUALIB_API (so the lib can be a separate DLL) 2000-10-27 14:15:53 -02:00
Roberto Ierusalimschy
b892f0a877 new API function `createuserdata' 2000-10-26 10:47:05 -02:00
Roberto Ierusalimschy
64eecc0b82 new macro LUA_API 2000-10-20 14:39:03 -02:00
Roberto Ierusalimschy
f0b3cd1d6f new API functions pop', insert', and `move' 2000-08-31 17:23:40 -03:00
Roberto Ierusalimschy
9fdf73bc9a first version for new API 2000-08-28 14:57:04 -03:00
Roberto Ierusalimschy
e238efc536 default now is multi-state 2000-08-09 16:16:57 -03:00
Roberto Ierusalimschy
1de5587184 `lua.h' is included before any other Lua header file 2000-06-12 10:52:05 -03:00
Roberto Ierusalimschy
73aa465a8e some name changes 2000-03-10 15:37:44 -03:00
Roberto Ierusalimschy
acdb0b741e comments. 1999-12-27 15:33:22 -02:00
Roberto Ierusalimschy
1b15206cf9 many details + code redistribution 1999-12-14 16:33:29 -02:00
Roberto Ierusalimschy
7d1499ba88 new macro luaL_openl 1999-11-22 15:39:51 -02:00
Roberto Ierusalimschy
29ede6aa13 first implementation of multiple states (reentrant code). 1999-11-22 11:12:07 -02:00
Roberto Ierusalimschy
2a03170ebd random(0) and random(x,0) are wrong (0 is read as no argument!). 1999-08-18 11:40:51 -03:00
Roberto Ierusalimschy
c787dccd9b "const" !!! 1999-08-16 17:52:00 -03:00
Roberto Ierusalimschy
3f43aaa23f new RedHat defines PI :-( 1999-07-07 14:54:08 -03:00
Roberto Ierusalimschy
b5cd7d426f details 1999-02-19 15:33:35 -02:00
Roberto Ierusalimschy
8278468041 comments 1999-01-04 10:41:12 -02:00
Roberto Ierusalimschy
4fbb2531b3 don´t need the "+1", the "%" is enough to garantee r<1. 1998-12-30 19:23:26 -02:00
Roberto Ierusalimschy
05d89b5c05 new option for function "random": random(a,b) returns a<=x<=b 1998-12-30 15:22:17 -02:00
Roberto Ierusalimschy
766e67ef3b to avoid warnings about "typecast" (Visual C++) 1998-12-28 11:44:54 -02:00
Roberto Ierusalimschy
4ccfb2f9bc "_TRIGMODE" was still being declared. 1998-09-08 16:25:35 -03:00
Roberto Ierusalimschy
9618aaf07d small corrections in comments 1998-06-19 13:14:09 -03:00
Roberto Ierusalimschy
74719afc33 new functions "frexp" and "ldexp" 1998-05-27 16:09:39 -03:00
Roberto Ierusalimschy
fada8efd01 "rand()", in SunOS, may return values bigger than "RAND_MAX"... 1997-12-26 16:36:31 -02:00
Roberto Ierusalimschy
80b3d28f4a details (mainly error messages) 1997-12-09 11:50:08 -02:00
Roberto Ierusalimschy
39fd5bb9b0 details 1997-11-28 10:39:22 -02:00
Roberto Ierusalimschy
6153200bc2 make sure there is no mem problems, using %.ns instead of %s for luaV_error. 1997-11-19 16:16:33 -02:00
Roberto Ierusalimschy
45cad43c3f "lua_open": now lua has an explicit open operation. 1997-11-04 13:27:53 -02:00
Roberto Ierusalimschy
dad5a01fb0 trigonometric mode stored in a Lua global variable. 1997-11-03 19:11:44 -02:00
Roberto Ierusalimschy
41223a01ec definition of "PI" and modes for angles. 1997-10-24 15:44:22 -02:00
Roberto Ierusalimschy
b945fae40e Lua standard mathematical library 1997-09-16 16:25:59 -03:00