CYCLUS
Loading...
Searching...
No Matches
cyc_limits.h
Go to the documentation of this file.
1#ifndef CYCLUS_SRC_CYC_LIMITS_H_
2#define CYCLUS_SRC_CYC_LIMITS_H_
3
4#include <cmath>
5#include <limits>
6
7namespace cyclus {
8
9/// generic epsilon values
10extern double cy_eps;
11/// a generic epsilon value
12inline double eps() {
13 return cy_eps;
14}
15
16/// epsilon values to be used by resources
17extern double cy_eps_rsrc;
18/// an epsilon value to be used by resources
19inline double eps_rsrc() {
20 return cy_eps_rsrc;
21}
22
23/// returns true if a double is less than 0 - eps()
24inline bool IsNegative(double d) {
25 return (d < (-1 * eps()));
26}
27
28/// returns true if two doubles are within eps() of one another
29inline bool AlmostEq(double d1, double d2) {
30 return std::fabs(d1 - d2) < eps();
31}
32
33/// distance in ULP within which floating point numbers should be considered
34/// equal.
35static const double float_ulp_eq = 2;
36
37/// maximum value for a function modifier (i.e., a_i for variable x_i)
38static const double kModifierLimit = pow(10, 10);
39
40/// maximum (+) value for an integer variable
41static const int CY_LARGE_INT = 2147483647;
42
43/// maximum (+) value for a linear variable
44static const double CY_LARGE_DOUBLE = 1e299;
45
46/// constant near-zero value
47static const double CY_NEAR_ZERO = 1e-08;
48
49} // namespace cyclus
50
51#endif // CYCLUS_SRC_CYC_LIMITS_H_
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or....
Definition agent.cc:14
static const double kModifierLimit
maximum value for a function modifier (i.e., a_i for variable x_i)
Definition cyc_limits.h:38
bool IsNegative(double d)
returns true if a double is less than 0 - eps()
Definition cyc_limits.h:24
static const double CY_NEAR_ZERO
constant near-zero value
Definition cyc_limits.h:47
double eps_rsrc()
an epsilon value to be used by resources
Definition cyc_limits.h:19
double cy_eps_rsrc
epsilon values to be used by resources
Definition context.cc:18
double cy_eps
generic epsilon values
Definition context.cc:17
double eps()
a generic epsilon value
Definition cyc_limits.h:12
static const int CY_LARGE_INT
maximum (+) value for an integer variable
Definition cyc_limits.h:41
bool AlmostEq(double d1, double d2)
returns true if two doubles are within eps() of one another
Definition cyc_limits.h:29
static const double float_ulp_eq
distance in ULP within which floating point numbers should be considered equal.
Definition cyc_limits.h:35
T OptionalQuery(InfileTree *tree, std::string query, T default_val)
a query method for optional parameters
static const double CY_LARGE_DOUBLE
maximum (+) value for a linear variable
Definition cyc_limits.h:44