The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Macros | Functions | Variables
lmathlib.cpp File Reference
#include <stdlib.h>
#include <math.h>
#include <boost/math/constants/constants.hpp>
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
Include dependency graph for lmathlib.cpp:

Go to the source code of this file.

Macros

#define lmathlib_c
 
#define LUA_LIB
 
#define RADIANS_PER_DEGREE   ( boost::math::constants::pi<lua_Number>()/180.0 )
 

Functions

static int math_abs (lua_State *L)
 
static int math_sin (lua_State *L)
 
static int math_sinh (lua_State *L)
 
static int math_cos (lua_State *L)
 
static int math_cosh (lua_State *L)
 
static int math_tan (lua_State *L)
 
static int math_tanh (lua_State *L)
 
static int math_asin (lua_State *L)
 
static int math_acos (lua_State *L)
 
static int math_atan (lua_State *L)
 
static int math_atan2 (lua_State *L)
 
static int math_ceil (lua_State *L)
 
static int math_floor (lua_State *L)
 
static int math_fmod (lua_State *L)
 
static int math_modf (lua_State *L)
 
static int math_sqrt (lua_State *L)
 
static int math_pow (lua_State *L)
 
static int math_log (lua_State *L)
 
static int math_log10 (lua_State *L)
 
static int math_exp (lua_State *L)
 
static int math_deg (lua_State *L)
 
static int math_rad (lua_State *L)
 
static int math_frexp (lua_State *L)
 
static int math_ldexp (lua_State *L)
 
static int math_min (lua_State *L)
 
static int math_max (lua_State *L)
 
static int math_random (lua_State *L)
 
static int math_randomseed (lua_State *L)
 
LUAMOD_API int luaopen_math (lua_State *L)
 

Variables

static const luaL_Reg mathlib []
 

Macro Definition Documentation

#define lmathlib_c

Definition at line 11 of file lmathlib.cpp.

#define LUA_LIB

Definition at line 12 of file lmathlib.cpp.

#define RADIANS_PER_DEGREE   ( boost::math::constants::pi<lua_Number>()/180.0 )

Definition at line 20 of file lmathlib.cpp.

Referenced by math_deg(), and math_rad().

Function Documentation

LUAMOD_API int luaopen_math ( lua_State L)

Definition at line 269 of file lmathlib.cpp.

References lua_pushnumber(), lua_setfield(), and luaL_newlib.

Referenced by lua_kernel_base::lua_kernel_base().

static int math_abs ( lua_State L)
static

Definition at line 24 of file lmathlib.cpp.

References l_mathop, lua_pushnumber(), and luaL_checknumber().

static int math_acos ( lua_State L)
static

Definition at line 64 of file lmathlib.cpp.

References l_mathop, lua_pushnumber(), and luaL_checknumber().

static int math_asin ( lua_State L)
static

Definition at line 59 of file lmathlib.cpp.

References l_mathop, lua_pushnumber(), and luaL_checknumber().

static int math_atan ( lua_State L)
static

Definition at line 69 of file lmathlib.cpp.

References l_mathop, lua_pushnumber(), and luaL_checknumber().

static int math_atan2 ( lua_State L)
static

Definition at line 74 of file lmathlib.cpp.

References l_mathop, lua_pushnumber(), and luaL_checknumber().

static int math_ceil ( lua_State L)
static

Definition at line 80 of file lmathlib.cpp.

References l_mathop, lua_pushnumber(), and luaL_checknumber().

static int math_cos ( lua_State L)
static

Definition at line 39 of file lmathlib.cpp.

References l_mathop, lua_pushnumber(), and luaL_checknumber().

static int math_cosh ( lua_State L)
static

Definition at line 44 of file lmathlib.cpp.

References l_mathop, lua_pushnumber(), and luaL_checknumber().

static int math_deg ( lua_State L)
static

Definition at line 142 of file lmathlib.cpp.

References lua_pushnumber(), luaL_checknumber(), and RADIANS_PER_DEGREE.

static int math_exp ( lua_State L)
static

Definition at line 137 of file lmathlib.cpp.

References l_mathop, lua_pushnumber(), and luaL_checknumber().

static int math_floor ( lua_State L)
static
static int math_fmod ( lua_State L)
static

Definition at line 90 of file lmathlib.cpp.

References l_mathop, lua_pushnumber(), and luaL_checknumber().

static int math_frexp ( lua_State L)
static

Definition at line 152 of file lmathlib.cpp.

References e, l_mathop, lua_pushinteger(), lua_pushnumber(), and luaL_checknumber().

static int math_ldexp ( lua_State L)
static

Definition at line 159 of file lmathlib.cpp.

References l_mathop, lua_pushnumber(), luaL_checkint, and luaL_checknumber().

static int math_log ( lua_State L)
static

Definition at line 116 of file lmathlib.cpp.

References l_mathop, lua_isnoneornil, lua_pushnumber(), and luaL_checknumber().

static int math_log10 ( lua_State L)
static

Definition at line 131 of file lmathlib.cpp.

References l_mathop, lua_pushnumber(), and luaL_checknumber().

static int math_max ( lua_State L)
static

Definition at line 182 of file lmathlib.cpp.

References d, i, lua_gettop(), lua_pushnumber(), and luaL_checknumber().

static int math_min ( lua_State L)
static

Definition at line 168 of file lmathlib.cpp.

References d, i, lua_gettop(), lua_pushnumber(), and luaL_checknumber().

static int math_modf ( lua_State L)
static

Definition at line 96 of file lmathlib.cpp.

References l_mathop, lua_pushnumber(), and luaL_checknumber().

static int math_pow ( lua_State L)
static

Definition at line 109 of file lmathlib.cpp.

References l_mathop, lua_pushnumber(), and luaL_checknumber().

static int math_rad ( lua_State L)
static

Definition at line 147 of file lmathlib.cpp.

References lua_pushnumber(), luaL_checknumber(), and RADIANS_PER_DEGREE.

static int math_random ( lua_State L)
static
static int math_randomseed ( lua_State L)
static

Definition at line 224 of file lmathlib.cpp.

References luaL_checkunsigned().

static int math_sin ( lua_State L)
static

Definition at line 29 of file lmathlib.cpp.

References l_mathop, lua_pushnumber(), and luaL_checknumber().

static int math_sinh ( lua_State L)
static

Definition at line 34 of file lmathlib.cpp.

References l_mathop, lua_pushnumber(), and luaL_checknumber().

static int math_sqrt ( lua_State L)
static

Definition at line 104 of file lmathlib.cpp.

References l_mathop, lua_pushnumber(), and luaL_checknumber().

static int math_tan ( lua_State L)
static

Definition at line 49 of file lmathlib.cpp.

References l_mathop, lua_pushnumber(), and luaL_checknumber().

static int math_tanh ( lua_State L)
static

Definition at line 54 of file lmathlib.cpp.

References l_mathop, lua_pushnumber(), and luaL_checknumber().

Variable Documentation

const luaL_Reg mathlib[]
static

Definition at line 231 of file lmathlib.cpp.