Roberto Ierusalimschy
0ddc0f47bd
Several details about 5.4.0 rc1
Corrected several small details: added 'const', adjusts in tabs x
spaces, removed unused #includes and #defines, misspellings, etc.
5 years ago
Roberto Ierusalimschy
6eb53b7526
Details
Several details in code (e.g., moving a variable to the most inner
scope that encloses its uses), comments, parameter names, extra tests.
5 years ago
Roberto Ierusalimschy
2d92102dee
'l_mathlim' renamed to 'l_floatatt'
That macro is applied to float attributes, not to limits.
5 years ago
Roberto Ierusalimschy
b96b0b5abb
Added macro 'luaL_pushfail'
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'.
5 years ago
Roberto Ierusalimschy
2f22c6bb79
'math.randomseed' always returns the two seed components
5 years ago
Roberto Ierusalimschy
4eefef07ab
'math.randomseed()' returns the seeds it used
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.
5 years ago
Roberto Ierusalimschy
347d6961ac
Define LUA_MAXUNSIGNED as a preprocessor constant
The previous definition of LUA_MAXUNSIGNED used a typecast,
making it unsuitable for constant expressions in the preprocessor.
6 years ago
Roberto Ierusalimschy
279c3a6961
A few changes in tests about number of bits in integers
- 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.
6 years ago
Roberto Ierusalimschy
9eca305e75
'math.randomseed()' sets a somewhat random seed
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.
6 years ago
Roberto Ierusalimschy
51316f9df7
'math.rand()' uses higher bits to produce float value
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.
6 years ago
Roberto Ierusalimschy
f99509581e
Removed extra information from RCS keyword strings
Version numbers and dates (mostly wrong) from RCS keyword strings
removed from all source files; only the file name are kept.
6 years ago
Roberto Ierusalimschy
aedcfb9414
type 'Rand64' may not be long long, so it should not use 'LL' in its
constants
6 years ago
Roberto Ierusalimschy
de53c2ec7e
using some weak "randomness" (time and memory address) to initialize
seeds for the PRNG
7 years ago
Roberto Ierusalimschy
80bd4a8940
correction on xoshiro256** algorithm
(should use state[1] instead of state[0] for output)
7 years ago
Roberto Ierusalimschy
3e7415e846
reorganization of '#if's for sellecting a type for 'Rand64' +
comments
7 years ago
Roberto Ierusalimschy
762baf0548
detail (trim constants are unsigned)
7 years ago
Roberto Ierusalimschy
b8a04658b2
PRNG changed from 'xoroshiro128+' to 'xoshiro256**' + "I' renamed 'Rand64'
+ implementation can use integer types larger than 64 (or 32) bits
7 years ago
Roberto Ierusalimschy
b44787652b
using 'xoroshiro128+' for PRNG
(plus a rotate at the final result to have better lower bits)
7 years ago
Roberto Ierusalimschy
bdd10a08b1
in 'random', uses high-order bits instead of low-order
(better statistical properties)
7 years ago
Roberto Ierusalimschy
c5e3b2f814
in random/'project', remove the special case for "small" intervals;
it is slower than the general case.
7 years ago
Roberto Ierusalimschy
89da4168df
avoid functions named 'pack'
(name too common, may collide when doing 'onelua.c')
7 years ago
Roberto Ierusalimschy
6b01b6cf6a
'lu_int32' may not be 'int'
7 years ago
Roberto Ierusalimschy
e3388ebfad
more explicit casts when converting an integer to a random float
(to ensure computations are done with all bits)
7 years ago
Roberto Ierusalimschy
dbec41f34c
random floats of different sizes get exactly needed number of random bits
(up to 64)
7 years ago
Roberto Ierusalimschy
0b3db69e41
slight simplification in 'xorshift128plus'
7 years ago
Roberto Ierusalimschy
80ae1c1c16
fairer projection of random integers into an integer interval
7 years ago
Roberto Ierusalimschy
66b7b075a6
'math.random' using the xorshift128+ algorithm
7 years ago
Roberto Ierusalimschy
2a235312f0
detail (removing spaces at end of lines)
8 years ago
Roberto Ierusalimschy
9903dd52a3
Using LUAI_UAC* types more consistently on vararg calls
8 years ago
Roberto Ierusalimschy
dc4232379d
detail (ensure subtraction is done unsigned)
9 years ago
Roberto Ierusalimschy
be63d995c1
tiny bug: 'randomseed' was calling 'rand' (instead of 'l_rand')
to discard first value
10 years ago
Roberto Ierusalimschy
7d930ec694
use 'log2' when available
10 years ago
Roberto Ierusalimschy
1a7868c1d5
bug: 'random' limit is 2^31-1, not RAND_MAX
10 years ago
Roberto Ierusalimschy
17ca3b1763
cleaner test for overflow for range of 'math.random'
10 years ago
Roberto Ierusalimschy
28fdbcf393
added include for 'lprefix.h', for stuff that must be added before
any other header file
10 years ago
Roberto Ierusalimschy
463edee2fd
'lua_numtointeger' -> 'lua_numbertointeger'
10 years ago
Roberto Ierusalimschy
65ec3379b1
added some casts for the cases when lua_Number != double
10 years ago
Roberto Ierusalimschy
798660c9cd
deprecated "cast macros" ('luaL_checkint', 'luaL_optint', etc.)
10 years ago
Roberto Ierusalimschy
925d1b59f9
new function 'math.ult' (unsigned less than)
10 years ago
Roberto Ierusalimschy
8bb272a3e3
new conversion float->integer: conversion is valid only when
float has an exact representation as an integer
10 years ago
Roberto Ierusalimschy
f14662fca6
detail (added placeholders for non-function fields to preallocate
space for them)
10 years ago
Roberto Ierusalimschy
b9dcf9974d
detail (typos in comments)
11 years ago
Roberto Ierusalimschy
a77d263e86
unsigned-manipulation functions (lua_puhsunsigned, lua_tounsigned, etc.)
deprecated
11 years ago
Roberto Ierusalimschy
e3871abe95
'math.ifloor' is back
11 years ago
Roberto Ierusalimschy
355037528c
'math.mof' works with integers, too
11 years ago
Roberto Ierusalimschy
456806f25c
no more 'math.ifloor' + new semantics for 'math.floor'/'math.ceil'
11 years ago
Roberto Ierusalimschy
8b66040e34
several functions deprecated (cosh, sinh, atanh, pow, frexp, ldexp)
11 years ago
Roberto Ierusalimschy
6d5324f92f
'math.fmod' handles integers as integers
11 years ago
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)
11 years ago
Roberto Ierusalimschy
5336cc9d6a
math.random: use 'random' when available + changes to work correctly
for any integer interval (up to [minint,maxint])
11 years ago