Check to see if the argument of tangent divided by half pi is an odd integer. If so, throw an out of domain error.

This commit is contained in:
John Scipione
2011-11-12 17:20:09 -05:00
parent 6c6edebce8
commit 0f27a79e43
+3
View File
@@ -652,6 +652,9 @@ ExpressionParser::_ParseFunction(const Token& token)
return _ParseFactorial(values[0].sqrt());
} else if (strcasecmp("tan", token.string.String()) == 0) {
_InitArguments(values, 1);
MAPM divided_by_half_pi = values[0] / MM_HALF_PI;
if (divided_by_half_pi.is_integer() && divided_by_half_pi.is_odd())
throw ParseException("out of domain", token.position);
return _ParseFactorial(values[0].tan());
} else if (strcasecmp("tanh", token.string.String()) == 0) {
_InitArguments(values, 1);