- if(exp->error == EVAL_ERROR_OK)
- exp->result = eval_check_number(exp->result, &exp->error);
+ if(unlikely(isnan(exp->result))) {
+ if(exp->error == EVAL_ERROR_OK)
+ exp->error = EVAL_ERROR_VALUE_IS_NAN;
+ }
+ else if(unlikely(isinf(exp->result))) {
+ if(exp->error == EVAL_ERROR_OK)
+ exp->error = EVAL_ERROR_VALUE_IS_INFINITE;
+ }
+ else if(unlikely(exp->error == EVAL_ERROR_UNKNOWN_VARIABLE)) {
+ // although there is an unknown variable
+ // the expression was evaluated successfully
+ exp->error = EVAL_ERROR_OK;
+ }