ONE - On-device Neural Engine
Loading...
Searching...
No Matches
nike::AbsoluteEpsilonEqualFunctor Class Reference

#include <AbsoluteEpsilonEqual.h>

Public Member Functions

bool operator() (float lhs, float rhs) const
 

Friends

AbsoluteEpsilonEqualFunctor absolute_epsilon_equal (float)
 

Detailed Description

Definition at line 23 of file AbsoluteEpsilonEqual.h.

Member Function Documentation

◆ operator()()

bool nike::AbsoluteEpsilonEqualFunctor::operator() ( float  lhs,
float  rhs 
) const

Definition at line 25 of file AbsoluteEpsilonEqual.cpp.

26{
27 if (std::isnan(lhs) && std::isnan(rhs))
28 {
29 return true;
30 }
31
32 const auto diff = std::fabs(lhs - rhs);
33
34 return diff <= _tolerance;
35}

Friends And Related Symbol Documentation

◆ absolute_epsilon_equal

AbsoluteEpsilonEqualFunctor absolute_epsilon_equal ( float  tolerance)
friend
Note
AbsoluteEpsilonEqualFunctor uses its own rule for NaN values.

For example, "NAN == NAN" is false but "absolute_epsilon_equal(0.001f)(NAN, NAN)" is true.

Definition at line 37 of file AbsoluteEpsilonEqual.cpp.

38{
39 return AbsoluteEpsilonEqualFunctor{tolerance};
40}

The documentation for this class was generated from the following files: