1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:38:11 +00:00

LibM: Add back ampsin() since it was still used by tan()

This commit is contained in:
Andreas Kling 2019-11-03 09:59:44 +01:00
parent 1282b778e7
commit 4565b2d2d9

View file

@ -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);