Commit 553e130d authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

cdo_check_round: check in a for loop.

parent 29412488
...@@ -887,9 +887,15 @@ void cdo_check_round(void) ...@@ -887,9 +887,15 @@ void cdo_check_round(void)
if ( !checked ) if ( !checked )
{ {
checked = true; checked = true;
double rval1 = round(1.45678921); #define NMAX 3
double rval2 = round(1.54678921); double vals2[NMAX];
if ( IS_NOT_EQUAL(rval1, 1.) || IS_NOT_EQUAL(rval2, 2.) ) double vals[NMAX] = {2783.333, 1.45678921, 1.54678921};
cdoAbort("Function round() produces wrong results!"); double rvals[NMAX] = {2783, 1, 2};
for ( int i = 0; i < NMAX; ++i )
{
vals2[i] = round(vals[i]);
if ( IS_NOT_EQUAL(vals2[i], rvals[i]) )
cdoAbort("Function round() produces wrong results!");
}
} }
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment