#include #include #include #include #include #include #include extern "C" { #include } #include namespace Poincare { Tangent::Tangent() : Function("tan") { } Expression * Tangent::cloneWithDifferentOperands(Expression** newOperands, int numberOfOperands, bool cloneOperands) const { assert(newOperands != nullptr); Tangent * t = new Tangent(); t->setArgument(newOperands, numberOfOperands, cloneOperands); return t; } Expression::Type Tangent::type() const { return Expression::Type::Tangent; } template Complex Tangent::templatedComputeComplex(const Complex c, AngleUnit angleUnit) const { Complex result = Fraction::compute(Sine::compute(c, angleUnit), Cosine::compute(c, angleUnit)); if (!std::isnan(result.a()) && !std::isnan(result.b())) { return result; } Complex tanh = HyperbolicTangent::compute(Multiplication::compute(Complex::Cartesian(0, -1), c)); return Multiplication::compute(Complex::Cartesian(0, 1), tanh); } }