aboutsummaryrefslogtreecommitdiff
path: root/testes/math.lua (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Floats formatted with "correct" precisionRoberto Ierusalimschy2024-08-021-3/+103
| | | | | | Conversion float->string ensures that, for any float f, tonumber(tostring(f)) == f, but still avoiding noise like 1.1 converting to "1.1000000000000001".
* Avoid excessive name pollution in test filesRoberto Ierusalimschy2022-12-281-3/+3
| | | | | Test files are more polite regarding the use of globals when locals would do, and when globals are necessary deleting them after use.
* Detail in 'testes/math.lua'Roberto Ierusalimschy2021-08-181-0/+1
| | | | Added a print with the random seeds used in the tests of 'random'.
* DetailsRoberto Ierusalimschy2020-02-271-0/+4
| | | | | Several details in code (e.g., moving a variable to the most inner scope that encloses its uses), comments, parameter names, extra tests.
* Comments (mosty typos)Roberto Ierusalimschy2019-12-301-1/+1
|
* Added macro 'luaL_pushfail'Roberto Ierusalimschy2019-08-161-50/+50
| | | | | | | | 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'.
* Change in the syntax of attributesRoberto Ierusalimschy2019-07-301-12/+12
| | | | | | | Attributes changed to posfixed ('x <const>', instead of '<const> x'), and "toclose" renamed to "close". Posfixed attributes seem to make it clearer that it applies to only one variable when there are multiple variables.
* 'math.randomseed' always returns the two seed componentsRoberto Ierusalimschy2019-07-191-2/+4
|
* 'math.randomseed()' returns the seeds it usedRoberto Ierusalimschy2019-07-171-2/+9
| | | | | 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.
* First implementation of constant propagationRoberto Ierusalimschy2019-07-121-7/+9
| | | | | Local constant variables initialized with compile-time constants are optimized away from the code.
* First implementation for 'const' variablesRoberto Ierusalimschy2019-05-171-3/+3
| | | | | A variable can be declared const, which means it cannot be assigned to, with the syntax 'local <const> name = exp'.
* 'math.randomseed()' sets a somewhat random seedRoberto Ierusalimschy2019-03-131-1/+1
| | | | | | 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-6/+8
| | | | | | | 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 strings in testsRoberto Ierusalimschy2018-10-221-1/+1
| | | | | Version numbers and dates (mostly wrong) from RCS keyword strings removed from all test files; only the file name are kept.
* Corrections in the implementation of '%' for floats.Roberto Ierusalimschy2018-08-281-1/+65
| | | | | | | | | The multiplication (m*b) used to test whether 'm' is non-zero and 'm' and 'b' have different signs can underflow for very small numbers, giving a wrong result. The use of explicit comparisons solves this problem. This commit also adds several new tests for '%' (both for floats and for integers) to exercise more corner cases, such as very large and very small values.
* Added directory to test file names in '$Id:'Roberto Ierusalimschy2018-07-251-1/+1
| | | | | | | From the point of view of 'git', all names are relative to the root directory of the project. So, file names in '$Id:' also should be relative to that directory: the proper name for test file 'all.lua' is 'testes/all.lua'.
* Fixed bug in OP_IDIVIRoberto Ierusalimschy2018-07-091-1/+12
| | | | | Opocode was using 'luai_numdiv' (float division) instead of 'luai_numidiv' (integer division).
* Added manual and tests for version 5.4-w2Roberto Ierusalimschy2018-07-091-0/+931