MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / is_float_close

Function is_float_close

llama.cpp:141–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141static bool is_float_close(float a, float b, float abs_tol) {
142 // Check for non-negative tolerance
143 if (abs_tol < 0.0) {
144 throw std::invalid_argument("Tolerance must be non-negative");
145 }
146
147 // Exact equality check
148 if (a == b) {
149 return true;
150 }
151
152 // Check for infinities
153 if (std::isinf(a) || std::isinf(b)) {
154 return false;
155 }
156
157 // Regular comparison using the provided absolute tolerance
158 return std::fabs(b - a) <= abs_tol;
159}
160
161#ifdef GGML_USE_CPU_HBM
162#include <hbwmalloc.h>

Callers 1

operator!=Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected