Health-GPS  1.2.2.0
Global Health Policy Simulation model (Health-GPS)
math_util.h
Go to the documentation of this file.
1 #pragma once
2 
3 namespace hgps::core {
14 class MathHelper {
15  public:
16  MathHelper() = delete;
17 
20  static int radix() noexcept;
21 
24  static double machine_precision() noexcept;
25 
28  static double default_numerical_precision() noexcept;
29 
35  static bool equal(double left, double right) noexcept;
36 
60  static bool equal(double left, double right, double precision) noexcept;
61 
62  private:
64  static int radix_;
65 
67  static double machine_precision_;
68 
70  static double numerical_precision_;
71 
73  static void compute_radix() noexcept;
74 
76  static void compute_machine_precision() noexcept;
77 };
78 } // namespace hgps::core
Additional mathematical functions and determines the parameters of the floating point representation.
Definition: math_util.h:14
static bool equal(double left, double right) noexcept
Compares two floating-point numbers for relative equality using the default numerical precision.
Definition: math_util.cpp:33
static double default_numerical_precision() noexcept
Gets the typical meaningful precision for numerical calculations.
Definition: math_util.cpp:25
static double machine_precision() noexcept
Gets the largest positive value which, when added to 1.0, yields 0.
Definition: math_util.cpp:17
static int radix() noexcept
Gets the machine radix used by floating-point numbers.
Definition: math_util.cpp:9
Top-level namespace for Health-GPS Core C++ API.
Definition: analysis.h:7