Considers both 'inf' and 'nan' results in functions return and improves an error message

time-shift
Ferhat Mihoubi 2012-03-06 11:09:46 +01:00
parent 3072c6e611
commit 3730957e9f
2 changed files with 8 additions and 5 deletions

View File

@ -113,7 +113,10 @@ public:
value2(value2_arg)
{
ostringstream tmp;
tmp << " with X=" << value1 << "\n";
if (abs(value1) > 1e-10 )
tmp << " with X=" << value1 << "\n";
else
tmp << " with X=" << value1 << " and a=" << value2 << "\n";
completeErrorMsg(tmp.str());
};
};

View File

@ -71,7 +71,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;
@ -85,7 +85,7 @@ double
Interpreter::divide(double a, double b)
{
double r = a / b;
if (isinf(r))
if (isnan(r) || isinf(r))
{
res1 = NAN;
r = 1e70;
@ -99,7 +99,7 @@ double
Interpreter::log1(double a)
{
double r = log(a);
if (isnan(r))
if (isnan(r) || isinf(r))
{
res1 = NAN;
r = -1e70;
@ -113,7 +113,7 @@ double
Interpreter::log10_1(double a)
{
double r = log(a);
if (isnan(r))
if (isnan(r) || isinf(r))
{
res1 = NAN;
r = -1e70;