ATLAS Offline Software
Loading...
Searching...
No Matches
FlowEnergyDecorator.cxx File Reference
Include dependency graph for FlowEnergyDecorator.cxx:

Go to the source code of this file.

Functions

template<typename T>
bool close_to_zero (T value, T eps=std::numeric_limits< T >::epsilon())

Function Documentation

◆ close_to_zero()

template<typename T>
bool CxxUtils::close_to_zero ( T value,
T eps = std::numeric_limits<T>::epsilon() )

Definition at line 48 of file close_to_zero.h.

48 {
49 if constexpr (std::is_integral_v<T>) {
50 // For integers, only exact zero is invalid
51 return value == 0;
52 } else if constexpr (std::is_floating_point_v<T>) {
53 return std::abs(value) < eps;
54 } else {
55 static_assert(std::is_arithmetic_v<T>, "close_to_zero: Only arithmetic types supported");
56 return false;
57 }
58 }