Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
a78b4209
Commit
a78b4209
authored
Dec 01, 2016
by
James Willis
Browse files
Make sure the sum is greater than zero before performing division.
parent
52029aba
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/tools.c
View file @
a78b4209
...
...
@@ -578,7 +578,9 @@ int compare_values(double a, double b, double threshold, double *absDiff,
*
absDiff
=
fabs
(
a
-
b
);
*
absSum
=
fabs
(
a
+
b
);
*
relDiff
=
*
absDiff
/
*
absSum
;
if
(
*
absSum
>
0
.
f
)
{
*
relDiff
=
*
absDiff
/
*
absSum
;
}
if
(
*
relDiff
>
threshold
)
{
result
=
1
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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