#include #include #include #include #include #include #include extern "C" { #include } #include namespace Poincare { Expression::Type Cosine::type() const { return Type::Cosine; } Expression * Cosine::clone() const { Cosine * a = new Cosine(m_operands, true); return a; } float Cosine::characteristicXRange(Context & context, AngleUnit angleUnit) const { return Trigonometry::characteristicXRange(this, context, angleUnit); } template std::complex Cosine::computeOnComplex(const std::complex c, AngleUnit angleUnit) { std::complex angleInput = Trigonometry::ConvertToRadian(c, angleUnit); std::complex res = std::cos(angleInput); return Trigonometry::RoundToMeaningfulDigits(res); } Expression * Cosine::shallowReduce(Context& context, AngleUnit angleUnit) { Expression * e = Expression::shallowReduce(context, angleUnit); if (e != this) { return e; } #if MATRIX_EXACT_REDUCING Expression * op = editableOperand(0); if (op->type() == Type::Matrix) { return SimplificationEngine::map(this, context, angleUnit); } #endif return Trigonometry::shallowReduceDirectFunction(this, context, angleUnit); } }