bpp-core3  3.0.0
NumConstants.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #ifndef BPP_NUMERIC_NUMCONSTANTS_H
6 #define BPP_NUMERIC_NUMCONSTANTS_H
7 
8 #include <cmath>
9 #include <limits>
10 
11 
12 namespace bpp
13 {
21 {
22 public:
30  static double GOLDEN_RATIO_PHI() { return (1. + sqrt(5.)) / 2.; }
31  static double GOLDEN_RATIO_R() { return GOLDEN_RATIO_PHI() - 1.; }
32  static double GOLDEN_RATIO_C() { return 1. - GOLDEN_RATIO_R(); }
33 
36  static double MEGA() { return 1e6; }
37  static double KILO() { return 1e3; }
38  static double DECI() { return 1e-1; }
39  static double CENTI() { return 1e-2; }
40  static double MILLI() { return 1e-3; }
41  static double MICRO() { return 1e-6; }
42  static double NANO() { return 1e-9; }
43  static double PICO() { return 1e-12; }
44 
45  static double SMALL() { return 1e-6; }
46  static double TINY() { return 1e-12; }
47  static double VERY_TINY() { return 1e-20; }
48  static double VERY_BIG() { return static_cast<double>(1.7E+23); }
49 
55  static double INF() { return std::numeric_limits<double>::has_infinity ? -std::log(0) : std::numeric_limits<double>::max(); }
56  static double PINF() { return std::numeric_limits<double>::has_infinity ? -std::log(0) : std::numeric_limits<double>::max(); }
57  static double MINF() { return std::numeric_limits<double>::has_infinity ? std::log(0) : std::numeric_limits<double>::min(); }
58  static double NaN() { return NAN; }
61  static double PI() { return 3.141593; }
62 };
63 } // end of namespace bpp.
64 #endif // BPP_NUMERIC_NUMCONSTANTS_H
this static class contains several useful constant values.
Definition: NumConstants.h:20
static double MILLI()
Definition: NumConstants.h:40
static double GOLDEN_RATIO_PHI()
Definition: NumConstants.h:30
static double VERY_TINY()
Definition: NumConstants.h:47
static double PINF()
Definition: NumConstants.h:56
static double GOLDEN_RATIO_C()
Definition: NumConstants.h:32
static double MICRO()
Definition: NumConstants.h:41
static double NANO()
Definition: NumConstants.h:42
static double PICO()
Definition: NumConstants.h:43
static double TINY()
Definition: NumConstants.h:46
static double VERY_BIG()
Definition: NumConstants.h:48
static double MEGA()
Definition: NumConstants.h:36
static double CENTI()
Definition: NumConstants.h:39
static double SMALL()
Definition: NumConstants.h:45
static double NaN()
Definition: NumConstants.h:58
static double PI()
Definition: NumConstants.h:61
static double INF()
Definition: NumConstants.h:55
static double DECI()
Definition: NumConstants.h:38
static double KILO()
Definition: NumConstants.h:37
static double GOLDEN_RATIO_R()
Definition: NumConstants.h:31
static double MINF()
Definition: NumConstants.h:57