Skip to content

num::close

Defined in header <core/types.hpp>

template <std::floating_point T>
bool close(T a, T b, T rtol = T(1e-9), T atol = T(0)) noexcept;

Test whether two numbers are close: \(|a - b| \le \max(\mathrm{rtol} \max(|a|, |b|),\ \mathrm{atol})\). With the default atol = 0, only zero is close to zero.