Classes | Macros | Typedefs | Functions | Variables
lmathlib.c File Reference
#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"
Include dependency graph for lmathlib.c:

Go to the source code of this file.

Classes

struct  Rand64
 
struct  RanState
 

Macros

#define FIGS   l_floatatt(MANT_DIG)
 
#define lmathlib_c
 
#define LUA_LIB
 
#define PI   (l_mathop(3.141592653589793238462643383279502884))
 
#define scaleFIG   (l_mathop(0.5) / (UONE << (FIGS - 1)))
 
#define trim32(x)   ((x) & 0xffffffffu)
 
#define UONE   ((lu_int32)1)
 

Typedefs

typedef unsigned long lu_int32
 
typedef struct Rand64 Rand64
 

Functions

static lua_Number I2d (Rand64 x)
 
static lua_Unsigned I2UInt (Rand64 x)
 
static Rand64 Iadd (Rand64 i1, Rand64 i2)
 
static Rand64 Int2I (lua_Unsigned n)
 
static Rand64 Ishl (Rand64 i, int n)
 
static void Ixor (Rand64 *i1, Rand64 i2)
 
LUAMOD_API int luaopen_math (lua_State *L)
 
static int math_abs (lua_State *L)
 
static int math_acos (lua_State *L)
 
static int math_asin (lua_State *L)
 
static int math_atan (lua_State *L)
 
static int math_ceil (lua_State *L)
 
static int math_cos (lua_State *L)
 
static int math_deg (lua_State *L)
 
static int math_exp (lua_State *L)
 
static int math_floor (lua_State *L)
 
static int math_fmod (lua_State *L)
 
static int math_log (lua_State *L)
 
static int math_max (lua_State *L)
 
static int math_min (lua_State *L)
 
static int math_modf (lua_State *L)
 
static int math_rad (lua_State *L)
 
static int math_random (lua_State *L)
 
static int math_randomseed (lua_State *L)
 
static int math_sin (lua_State *L)
 
static int math_sqrt (lua_State *L)
 
static int math_tan (lua_State *L)
 
static int math_toint (lua_State *L)
 
static int math_type (lua_State *L)
 
static int math_ult (lua_State *L)
 
static Rand64 nextrand (Rand64 *state)
 
static Rand64 packI (lu_int32 h, lu_int32 l)
 
static lua_Unsigned project (lua_Unsigned ran, lua_Unsigned n, RanState *state)
 
static void pushnumint (lua_State *L, lua_Number d)
 
static void randseed (lua_State *L, RanState *state)
 
static Rand64 rotl (Rand64 i, int n)
 
static Rand64 rotl1 (Rand64 i, int n)
 
static void setrandfunc (lua_State *L)
 
static void setseed (lua_State *L, Rand64 *state, lua_Unsigned n1, lua_Unsigned n2)
 
static Rand64 times5 (Rand64 i)
 
static Rand64 times9 (Rand64 i)
 

Variables

static const luaL_Reg mathlib []
 
static const luaL_Reg randfuncs []
 

Macro Definition Documentation

◆ FIGS

#define FIGS   l_floatatt(MANT_DIG)

Definition at line 253 of file lmathlib.c.

◆ lmathlib_c

#define lmathlib_c

Definition at line 7 of file lmathlib.c.

◆ LUA_LIB

#define LUA_LIB

Definition at line 8 of file lmathlib.c.

◆ PI

#define PI   (l_mathop(3.141592653589793238462643383279502884))

Definition at line 26 of file lmathlib.c.

◆ scaleFIG

#define scaleFIG   (l_mathop(0.5) / (UONE << (FIGS - 1)))

Definition at line 461 of file lmathlib.c.

◆ trim32

#define trim32 (   x)    ((x) & 0xffffffffu)

Definition at line 374 of file lmathlib.c.

◆ UONE

#define UONE   ((lu_int32)1)

Definition at line 455 of file lmathlib.c.

Typedef Documentation

◆ lu_int32

typedef unsigned long lu_int32

Definition at line 354 of file lmathlib.c.

◆ Rand64

typedef struct Rand64 Rand64

Function Documentation

◆ I2d()

static lua_Number I2d ( Rand64  x)
static

Definition at line 467 of file lmathlib.c.

◆ I2UInt()

static lua_Unsigned I2UInt ( Rand64  x)
static

Definition at line 502 of file lmathlib.c.

◆ Iadd()

static Rand64 Iadd ( Rand64  i1,
Rand64  i2 
)
static

Definition at line 402 of file lmathlib.c.

◆ Int2I()

static Rand64 Int2I ( lua_Unsigned  n)
static

Definition at line 507 of file lmathlib.c.

◆ Ishl()

static Rand64 Ishl ( Rand64  i,
int  n 
)
static

Definition at line 390 of file lmathlib.c.

◆ Ixor()

static void Ixor ( Rand64 i1,
Rand64  i2 
)
static

