#include "lprefix.h"
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
Go to the source code of this file.
Classes | |
struct | Rand64 |
struct | RanState |
Macros | |
#define | lmathlib_c |
#define | LUA_LIB |
#define | PI (l_mathop(3.141592653589793238462643383279502884)) |
#define | FIGS l_floatatt(MANT_DIG) |
#define | trim32(x) ((x) & 0xffffffffu) |
#define | UONE ((lu_int32)1) |
#define | scaleFIG (l_mathop(0.5) / (UONE << (FIGS - 1))) |
Typedefs | |
typedef unsigned long | lu_int32 |
typedef struct Rand64 | Rand64 |
Variables | |
static const luaL_Reg | randfuncs [] |
static const luaL_Reg | mathlib [] |
#define FIGS l_floatatt(MANT_DIG) |
Definition at line 252 of file lmathlib.cpp.
Referenced by I2d().
#define lmathlib_c |
Definition at line 7 of file lmathlib.cpp.
#define LUA_LIB |
Definition at line 8 of file lmathlib.cpp.
#define PI (l_mathop(3.141592653589793238462643383279502884)) |
Definition at line 26 of file lmathlib.cpp.
Referenced by luaopen_math(), math_deg(), and math_rad().
Definition at line 460 of file lmathlib.cpp.
Referenced by I2d().
#define trim32 | ( | x | ) | ((x) & 0xffffffffu) |
#define UONE ((lu_int32)1) |
Definition at line 454 of file lmathlib.cpp.
typedef unsigned long lu_int32 |
Definition at line 353 of file lmathlib.cpp.
|
static |
Definition at line 466 of file lmathlib.cpp.
References FIGS, Rand64::h, Rand64::l, scaleFIG, and trim32.
Referenced by math_random().
|
static |
Definition at line 501 of file lmathlib.cpp.
References Rand64::h, Rand64::l, and trim32.
Referenced by math_random(), and project().
|
static |
Definition at line 389 of file lmathlib.cpp.
References Rand64::h, Rand64::l, lua_assert, packI(), and trim32.
Referenced by nextrand(), times5(), and times9().
Definition at line 395 of file lmathlib.cpp.
References Rand64::h, and Rand64::l.
Referenced by nextrand().
LUAMOD_API int luaopen_math | ( | lua_State * | L | ) |
Definition at line 750 of file lmathlib.cpp.
References lua_pushinteger(), lua_pushnumber(), lua_setfield(), luaL_newlib, PI, and setrandfunc().
Referenced by lua_kernel_base::lua_kernel_base().
|
static |
Definition at line 29 of file lmathlib.cpp.
References l_mathop, lua_isinteger(), lua_pushinteger(), lua_pushnumber(), lua_tointeger, luaL_checknumber(), and n.
|
static |
Definition at line 60 of file lmathlib.cpp.
References l_mathop, lua_pushnumber(), and luaL_checknumber().
|
static |
Definition at line 55 of file lmathlib.cpp.
References l_mathop, lua_pushnumber(), and luaL_checknumber().
|
static |
Definition at line 65 of file lmathlib.cpp.
References l_mathop, lua_pushnumber(), luaL_checknumber(), and luaL_optnumber().
|
static |
Definition at line 106 of file lmathlib.cpp.
References d, l_mathop, lua_isinteger(), lua_settop(), luaL_checknumber(), and pushnumint().
|
static |
Definition at line 45 of file lmathlib.cpp.
References l_mathop, lua_pushnumber(), and luaL_checknumber().
|
static |
Definition at line 194 of file lmathlib.cpp.
References l_mathop, lua_pushnumber(), luaL_checknumber(), and PI.
|
static |
Definition at line 189 of file lmathlib.cpp.
References l_mathop, lua_pushnumber(), and luaL_checknumber().
|
static |
Definition at line 95 of file lmathlib.cpp.
References d, l_mathop, lua_isinteger(), lua_settop(), luaL_checknumber(), and pushnumint().
|
static |
Definition at line 117 of file lmathlib.cpp.
References d, l_mathop, lua_isinteger(), lua_pushinteger(), lua_pushnumber(), lua_tointeger, luaL_argcheck, and luaL_checknumber().
|
static |
Definition at line 169 of file lmathlib.cpp.
References l_mathop, lua_isnoneornil, lua_pushnumber(), and luaL_checknumber().
|
static |
Definition at line 219 of file lmathlib.cpp.
References i, lua_compare(), lua_gettop(), LUA_OPLT, lua_pushvalue(), luaL_argcheck, and n.
|
static |
Definition at line 205 of file lmathlib.cpp.
References i, lua_compare(), lua_gettop(), LUA_OPLT, lua_pushvalue(), luaL_argcheck, and n.
|
static |
Definition at line 139 of file lmathlib.cpp.
References l_mathop, lua_isinteger(), lua_pushnumber(), lua_settop(), luaL_checknumber(), n, and pushnumint().
|
static |
Definition at line 199 of file lmathlib.cpp.
References l_mathop, lua_pushnumber(), luaL_checknumber(), and PI.
|
static |
Definition at line 556 of file lmathlib.cpp.
References I2d(), I2UInt(), lua_gettop(), lua_pushinteger(), lua_pushnumber(), lua_touserdata(), lua_upvalueindex, luaL_argcheck, luaL_checkinteger(), luaL_error(), nextrand(), p, project(), and RanState::s.
|
static |
Definition at line 617 of file lmathlib.cpp.
References lua_isnone, lua_touserdata(), lua_upvalueindex, luaL_checkinteger(), luaL_optinteger(), randseed(), RanState::s, and setseed().
|
static |
Definition at line 40 of file lmathlib.cpp.
References l_mathop, lua_pushnumber(), and luaL_checknumber().
|
static |
Definition at line 156 of file lmathlib.cpp.
References l_mathop, lua_pushnumber(), and luaL_checknumber().
|
static |
Definition at line 50 of file lmathlib.cpp.
References l_mathop, lua_pushnumber(), and luaL_checknumber().
|
static |
Definition at line 73 of file lmathlib.cpp.
References lua_pushinteger(), lua_tointegerx(), luaL_checkany(), luaL_pushfail, and n.
|
static |
Definition at line 233 of file lmathlib.cpp.
References lua_isinteger(), lua_pushstring(), LUA_TNUMBER, lua_type(), luaL_checkany(), and luaL_pushfail.
|
static |
Definition at line 162 of file lmathlib.cpp.
References a, b, lua_pushboolean(), and luaL_checkinteger().
|
static |
Definition at line 531 of file lmathlib.cpp.
References I2UInt(), lua_assert, n, nextrand(), and RanState::s.
Referenced by math_random().
|
static |
Definition at line 86 of file lmathlib.cpp.
References lua_numbertointeger, lua_pushinteger(), lua_pushnumber(), and n.
Referenced by math_ceil(), math_floor(), and math_modf().
Definition at line 610 of file lmathlib.cpp.
References RanState::s, and setseed().
Referenced by math_randomseed(), and setrandfunc().
Definition at line 419 of file lmathlib.cpp.
References Rand64::h, Rand64::l, lua_assert, packI(), and trim32.
Referenced by nextrand().
Definition at line 426 of file lmathlib.cpp.
References Rand64::h, Rand64::l, lua_assert, n, packI(), and trim32.
Referenced by nextrand().
|
static |
Definition at line 641 of file lmathlib.cpp.
References e, l_mathop, lua_newuserdatauv(), lua_pop, lua_pushinteger(), lua_pushnumber(), luaL_checkinteger(), luaL_checknumber(), luaL_setfuncs(), and randseed().
Referenced by luaopen_math().
|
static |
Definition at line 591 of file lmathlib.cpp.
References i, Int2I(), lua_pushinteger(), and nextrand().
Referenced by math_randomseed(), and randseed().
Definition at line 409 of file lmathlib.cpp.
References Iadd(), and Ishl().
Referenced by nextrand().
Definition at line 414 of file lmathlib.cpp.
References Iadd(), and Ishl().
Referenced by nextrand().
|
static |
Definition at line 704 of file lmathlib.cpp.
|
static |
Definition at line 631 of file lmathlib.cpp.