From 9a96fc121c68b7d07ea6defa3e0b098882de759c Mon Sep 17 00:00:00 2001 From: Ferhat Mihoubi <ferhat.mihoubi@univ-evry.fr> Date: Wed, 7 Mar 2012 15:32:06 +0100 Subject: [PATCH] * Considers both 'inf' and 'nan' results in functions return and improves an error message --- mex/sources/bytecode/Interpreter.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mex/sources/bytecode/Interpreter.cc b/mex/sources/bytecode/Interpreter.cc index 1c500e158..fc62c72eb 100644 --- a/mex/sources/bytecode/Interpreter.cc +++ b/mex/sources/bytecode/Interpreter.cc @@ -70,7 +70,7 @@ double Interpreter::pow1(double a, double b) { double r = pow_(a, b); - if (isnan(r)) + if (isnan(r) || isinf(r)) { res1 = NAN; r = 0.0000000000000000000000001; @@ -83,7 +83,7 @@ double Interpreter::divide(double a, double b) { double r = a / b; - if (isinf(r)) + if (isinf(r) || isnan(r)) { res1 = NAN; r = 1e70; @@ -96,7 +96,7 @@ double Interpreter::log1(double a) { double r = log(a); - if (isnan(r)) + if (isnan(r) || isinf(r)) { res1 = NAN; r = -1e70; @@ -109,7 +109,7 @@ double Interpreter::log10_1(double a) { double r = log(a); - if (isnan(r)) + if (isnan(r) || isinf(r)) { res1 = NAN; r = -1e70; -- GitLab