Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
cdo
Commits
553e130d
Commit
553e130d
authored
Mar 02, 2017
by
Uwe Schulzweida
Browse files
cdo_check_round: check in a for loop.
parent
29412488
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/util.c
View file @
553e130d
...
...
@@ -887,9 +887,15 @@ void cdo_check_round(void)
if
(
!
checked
)
{
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!"
);
#define NMAX 3
double
vals2
[
NMAX
];
double
vals
[
NMAX
]
=
{
2783
.
333
,
1
.
45678921
,
1
.
54678921
};
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!"
);
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment