Check for negative numbers in sqrt

This commit is contained in:
Jeremy Rand 2013-07-27 00:22:50 -05:00
parent ba2ce6fa89
commit 88edf4b193
1 changed files with 5 additions and 0 deletions

View File

@ -39,6 +39,11 @@ void sqrtExecute(void)
return;
}
if (expr->u.real < 0.0) {
abCalcRaiseError(abCalcComplexResultError, SQRT_NAME);
return;
}
abCalcExprRealSet(&result, sqrt(expr->u.real));
abCalcStackExprPop(NULL);