mirror of https://github.com/rusefi/lua.git
new functions "frexp" and "ldexp"
This commit is contained in:
parent
7e59a8901d
commit
74719afc33
16
lmathlib.c
16
lmathlib.c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: lmathlib.c,v 1.7 1997/12/09 13:35:19 roberto Exp roberto $
|
** $Id: lmathlib.c,v 1.8 1997/12/26 18:36:31 roberto Exp roberto $
|
||||||
** Lua standard mathematical library
|
** Lua standard mathematical library
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -115,6 +115,16 @@ static void math_rad (void)
|
||||||
lua_pushnumber(luaL_check_number(1)*(PI/180.0));
|
lua_pushnumber(luaL_check_number(1)*(PI/180.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void math_frexp (void) {
|
||||||
|
int e;
|
||||||
|
lua_pushnumber(frexp(luaL_check_number(1), &e));
|
||||||
|
lua_pushnumber(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void math_ldexp (void) {
|
||||||
|
lua_pushnumber(ldexp(luaL_check_number(1), luaL_check_number(2)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void math_min (void)
|
static void math_min (void)
|
||||||
|
@ -170,10 +180,12 @@ static struct luaL_reg mathlib[] = {
|
||||||
{"asin", math_asin},
|
{"asin", math_asin},
|
||||||
{"acos", math_acos},
|
{"acos", math_acos},
|
||||||
{"atan", math_atan},
|
{"atan", math_atan},
|
||||||
{"atan2", math_atan2},
|
{"atan2", math_atan2},
|
||||||
{"ceil", math_ceil},
|
{"ceil", math_ceil},
|
||||||
{"floor", math_floor},
|
{"floor", math_floor},
|
||||||
{"mod", math_mod},
|
{"mod", math_mod},
|
||||||
|
{"frexp", math_frexp},
|
||||||
|
{"ldexp", math_ldexp},
|
||||||
{"sqrt", math_sqrt},
|
{"sqrt", math_sqrt},
|
||||||
{"min", math_min},
|
{"min", math_min},
|
||||||
{"max", math_max},
|
{"max", math_max},
|
||||||
|
|
10
manual.tex
10
manual.tex
|
@ -1,4 +1,4 @@
|
||||||
% $Id: manual.tex,v 1.9 1998/05/18 22:26:03 roberto Exp roberto $
|
% $Id: manual.tex,v 1.10 1998/05/20 22:21:35 roberto Exp roberto $
|
||||||
|
|
||||||
\documentstyle[fullpage,11pt,bnf]{article}
|
\documentstyle[fullpage,11pt,bnf]{article}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ Waldemar Celes
|
||||||
\tecgraf\ --- Computer Science Department --- PUC-Rio
|
\tecgraf\ --- Computer Science Department --- PUC-Rio
|
||||||
}
|
}
|
||||||
|
|
||||||
\date{\small \verb$Date: 1998/05/18 22:26:03 $}
|
\date{\small \verb$Date: 1998/05/20 22:21:35 $}
|
||||||
|
|
||||||
\maketitle
|
\maketitle
|
||||||
|
|
||||||
|
@ -2398,10 +2398,12 @@ The library provides the following functions:
|
||||||
\Deffunc{atan2}\Deffunc{ceil}\Deffunc{cos}\Deffunc{floor}
|
\Deffunc{atan2}\Deffunc{ceil}\Deffunc{cos}\Deffunc{floor}
|
||||||
\Deffunc{log}\Deffunc{log10}\Deffunc{max}\Deffunc{min}
|
\Deffunc{log}\Deffunc{log10}\Deffunc{max}\Deffunc{min}
|
||||||
\Deffunc{mod}\Deffunc{sin}\Deffunc{sqrt}\Deffunc{tan}
|
\Deffunc{mod}\Deffunc{sin}\Deffunc{sqrt}\Deffunc{tan}
|
||||||
|
\Deffunc{frexp}\Deffunc{ldexp}
|
||||||
\Deffunc{random}\Deffunc{randomseed}
|
\Deffunc{random}\Deffunc{randomseed}
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
abs acos asin atan atan2 ceil cos deg floor log log10
|
abs acos asin atan atan2 ceil cos deg floor log log10
|
||||||
max min mod rad sin sqrt tan random randomseed
|
max min mod rad sin sqrt tan frexp ldexp
|
||||||
|
random randomseed
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
plus a global variable \IndexVerb{PI}.
|
plus a global variable \IndexVerb{PI}.
|
||||||
Most of them
|
Most of them
|
||||||
|
|
Loading…
Reference in New Issue