Skip to content
This repository has been archived by the owner on Jun 9, 2018. It is now read-only.

Commit

Permalink
implement trigo hyper
Browse files Browse the repository at this point in the history
  • Loading branch information
fperrad committed Oct 11, 2009
1 parent db5a03c commit 10c0499
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/lib/luamath.pir
Expand Up @@ -69,6 +69,7 @@ atan
atan2
ceil
cos
cosh
deg
exp
floor
Expand All @@ -85,8 +86,10 @@ rad
random
randomseed
sin
sinh
sqrt
tan
tanh
LIST
lua_register($P1, _math, $P2)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
42 changes: 42 additions & 0 deletions src/pmc/luanumber.pmc
Expand Up @@ -987,6 +987,20 @@ Used to unarchive the number.

/*

=item C<PMC* cosh()>

=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<PMC* erf()>

=cut
Expand Down Expand Up @@ -1461,6 +1475,34 @@ Used to unarchive the number.

/*

=item C<PMC* sinh()>

=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<PMC* tanh()>

=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<PMC* tgamma()>

=cut
Expand Down

0 comments on commit 10c0499

Please sign in to comment.