コード例 #1
0
ファイル: cosecant.cpp プロジェクト: xavierholt/RPN
/**
 * Pops a value off the stack and returns its hyperbolic cosecant.
 * @param evaluator The current evaluation.
 * @return The hyperbolic cosecant of the popped node.
 */
	double HyperbolicCosecantNode::evaluate(Evaluator& evaluator) const
	{
		double arg = evaluator.pop();
		double ex = exp(arg);
		return (2 * ex) / (ex * ex - 1);
	}
コード例 #2
0
ファイル: root.cpp プロジェクト: xavierholt/RPN
/**
 * Pops two values off the stack and returns the first raised to the power of the reciprocal of the second.
 * @param evaluator The current evaluation.
 * @return The second value'th root of the first popped value.
 */
	double RootNode::evaluate(Evaluator& evaluator) const
	{
		double arg2 = evaluator.pop();
		double arg1 = evaluator.pop();
		return pow(arg1, 1.0 / arg2);
	}
コード例 #3
0
ファイル: tangent.cpp プロジェクト: xavierholt/RPN
/**
 * Pops a value off the stack and returns its hyperbolic tangent.
 * @param evaluator The current evaluation.
 * @return The hyperbolic tangent of the popped node.
 */
	double HyperbolicTangentNode::evaluate(Evaluator& evaluator) const
	{
		double arg = evaluator.pop();
		double ex = exp(2 * arg);
		return (ex - 1) / (ex + 1);
	}
コード例 #4
0
ファイル: sine.cpp プロジェクト: xavierholt/RPN
/**
 * Pops a value off the stack and returns its hyperbolic sine.
 * @param evaluator The current evaluation.
 * @return The hyperbolic sine of the popped node.
 */
	double HyperbolicSineNode::evaluate(Evaluator& evaluator) const
	{
		double arg = evaluator.pop();
		double ex = exp(arg);
		return (ex * ex - 1) / (2 * ex);
	}
コード例 #5
0
ファイル: decadiclogarithm.cpp プロジェクト: xavierholt/RPN
/**
 * Pops a value off the stack and returns its decadic logarithm.
 * @param evaluator The current evaluation.
 * @return The decadic logarithm of the popped value.
 */
	double DecadicLogarithmNode::evaluate(Evaluator& evaluator) const
	{
		double arg = evaluator.pop();
		return log10(arg);
	}
コード例 #6
0
ファイル: arccosecant.cpp プロジェクト: xavierholt/RPN
/**
 * Pops a value off the stack and returns its hyperbolic arc cosecant.
 * @param evaluator The current evaluation.
 * @return The hyperbolic arc cosecant of the popped node.
 */
	double HyperbolicArcCosecantNode::evaluate(Evaluator& evaluator) const
	{
		double arg = evaluator.pop();
		double inv = 1.0 / arg;
		return log(inv + sqrt(inv * inv + 1));
	}
コード例 #7
0
ファイル: absolutevalue.cpp プロジェクト: xavierholt/RPN
/**
 * Pops a value off the stack and returns its absolute value.
 * @param evaluator The current evaluation.
 * @return The absolute value of the popped node.
 */
	double AbsoluteValueNode::evaluate(Evaluator& evaluator) const
	{
		double arg = evaluator.pop();
		return fabs(arg);
	}