Belle II Software development
FloatComparing.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#pragma once
9
10#include <cmath>
11
12namespace Belle2 {
17 namespace TrackFindingCDC {
18
20 template<class AFloat>
21 bool identicalFloat(AFloat lhs, AFloat rhs)
22 {
23 return rhs == lhs or (std::isnan(lhs) and std::isnan(rhs));
24 }
25
27 template<class AFloat>
28 bool lessFloatHighNaN(AFloat lhs, AFloat rhs)
29 {
30 if (std::isnan(lhs)) return false;
31 if (std::isnan(rhs)) return true;
32 return lhs < rhs;
33 }
34
36 template<class AFloat>
37 bool greaterFloatHighNaN(AFloat lhs, AFloat rhs)
38 {
39 if (std::isnan(rhs)) return false;
40 if (std::isnan(lhs)) return true;
41 return lhs > rhs;
42 }
43 }
45}
Abstract base class for different kinds of events.