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

Commit 10c0499

Browse files
committed
implement trigo hyper
1 parent db5a03c commit 10c0499

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed

src/lib/luamath.pir

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ atan
6969
atan2
7070
ceil
7171
cos
72+
cosh
7273
deg
7374
exp
7475
floor
@@ -85,8 +86,10 @@ rad
8586
random
8687
randomseed
8788
sin
89+
sinh
8890
sqrt
8991
tan
92+
tanh
9093
LIST
9194
lua_register($P1, _math, $P2)
9295

@@ -204,6 +207,16 @@ LIST
204207
.end
205208

206209

210+
.sub 'cosh'
211+
.param pmc x :optional
212+
.param pmc extra :slurpy
213+
.local pmc res
214+
lua_checknumber(1, x)
215+
res = x.'cosh'()
216+
.return (res)
217+
.end
218+
219+
207220
.sub 'deg'
208221
.param pmc x :optional
209222
.param pmc extra :slurpy
@@ -455,6 +468,16 @@ LIST
455468
.end
456469

457470

471+
.sub 'sinh'
472+
.param pmc x :optional
473+
.param pmc extra :slurpy
474+
.local pmc res
475+
lua_checknumber(1, x)
476+
res = x.'sinh'()
477+
.return (res)
478+
.end
479+
480+
458481
.sub 'sqrt'
459482
.param pmc x :optional
460483
.param pmc extra :slurpy
@@ -479,6 +502,16 @@ LIST
479502
.end
480503

481504

505+
.sub 'tanh'
506+
.param pmc x :optional
507+
.param pmc extra :slurpy
508+
.local pmc res
509+
lua_checknumber(1, x)
510+
res = x.'tanh'()
511+
.return (res)
512+
.end
513+
514+
482515
# Local Variables:
483516
# mode: pir
484517
# fill-column: 100

src/pmc/luanumber.pmc

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,20 @@ Used to unarchive the number.
987987

988988
/*
989989

990+
=item C<PMC* cosh()>
991+
992+
=cut
993+
994+
*/
995+
METHOD PMC* cosh() {
996+
const FLOATVAL n = cosh(VTABLE_get_number(INTERP, SELF));
997+
PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
998+
VTABLE_set_number_native(INTERP, retval, n);
999+
RETURN(PMC *retval);
1000+
}
1001+
1002+
/*
1003+
9901004
=item C<PMC* erf()>
9911005

9921006
=cut
@@ -1461,6 +1475,34 @@ Used to unarchive the number.
14611475

14621476
/*
14631477

1478+
=item C<PMC* sinh()>
1479+
1480+
=cut
1481+
1482+
*/
1483+
METHOD PMC* sinh() {
1484+
const FLOATVAL n = sinh(VTABLE_get_number(INTERP, SELF));
1485+
PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
1486+
VTABLE_set_number_native(INTERP, retval, n);
1487+
RETURN(PMC *retval);
1488+
}
1489+
1490+
/*
1491+
1492+
=item C<PMC* tanh()>
1493+
1494+
=cut
1495+
1496+
*/
1497+
METHOD PMC* tanh() {
1498+
const FLOATVAL n = tanh(VTABLE_get_number(INTERP, SELF));
1499+
PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
1500+
VTABLE_set_number_native(INTERP, retval, n);
1501+
RETURN(PMC *retval);
1502+
}
1503+
1504+
/*
1505+
14641506
=item C<PMC* tgamma()>
14651507

14661508
=cut

0 commit comments

Comments
 (0)