Skip to content

Commit

Permalink
Fix {Sin,Cos,Tan}hd and use more resilient tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hedyhli committed Aug 22, 2024
1 parent 6c7dcfc commit dc6b485
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -1845,17 +1845,17 @@ static NUMBER ___atan(NUMBER a)

static NUMBER ___sinhd(NUMBER a)
{
return radians_to_degrees(sinh(a));
return sinh(degrees_to_radians(a));
}

static NUMBER ___coshd(NUMBER a)
{
return radians_to_degrees(cosh(a));
return cosh(degrees_to_radians(a));
}

static NUMBER ___tanhd(NUMBER a)
{
return radians_to_degrees(tanh(a));
return tanh(degrees_to_radians(a));
}

static NUMBER ___sinh(NUMBER a)
Expand Down
12 changes: 6 additions & 6 deletions tests/trig.cog
Original file line number Diff line number Diff line change
Expand Up @@ -58,32 +58,32 @@ Print If == 10 Tan Atan 10
else
"FAIL: Radian arctan";

Print If == 0 Sinhd 0
Print If == 0.17542037193601015 Sinhd 10
"PASS: Degree hyperbolic sin"
else
"FAIL: Degree hyperbolic sin";

Print If == 88.412007823281300034068408422172 Coshd 1
Print If == 1.0001523125762564 Coshd 1
"PASS: Degree hyperbolic cos"
else
"FAIL: Degree hyperbolic cos";

Print If == 0 Tanhd 0
Print If == 0.17278206351636377 Tanhd 10
"PASS: Degree hyperbolic tan"
else
"FAIL: Degree hyperbolic tan";

Print If == 0 Sinh 0
Print If == 74.20321057778875 Sinh 5
"PASS: Radian hyperbolic sin"
else
"FAIL: Radian hyperbolic sin";

Print If == 1 Cosh 0
Print If == 74.20994852478785 Cosh 5
"PASS: Radian hyperbolic cos"
else
"FAIL: Radian hyperbolic cos";

Print If == 0 Tanh 0
Print If == Tanh 8 / Cosh 8 Sinh 8
"PASS: Radian hyperbolic tan"
else
"FAIL: Radian hyperbolic tan";

0 comments on commit dc6b485

Please sign in to comment.