Commit 29412488 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

expr nint: check function round().

parent 59682a15
...@@ -179,6 +179,8 @@ int get_funcID(const char *fun) ...@@ -179,6 +179,8 @@ int get_funcID(const char *fun)
if ( funcID == -1 ) cdoAbort("Function >%s< not available!", fun); if ( funcID == -1 ) cdoAbort("Function >%s< not available!", fun);
if ( strcmp(fun_sym_tbl[funcID].name, "nint") == 0 ) cdo_check_round();
return funcID; return funcID;
} }
......
...@@ -883,8 +883,13 @@ void minmaxval(long nvals, double *array, int *imiss, double *minval, double *ma ...@@ -883,8 +883,13 @@ void minmaxval(long nvals, double *array, int *imiss, double *minval, double *ma
void cdo_check_round(void) void cdo_check_round(void)
{ {
double rval1 = round(1.45678921); static bool checked = false;
double rval2 = round(1.54678921); if ( !checked )
if ( IS_NOT_EQUAL(rval1, 1.) || IS_NOT_EQUAL(rval2, 2.) ) {
cdoAbort("Function round() produces wrong results!"); checked = true;
double rval1 = round(1.45678921);
double rval2 = round(1.54678921);
if ( IS_NOT_EQUAL(rval1, 1.) || IS_NOT_EQUAL(rval2, 2.) )
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