aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lmathlib.c16
-rw-r--r--manual.tex10
2 files changed, 20 insertions, 6 deletions
diff --git a/lmathlib.c b/lmathlib.c
index ad462535..8b8babaa 100644
--- a/lmathlib.c
+++ b/lmathlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lmathlib.c,v 1.7 1997/12/09 13:35:19 roberto Exp roberto $ 2** $Id: lmathlib.c,v 1.8 1997/12/26 18:36:31 roberto Exp roberto $
3** Lua standard mathematical library 3** Lua standard mathematical library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -115,6 +115,16 @@ static void math_rad (void)
115 lua_pushnumber(luaL_check_number(1)*(PI/180.0)); 115 lua_pushnumber(luaL_check_number(1)*(PI/180.0));
116} 116}
117 117
118static void math_frexp (void) {
119 int e;
120 lua_pushnumber(frexp(luaL_check_number(1), &e));
121 lua_pushnumber(e);
122}
123
124static void math_ldexp (void) {
125 lua_pushnumber(ldexp(luaL_check_number(1), luaL_check_number(2)));
126}
127
118 128
119 129
120static void math_min (void) 130static void math_min (void)
@@ -170,10 +180,12 @@ static struct luaL_reg mathlib[] = {
170{"asin", math_asin}, 180{"asin", math_asin},
171{"acos", math_acos}, 181{"acos", math_acos},
172{"atan", math_atan}, 182{"atan", math_atan},
173{"atan2", math_atan2}, 183{"atan2", math_atan2},
174{"ceil", math_ceil}, 184{"ceil", math_ceil},
175{"floor", math_floor}, 185{"floor", math_floor},
176{"mod", math_mod}, 186{"mod", math_mod},
187{"frexp", math_frexp},
188{"ldexp", math_ldexp},
177{"sqrt", math_sqrt}, 189{"sqrt", math_sqrt},
178{"min", math_min}, 190{"min", math_min},
179{"max", math_max}, 191{"max", math_max},
diff --git a/manual.tex b/manual.tex
index eaf85fac..041590c4 100644
--- a/manual.tex
+++ b/manual.tex
@@ -1,4 +1,4 @@
1% $Id: manual.tex,v 1.9 1998/05/18 22:26:03 roberto Exp roberto $ 1% $Id: manual.tex,v 1.10 1998/05/20 22:21:35 roberto Exp roberto $
2 2
3\documentstyle[fullpage,11pt,bnf]{article} 3\documentstyle[fullpage,11pt,bnf]{article}
4 4
@@ -38,7 +38,7 @@ Waldemar Celes
38\tecgraf\ --- Computer Science Department --- PUC-Rio 38\tecgraf\ --- Computer Science Department --- PUC-Rio
39} 39}
40 40
41\date{\small \verb$Date: 1998/05/18 22:26:03 $} 41\date{\small \verb$Date: 1998/05/20 22:21:35 $}
42 42
43\maketitle 43\maketitle
44 44
@@ -2398,10 +2398,12 @@ The library provides the following functions:
2398\Deffunc{atan2}\Deffunc{ceil}\Deffunc{cos}\Deffunc{floor} 2398\Deffunc{atan2}\Deffunc{ceil}\Deffunc{cos}\Deffunc{floor}
2399\Deffunc{log}\Deffunc{log10}\Deffunc{max}\Deffunc{min} 2399\Deffunc{log}\Deffunc{log10}\Deffunc{max}\Deffunc{min}
2400\Deffunc{mod}\Deffunc{sin}\Deffunc{sqrt}\Deffunc{tan} 2400\Deffunc{mod}\Deffunc{sin}\Deffunc{sqrt}\Deffunc{tan}
2401\Deffunc{frexp}\Deffunc{ldexp}
2401\Deffunc{random}\Deffunc{randomseed} 2402\Deffunc{random}\Deffunc{randomseed}
2402\begin{verbatim} 2403\begin{verbatim}
2403abs acos asin atan atan2 ceil cos deg floor log log10 2404abs acos asin atan atan2 ceil cos deg floor log log10
2404max min mod rad sin sqrt tan random randomseed 2405max min mod rad sin sqrt tan frexp ldexp
2406random randomseed
2405\end{verbatim} 2407\end{verbatim}
2406plus a global variable \IndexVerb{PI}. 2408plus a global variable \IndexVerb{PI}.
2407Most of them 2409Most of them