Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
acts-framework
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Gabriel Farrugia
acts-framework
Commits
b5b9f7f8
Commit
b5b9f7f8
authored
7 years ago
by
Hadrien G
Committed by
Hadrien Benjamin Grasland
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Added NaN-proof comparison function for doubles
parent
f03ad8dd
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/compareRootFiles.hpp
+15
-2
15 additions, 2 deletions
scripts/compareRootFiles.hpp
with
15 additions
and
2 deletions
scripts/compareRootFiles.hpp
+
15
−
2
View file @
b5b9f7f8
...
@@ -108,9 +108,9 @@ compare(const T& x, const T& y)
...
@@ -108,9 +108,9 @@ compare(const T& x, const T& y)
}
}
// ...but we'll want to tweak that a little for floats, to handle NaNs better...
// ...but we'll want to tweak that a little for floats, to handle NaNs better...
template
<
>
template
<
typename
T
>
Ordering
Ordering
compare
(
const
float
&
x
,
const
float
&
y
)
compare
Float
(
const
T
&
x
,
const
T
&
y
)
{
{
if
(
std
::
isless
(
x
,
y
))
{
if
(
std
::
isless
(
x
,
y
))
{
return
Ordering
::
SMALLER
;
return
Ordering
::
SMALLER
;
...
@@ -121,6 +121,19 @@ compare(const float& x, const float& y)
...
@@ -121,6 +121,19 @@ compare(const float& x, const float& y)
}
}
}
}
template
<
>
Ordering
compare
(
const
float
&
x
,
const
float
&
y
)
{
return
compareFloat
(
x
,
y
);
}
template
<
>
Ordering
compare
(
const
double
&
x
,
const
double
&
y
)
{
return
compareFloat
(
x
,
y
);
}
// ...and for vectors, where the default lexicographic comparison cannot
// ...and for vectors, where the default lexicographic comparison cannot
// efficiently tell all of what we want in a single vector iteration pass.
// efficiently tell all of what we want in a single vector iteration pass.
template
<
typename
U
>
template
<
typename
U
>
...
...
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