diff --git a/src/lib/luamath.pir b/src/lib/luamath.pir index 71f7019..3ff62ae 100644 --- a/src/lib/luamath.pir +++ b/src/lib/luamath.pir @@ -69,6 +69,7 @@ atan atan2 ceil cos +cosh deg exp floor @@ -85,8 +86,10 @@ rad random randomseed sin +sinh sqrt tan +tanh LIST lua_register($P1, _math, $P2) @@ -204,6 +207,16 @@ LIST .end +.sub 'cosh' + .param pmc x :optional + .param pmc extra :slurpy + .local pmc res + lua_checknumber(1, x) + res = x.'cosh'() + .return (res) +.end + + .sub 'deg' .param pmc x :optional .param pmc extra :slurpy @@ -455,6 +468,16 @@ LIST .end +.sub 'sinh' + .param pmc x :optional + .param pmc extra :slurpy + .local pmc res + lua_checknumber(1, x) + res = x.'sinh'() + .return (res) +.end + + .sub 'sqrt' .param pmc x :optional .param pmc extra :slurpy @@ -479,6 +502,16 @@ LIST .end +.sub 'tanh' + .param pmc x :optional + .param pmc extra :slurpy + .local pmc res + lua_checknumber(1, x) + res = x.'tanh'() + .return (res) +.end + + # Local Variables: # mode: pir # fill-column: 100 diff --git a/src/pmc/luanumber.pmc b/src/pmc/luanumber.pmc index 9cc9433..01b9bb6 100644 --- a/src/pmc/luanumber.pmc +++ b/src/pmc/luanumber.pmc @@ -987,6 +987,20 @@ Used to unarchive the number. /* +=item C + +=cut + +*/ + METHOD PMC* cosh() { + const FLOATVAL n = cosh(VTABLE_get_number(INTERP, SELF)); + PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber); + VTABLE_set_number_native(INTERP, retval, n); + RETURN(PMC *retval); + } + +/* + =item C =cut @@ -1461,6 +1475,34 @@ Used to unarchive the number. /* +=item C + +=cut + +*/ + METHOD PMC* sinh() { + const FLOATVAL n = sinh(VTABLE_get_number(INTERP, SELF)); + PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber); + VTABLE_set_number_native(INTERP, retval, n); + RETURN(PMC *retval); + } + +/* + +=item C + +=cut + +*/ + METHOD PMC* tanh() { + const FLOATVAL n = tanh(VTABLE_get_number(INTERP, SELF)); + PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber); + VTABLE_set_number_native(INTERP, retval, n); + RETURN(PMC *retval); + } + +/* + =item C =cut