MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / is_equal_ulps

Function is_equal_ulps

src/core/utils/helpers/float_ops.h:83–91  ·  view source on GitHub ↗

Checks if two floating point numbers are equal given an allowed number of ULPs * * @param[in] a First number to compare * @param[in] b Second number to compare * @param[in] max_allowed_ulps (Optional) Number of allowed ULPs * * @return True if number is close else false */

Source from the content-addressed store, hash-verified

81 * @return True if number is close else false
82 */
83inline bool is_equal_ulps(float a, float b, int max_allowed_ulps = 0)
84{
85 RawFloat ra(a);
86 RawFloat rb(b);
87
88 // Check ULP distance
89 const int ulps = std::abs(ra.i32 - rb.i32);
90 return ulps <= max_allowed_ulps;
91}
92
93/** Checks if the input floating point number is 1.0f checking if the difference is within a range defined with epsilon
94 *

Callers

nothing calls this directly

Calls 1

absFunction · 0.85

Tested by

no test coverage detected