Skip to content

Commit

Permalink
LibM: Add back ampsin() since it was still used by tan()
Browse files Browse the repository at this point in the history
  • Loading branch information
awesomekling committed Nov 3, 2019
1 parent 1282b77 commit 4565b2d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Libraries/LibM/math.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,23 @@ double tanh(double x)
return (plusX - minusX) / (plusX + minusX);
}

double ampsin(double angle)
{
double looped_angle = fmod(M_PI + angle, M_TAU) - M_PI;
double looped_angle_squared = looped_angle * looped_angle;

double quadratic_term;
if (looped_angle > 0) {
quadratic_term = -looped_angle_squared;
} else {
quadratic_term = looped_angle_squared;
}

double linear_term = M_PI * looped_angle;

return quadratic_term + linear_term;
}

double tan(double angle)
{
return ampsin(angle) / ampsin(M_PI_2 + angle);
Expand Down

0 comments on commit 4565b2d

Please sign in to comment.