summaryrefslogtreecommitdiff
path: root/lmathlib.c
Commit message (Collapse)AuthorAgeFilesLines
* DetailRoberto Ierusalimschy2022-01-031-2/+2
| | | | Warnings with clang when using long double for Lua floats.
* Broadening the use of branch hintsRoberto Ierusalimschy2021-02-241-2/+3
| | | | | | More uses of macros 'likely'/'unlikely' (renamed to 'l_likely'/'l_unlikely'), both in range (extended to the libraries) and in scope (extended to hooks, stack growth).
* Several details about 5.4.0 rc1Roberto Ierusalimschy2020-04-231-1/+1
| | | | | Corrected several small details: added 'const', adjusts in tabs x spaces, removed unused #includes and #defines, misspellings, etc.
* DetailsRoberto Ierusalimschy2020-02-271-13/+15
| | | | | Several details in code (e.g., moving a variable to the most inner scope that encloses its uses), comments, parameter names, extra tests.
* 'l_mathlim' renamed to 'l_floatatt'Roberto Ierusalimschy2019-12-051-1/+1
| | | | That macro is applied to float attributes, not to limits.
* Added macro 'luaL_pushfail'Roberto Ierusalimschy2019-08-161-2/+2
| | | | | | | | The macro 'luaL_pushfail' documents all places in the standard libraries that return nil to signal some kind of failure. It is defined as 'lua_pushnil'. The manual also got a notation (@fail) to document those returns. The tests were changed to be agnostic regarding whether 'fail' is 'nil' or 'false'.
* 'math.randomseed' always returns the two seed componentsRoberto Ierusalimschy2019-07-191-7/+7
|
* 'math.randomseed()' returns the seeds it usedRoberto Ierusalimschy2019-07-171-2/+7
| | | | | A call to 'math.randomseed()' returns the two components of the seed it set, so that they can be used to set that same seed again.
* Define LUA_MAXUNSIGNED as a preprocessor constantRoberto Ierusalimschy2019-05-141-2/+2
| | | | | The previous definition of LUA_MAXUNSIGNED used a typecast, making it unsuitable for constant expressions in the preprocessor.
* A few changes in tests about number of bits in integersRoberto Ierusalimschy2019-05-131-4/+4
| | | | | | - The preprocessor must work with at least 'long', and therefore must do shifts of up to 31 bits correctly. - Whenever possible, use unsigned types in shifts.
* 'math.randomseed()' sets a somewhat random seedRoberto Ierusalimschy2019-03-131-10/+21
| | | | | | When called with no arguments, 'math.randomseed' uses time and ASLR to generate a somewhat random seed. the initial seed when Lua starts is generated this way.
* 'math.rand()' uses higher bits to produce float valueRoberto Ierusalimschy2018-12-111-20/+38
| | | | | | | The call 'math.rand()' converts the higher bits of the internal unsigned integer random to a float, instead of its lower bits. That ensures that Lua compiled with different float precisions always generates equal (up to the available precision) random numbers when given the same seed.
* Removed extra information from RCS keyword stringsRoberto Ierusalimschy2018-08-231-1/+1
| | | | | Version numbers and dates (mostly wrong) from RCS keyword strings removed from all source files; only the file name are kept.
* type 'Rand64' may not be long long, so it should not use 'LL' in itsRoberto Ierusalimschy2018-06-141-4/+5
| | | | constants
* using some weak "randomness" (time and memory address) to initializeRoberto Ierusalimschy2018-05-161-10/+21
| | | | seeds for the PRNG
* correction on xoshiro256** algorithmRoberto Ierusalimschy2018-05-091-3/+3
| | | | (should use state[1] instead of state[0] for output)
* reorganization of '#if's for sellecting a type for 'Rand64' +Roberto Ierusalimschy2018-05-041-31/+56
| | | | comments
* detail (trim constants are unsigned)Roberto Ierusalimschy2018-04-061-3/+3
|
* PRNG changed from 'xoroshiro128+' to 'xoshiro256**' + "I' renamed 'Rand64'Roberto Ierusalimschy2018-04-061-73/+109
| | | | + implementation can use integer types larger than 64 (or 32) bits
* using 'xoroshiro128+' for PRNGRoberto Ierusalimschy2018-04-041-87/+88
| | | | (plus a rotate at the final result to have better lower bits)
* in 'random', uses high-order bits instead of low-orderRoberto Ierusalimschy2018-03-261-49/+68
| | | | (better statistical properties)
* in random/'project', remove the special case for "small" intervals;Roberto Ierusalimschy2018-03-221-24/+15
| | | | it is slower than the general case.
* avoid functions named 'pack'Roberto Ierusalimschy2018-03-161-7/+7
| | | | (name too common, may collide when doing 'onelua.c')
* 'lu_int32' may not be 'int'Roberto Ierusalimschy2018-03-121-10/+13
|
* more explicit casts when converting an integer to a random floatRoberto Ierusalimschy2018-03-111-3/+5
| | | | (to ensure computations are done with all bits)
* random floats of different sizes get exactly needed number of random bitsRoberto Ierusalimschy2018-03-091-30/+58
| | | | (up to 64)
* slight simplification in 'xorshift128plus'Roberto Ierusalimschy2018-03-091-9/+11
|
* fairer projection of random integers into an integer intervalRoberto Ierusalimschy2018-03-091-15/+54
|
* 'math.random' using the xorshift128+ algorithmRoberto Ierusalimschy2018-03-051-36/+195
|
* detail (removing spaces at end of lines)Roberto Ierusalimschy2016-12-221-4/+4
|
* Using LUAI_UAC* types more consistently on vararg callsRoberto Ierusalimschy2016-12-201-4/+7
|
* detail (ensure subtraction is done unsigned)Roberto Ierusalimschy2015-10-021-2/+2
|
* tiny bug: 'randomseed' was calling 'rand' (instead of 'l_rand')Roberto Ierusalimschy2015-06-261-2/+2
| | | | to discard first value
* use 'log2' when availableRoberto Ierusalimschy2015-03-121-1/+4
|
* bug: 'random' limit is 2^31-1, not RAND_MAXRoberto Ierusalimschy2014-12-271-3/+5
|
* cleaner test for overflow for range of 'math.random'Roberto Ierusalimschy2014-11-071-3/+3
|
* added include for 'lprefix.h', for stuff that must be added beforeRoberto Ierusalimschy2014-11-021-4/+6
| | | | any other header file
* 'lua_numtointeger' -> 'lua_numbertointeger'Roberto Ierusalimschy2014-10-241-2/+2
|
* added some casts for the cases when lua_Number != doubleRoberto Ierusalimschy2014-10-081-6/+6
|
* deprecated "cast macros" ('luaL_checkint', 'luaL_optint', etc.)Roberto Ierusalimschy2014-10-011-2/+2
|
* new function 'math.ult' (unsigned less than)Roberto Ierusalimschy2014-07-281-1/+10
|
* new conversion float->integer: conversion is valid only whenRoberto Ierusalimschy2014-07-171-20/+21
| | | | float has an exact representation as an integer
* detail (added placeholders for non-function fields to preallocateRoberto Ierusalimschy2014-07-161-1/+6
| | | | space for them)
* detail (typos in comments)Roberto Ierusalimschy2014-06-301-3/+3
|
* unsigned-manipulation functions (lua_puhsunsigned, lua_tounsigned, etc.)Roberto Ierusalimschy2014-06-261-2/+2
| | | | deprecated
* 'math.ifloor' is backRoberto Ierusalimschy2014-06-181-1/+15
|
* 'math.mof' works with integers, tooRoberto Ierusalimschy2014-06-021-12/+24
|
* no more 'math.ifloor' + new semantics for 'math.floor'/'math.ceil'Roberto Ierusalimschy2014-05-261-14/+18
|
* several functions deprecated (cosh, sinh, atanh, pow, frexp, ldexp)Roberto Ierusalimschy2014-05-141-66/+72
|
* 'math.fmod' handles integers as integersRoberto Ierusalimschy2014-05-021-4/+14
|