Commit Graph

117 Commits

Author SHA1 Message Date
Roberto Ierusalimschy
dc4232379d detail (ensure subtraction is done unsigned) 2015-10-02 12:39:23 -03:00
Roberto Ierusalimschy
be63d995c1 tiny bug: 'randomseed' was calling 'rand' (instead of 'l_rand')
to discard first value
2015-06-26 16:30:32 -03:00
Roberto Ierusalimschy
7d930ec694 use 'log2' when available 2015-03-12 11:04:04 -03:00
Roberto Ierusalimschy
1a7868c1d5 bug: 'random' limit is 2^31-1, not RAND_MAX 2014-12-27 18:32:26 -02:00
Roberto Ierusalimschy
17ca3b1763 cleaner test for overflow for range of 'math.random' 2014-11-07 09:31:58 -02:00
Roberto Ierusalimschy
28fdbcf393 added include for 'lprefix.h', for stuff that must be added before
any other header file
2014-11-02 17:19:04 -02:00
Roberto Ierusalimschy
463edee2fd 'lua_numtointeger' -> 'lua_numbertointeger' 2014-10-24 09:42:06 -02:00
Roberto Ierusalimschy
65ec3379b1 added some casts for the cases when lua_Number != double 2014-10-08 16:57:31 -03:00
Roberto Ierusalimschy
798660c9cd deprecated "cast macros" ('luaL_checkint', 'luaL_optint', etc.) 2014-10-01 08:54:56 -03:00
Roberto Ierusalimschy
925d1b59f9 new function 'math.ult' (unsigned less than) 2014-07-28 14:35:47 -03:00
Roberto Ierusalimschy
8bb272a3e3 new conversion float->integer: conversion is valid only when
float has an exact representation as an integer
2014-07-17 09:30:53 -03:00
Roberto Ierusalimschy
f14662fca6 detail (added placeholders for non-function fields to preallocate
space for them)
2014-07-16 10:56:14 -03:00
Roberto Ierusalimschy
b9dcf9974d detail (typos in comments) 2014-06-30 16:48:08 -03:00
Roberto Ierusalimschy
a77d263e86 unsigned-manipulation functions (lua_puhsunsigned, lua_tounsigned, etc.)
deprecated
2014-06-26 15:38:28 -03:00
Roberto Ierusalimschy
e3871abe95 'math.ifloor' is back 2014-06-18 09:35:53 -03:00
Roberto Ierusalimschy
355037528c 'math.mof' works with integers, too 2014-06-02 20:09:28 -03:00
Roberto Ierusalimschy
456806f25c no more 'math.ifloor' + new semantics for 'math.floor'/'math.ceil' 2014-05-26 14:13:52 -03:00
Roberto Ierusalimschy
8b66040e34 several functions deprecated (cosh, sinh, atanh, pow, frexp, ldexp) 2014-05-14 13:59:27 -03:00
Roberto Ierusalimschy
6d5324f92f 'math.fmod' handles integers as integers 2014-05-02 13:36:51 -03:00
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