Definition at line 396 of file lmathlib.c.

◆ luaopen_math()

LUAMOD_API int luaopen_math ( lua_State L)

Definition at line 751 of file lmathlib.c.

◆ math_abs()

static int math_abs ( lua_State L)
static

Definition at line 29 of file lmathlib.c.

◆ math_acos()

static int math_acos ( lua_State L)
static

Definition at line 60 of file lmathlib.c.

◆ math_asin()

static int math_asin ( lua_State L)
static

Definition at line 55 of file lmathlib.c.

◆ math_atan()

static int math_atan ( lua_State L)
static

Definition at line 65 of file lmathlib.c.

◆ math_ceil()

static int math_ceil ( lua_State L)
static

Definition at line 106 of file lmathlib.c.

◆ math_cos()

static int math_cos ( lua_State L)
static

Definition at line 45 of file lmathlib.c.

◆ math_deg()

static int math_deg ( lua_State L)
static

Definition at line 195 of file lmathlib.c.

◆ math_exp()

static int math_exp ( lua_State L)
static

Definition at line 190 of file lmathlib.c.

◆ math_floor()

static int math_floor ( lua_State L)
static

Definition at line 95 of file lmathlib.c.

◆ math_fmod()

static int math_fmod ( lua_State L)
static

Definition at line 117 of file lmathlib.c.

◆ math_log()

static int math_log ( lua_State L)
static

Definition at line 169 of file lmathlib.c.

◆ math_max()

static int math_max ( lua_State L)
static

Definition at line 220 of file lmathlib.c.

◆ math_min()

static int math_min ( lua_State L)
static

Definition at line 206 of file lmathlib.c.

◆ math_modf()

static int math_modf ( lua_State L)
static

Definition at line 139 of file lmathlib.c.

◆ math_rad()

static int math_rad ( lua_State L)
static

Definition at line 200 of file lmathlib.c.

◆ math_random()

static int math_random ( lua_State L)
static

Definition at line 557 of file lmathlib.c.

◆ math_randomseed()

static int math_randomseed ( lua_State L)
static

Definition at line 618 of file lmathlib.c.

◆ math_sin()

static int math_sin ( lua_State L)
static

Definition at line 40 of file lmathlib.c.

◆ math_sqrt()

static int math_sqrt ( lua_State L)
static

Definition at line 156 of file lmathlib.c.

◆ math_tan()

static int math_tan ( lua_State L)
static

Definition at line 50 of file lmathlib.c.

◆ math_toint()

static int math_toint ( lua_State L)
static

Definition at line 73 of file lmathlib.c.

◆ math_type()

static int math_type ( lua_State L)
static

Definition at line 234 of file lmathlib.c.

◆ math_ult()

static int math_ult ( lua_State L)
static

Definition at line 162 of file lmathlib.c.

◆ nextrand()

static Rand64 nextrand ( Rand64 state)
static

Definition at line 437 of file lmathlib.c.

◆ packI()

static Rand64 packI ( lu_int32  h,
lu_int32  l 
)
static

Definition at line 382 of file lmathlib.c.

◆ project()

static lua_Unsigned project ( lua_Unsigned  ran,
lua_Unsigned  n,
RanState state 
)
static

Definition at line 532 of file lmathlib.c.

◆ pushnumint()

static void pushnumint ( lua_State L,
lua_Number  d 
)
static

Definition at line 86 of file lmathlib.c.

◆ randseed()

static void randseed ( lua_State L,
RanState state 
)
static

Definition at line 611 of file lmathlib.c.

◆ rotl()

static Rand64 rotl ( Rand64  i,
int  n 
)
static

Definition at line 420 of file lmathlib.c.

◆ rotl1()

static Rand64 rotl1 ( Rand64  i,
int  n 
)
static

Definition at line 427 of file lmathlib.c.

◆ setrandfunc()

static void setrandfunc ( lua_State L)
static

Definition at line 642 of file lmathlib.c.

◆ setseed()

static void setseed ( lua_State L,
Rand64 state,
lua_Unsigned  n1,
lua_Unsigned  n2 
)
static

Definition at line 592 of file lmathlib.c.

◆ times5()

static Rand64 times5 ( Rand64  i)
static

Definition at line 410 of file lmathlib.c.

◆ times9()

static Rand64 times9 ( Rand64  i)
static

Definition at line 415 of file lmathlib.c.

Variable Documentation

◆ mathlib

const luaL_Reg mathlib[]
static

Definition at line 705 of file lmathlib.c.

◆ randfuncs

const luaL_Reg randfuncs[]
static
Initial value:
= {
{"random", math_random},
{"randomseed", math_randomseed},
{NULL, NULL}
}

Definition at line 632 of file lmathlib.c.

math_randomseed
static int math_randomseed(lua_State *L)
Definition: lmathlib.c:618
math_random
static int math_random(lua_State *L)
Definition: lmathlib.c:557


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Aug 11 2024 02:24:27