Belle II Software  release-05-02-19
FloatComparing.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2016 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <cmath>
13 
14 namespace Belle2 {
19  namespace TrackFindingCDC {
20 
22  template<class AFloat>
23  bool identicalFloat(AFloat lhs, AFloat rhs)
24  {
25  return rhs == lhs or (std::isnan(lhs) and std::isnan(rhs));
26  }
27 
29  template<class AFloat>
30  bool lessFloatHighNaN(AFloat lhs, AFloat rhs)
31  {
32  if (std::isnan(lhs)) return false;
33  if (std::isnan(rhs)) return true;
34  return lhs < rhs;
35  }
36 
38  template<class AFloat>
39  bool greaterFloatHighNaN(AFloat lhs, AFloat rhs)
40  {
41  if (std::isnan(rhs)) return false;
42  if (std::isnan(lhs)) return true;
43  return lhs > rhs;
44  }
45  }
47 }
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19