24.02
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
v
w
Variables
Typedefs
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
w
Enumerations
a
b
c
d
e
f
g
j
l
m
n
o
p
q
r
s
t
u
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
~
Functions
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
~
Variables
c
d
e
f
i
j
l
m
o
p
r
s
v
w
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
v
w
Enumerations
Enumerator
Related Functions
Files
File List
File Members
All
a
b
c
d
e
f
g
h
i
l
m
o
r
s
t
u
v
x
z
Functions
a
b
c
g
i
m
r
s
t
v
z
Variables
Typedefs
Macros
a
c
d
e
f
h
i
l
o
s
t
u
v
x
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
FloatingPointComparison.hpp
Go to the documentation of this file.
1
//
2
// Copyright © 2020 Arm Ltd. All rights reserved.
3
// SPDX-License-Identifier: MIT
4
//
5
6
#pragma once
7
8
#include <cmath>
9
10
namespace
armnnUtils
11
{
12
13
/**
14
* Compare two floats and return true if their values are within a specified tolerance of each other.
15
* @param a
16
* @param b
17
* @param tolerancePercentage If not supplied default will be 1% tolerance (1.0f)
18
* @return true if the value of float b is within tolerancePercentage of the value for float a.
19
*/
20
inline
bool
within_percentage_tolerance
(
float
a,
float
b,
float
tolerancePercent = 1.0f)
21
{
22
float
toleranceValue = std::fabs(a * (tolerancePercent / 100));
23
return
std::fabs(a - b) <= toleranceValue;
24
}
25
26
}
//namespace armnn
27
armnnUtils
Definition:
CompatibleTypes.hpp:10
armnnUtils::within_percentage_tolerance
bool within_percentage_tolerance(float a, float b, float tolerancePercent=1.0f)
Compare two floats and return true if their values are within a specified tolerance of each other.
Definition:
FloatingPointComparison.hpp:20
include
armnnUtils
FloatingPointComparison.hpp
Generated on Wed Feb 14 2024 16:36:13 for Arm NN by
1.8.17