Constrain essentiallyEqual and essentiallyZero
LHCb::essentiallyEqual
and LHCb::essentiallyZero
are intended to avoid imprecise floating point comparisons -- but the current version does not actually check whether it is invoked with a floating point (like) type. This MR requires the types of the argument to have std::numeric_limits
to be specialized for them (otherwise the use of std::numeric_limits<T>::epsilon()
and std::numeric_limits<T>::min()
makes no sense), and it distinguishes between 'exact' types (such as integer
and bool
) and 'non-exact' (such as float
and double
). Only for the 'inexact' types are the comparisons now done in a way which takes into account that these types are not 'exact'.
(note: yes, essentiallyZero
does currently get invoked with eg. a bool
argument, and essentiallyEqual
is currently invoked with plain int
arguments )
Validated by
-
Core Software -
RTA -
Simulation