4 #include "Evaluator/Evaluator.h"
5 #include "Evaluator/detail/Evaluator.h"
12 static const double radian = 1. ;
13 static const double degree = (3.14159265358979323846/180.0)*radian;
17 #include "Evaluator/DD4hepUnits.h"
26 static double eval_abs (
double a) {
return (a < 0) ? -a : a; }
27 static double eval_fabs (
double a) {
return std::fabs(a); }
28 static double eval_fmod (
double a,
double b) {
return std::fmod(a,b); }
29 static double eval_min (
double a,
double b) {
return (a < b) ? a : b; }
30 static double eval_max (
double a,
double b) {
return (a > b) ? a : b; }
31 static double eval_sqrt (
double a) {
return std::sqrt(a); }
32 static double eval_cbrt (
double a) { return ::cbrt(a); }
33 static double eval_pow (
double a,
double b) {
return std::pow(a,b); }
34 static double eval_sin (
double a) {
return std::sin(a); }
35 static double eval_cos (
double a) {
return std::cos(a); }
36 static double eval_tan (
double a) {
return std::tan(a); }
37 static double eval_asin (
double a) {
return std::asin(a); }
38 static double eval_acos (
double a) {
return std::acos(a); }
39 static double eval_atan (
double a) {
return std::atan(a); }
40 static double eval_atan2(
double a,
double b) {
return std::atan2(a,b); }
41 static double eval_sinh (
double a) {
return std::sinh(a); }
42 static double eval_cosh (
double a) {
return std::cosh(a); }
43 static double eval_tanh (
double a) {
return std::tanh(a); }
44 static double eval_exp (
double a) {
return std::exp(a); }
45 static double eval_exp2 (
double a) { return ::exp2(a); }
47 static double eval_exp10(
double a) { return ::pow(10.,a) ; }
48 static double eval_expm1(
double a) { return ::expm1(a); }
49 static double eval_log (
double a) {
return std::log(a); }
50 static double eval_logb (
double a) { return ::logb(a); }
51 static double eval_log10(
double a) {
return std::log10(a); }
52 static double eval_log1p(
double a) { return ::log1p(a); }
53 static double eval_hypot(
double a,
double b) { return ::hypot(a,b); }
54 static double eval_erf (
double a) { return ::erf(a); }
55 static double eval_erfc (
double a) { return ::erfc(a); }
56 static double eval_gamma(
double a) { return ::tgamma(a); }
57 static double eval_double(
double a) {
return a; }
58 static double eval_int (
double a) {
return (
double)int(a); }
59 static double eval_nint (
double a) {
return std::floor(a); }
60 static double eval_floor(
double a) {
return std::floor(a); }
61 static double eval_round(
double a) { return ::round(a); }
62 static double eval_ceil (
double a) {
return std::ceil(a); }
63 static double eval_isnan(
double a) {
return std::isnan(a); }
64 static double eval_isinf(
double a) {
return std::isinf(a); }
65 static double eval_nearbyint(
double a) { return ::nearbyint(a); }
72 void Evaluator::Object::setStdMath() {
76 setVariableNoLock(
"pi", 3.14159265358979323846);
77 setVariableNoLock(
"e", 2.7182818284590452354);
78 setVariableNoLock(
"gamma", 0.577215664901532861);
85 setVariableNoLock(
"radian", units::radian );
86 setVariableNoLock(
"rad", units::radian );
87 setVariableNoLock(
"degree", units::degree );
88 setVariableNoLock(
"deg", units::degree );
96 setFunctionNoLock(
"abs", eval_abs);
97 setFunctionNoLock(
"fabs", eval_fabs);
98 setFunctionNoLock(
"fmod", eval_fmod);
99 setFunctionNoLock(
"min", eval_min);
100 setFunctionNoLock(
"max", eval_max);
101 setFunctionNoLock(
"sqrt", eval_sqrt);
102 setFunctionNoLock(
"cbrt", eval_cbrt);
103 setFunctionNoLock(
"pow", eval_pow);
104 setFunctionNoLock(
"sin", eval_sin);
105 setFunctionNoLock(
"cos", eval_cos);
106 setFunctionNoLock(
"tan", eval_tan);
107 setFunctionNoLock(
"asin", eval_asin);
108 setFunctionNoLock(
"acos", eval_acos);
109 setFunctionNoLock(
"atan", eval_atan);
110 setFunctionNoLock(
"atan2", eval_atan2);
111 setFunctionNoLock(
"sinh", eval_sinh);
112 setFunctionNoLock(
"cosh", eval_cosh);
113 setFunctionNoLock(
"tanh", eval_tanh);
114 setFunctionNoLock(
"exp", eval_exp);
115 setFunctionNoLock(
"exp2", eval_exp2);
116 setFunctionNoLock(
"exp10", eval_exp10);
117 setFunctionNoLock(
"expm1", eval_expm1);
118 setFunctionNoLock(
"log", eval_log);
119 setFunctionNoLock(
"logb", eval_logb);
120 setFunctionNoLock(
"log10", eval_log10);
121 setFunctionNoLock(
"log1p", eval_log1p);
122 setFunctionNoLock(
"hypot", eval_hypot);
123 setFunctionNoLock(
"erf", eval_erf);
124 setFunctionNoLock(
"erfc", eval_erfc);
125 setFunctionNoLock(
"gamma", eval_gamma);
126 setFunctionNoLock(
"double", eval_double);
127 setFunctionNoLock(
"int", eval_int);
128 setFunctionNoLock(
"nint", eval_nint);
129 setFunctionNoLock(
"floor", eval_floor);
130 setFunctionNoLock(
"round", eval_round);
131 setFunctionNoLock(
"ceil", eval_ceil);
132 setFunctionNoLock(
"isnan", eval_isnan);
133 setFunctionNoLock(
"isinf", eval_isinf);
134 setFunctionNoLock(
"nearbyint", eval_nearbyint);