Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
athena
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Yeonju Go
athena
Commits
59ba381e
Commit
59ba381e
authored
6 years ago
by
Margherita Spalla
Browse files
Options
Downloads
Patches
Plain Diff
'equalWithinDeltaMethod' modified to implement relative difference comparison.
Former-commit-id: 0204b870413832f5b3dbaf83786c5abbc4ed672e
parent
119a87c5
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
DataQuality/dqm_algorithms/src/BinHeightThreshold.cxx
+15
-2
15 additions, 2 deletions
DataQuality/dqm_algorithms/src/BinHeightThreshold.cxx
with
15 additions
and
2 deletions
DataQuality/dqm_algorithms/src/BinHeightThreshold.cxx
+
15
−
2
View file @
59ba381e
...
@@ -329,9 +329,22 @@ dqm_algorithms::BinHeightThreshold::CompareBinHeightThreshold(const std::string
...
@@ -329,9 +329,22 @@ dqm_algorithms::BinHeightThreshold::CompareBinHeightThreshold(const std::string
bool
bool
dqm_algorithms
::
BinHeightThreshold
::
equalWithinPrecision
(
double
a
,
double
b
)
dqm_algorithms
::
BinHeightThreshold
::
equalWithinPrecision
(
double
a
,
double
b
)
{
{
if
(
a
>=
b
-
precision_
&&
a
<=
b
+
precision_
)
//relative difference method (following what suggested in (non-ATLAS) web page http://floating-point-gui.de/errors/comparison/)
double
absA
=
fabs
(
a
);
double
absB
=
fabs
(
b
);
double
diff
=
fabs
(
a
-
b
);
if
(
a
==
b
)
{
// shortcut, handles infinities
return
true
;
return
true
;
return
false
;
}
else
if
(
a
==
0
||
b
==
0
||
diff
<
DBL_MIN
)
{
// a or b is zero or both are extremely close to it
// relative error is less meaningful here
return
diff
<
(
precision_
*
DBL_MIN
);
}
else
{
// use relative error
return
(
diff
/
std
::
min
((
absA
+
absB
),
DBL_MAX
))
<
precision_
;
}
}
}
void
void
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment