
(FPCore (K m n M l) :precision binary64 (* (cos (- (/ (* K (+ m n)) 2.0) M)) (exp (- (- (pow (- (/ (+ m n) 2.0) M) 2.0)) (- l (fabs (- m n)))))))
double code(double K, double m, double n, double M, double l) {
return cos((((K * (m + n)) / 2.0) - M)) * exp((-pow((((m + n) / 2.0) - M), 2.0) - (l - fabs((m - n)))));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos((((k * (m + n)) / 2.0d0) - m_1)) * exp((-((((m + n) / 2.0d0) - m_1) ** 2.0d0) - (l - abs((m - n)))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos((((K * (m + n)) / 2.0) - M)) * Math.exp((-Math.pow((((m + n) / 2.0) - M), 2.0) - (l - Math.abs((m - n)))));
}
def code(K, m, n, M, l): return math.cos((((K * (m + n)) / 2.0) - M)) * math.exp((-math.pow((((m + n) / 2.0) - M), 2.0) - (l - math.fabs((m - n)))))
function code(K, m, n, M, l) return Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * exp(Float64(Float64(-(Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)) - Float64(l - abs(Float64(m - n)))))) end
function tmp = code(K, m, n, M, l) tmp = cos((((K * (m + n)) / 2.0) - M)) * exp((-((((m + n) / 2.0) - M) ^ 2.0) - (l - abs((m - n))))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[((-N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]) - N[(l - N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (K m n M l) :precision binary64 (* (cos (- (/ (* K (+ m n)) 2.0) M)) (exp (- (- (pow (- (/ (+ m n) 2.0) M) 2.0)) (- l (fabs (- m n)))))))
double code(double K, double m, double n, double M, double l) {
return cos((((K * (m + n)) / 2.0) - M)) * exp((-pow((((m + n) / 2.0) - M), 2.0) - (l - fabs((m - n)))));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos((((k * (m + n)) / 2.0d0) - m_1)) * exp((-((((m + n) / 2.0d0) - m_1) ** 2.0d0) - (l - abs((m - n)))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos((((K * (m + n)) / 2.0) - M)) * Math.exp((-Math.pow((((m + n) / 2.0) - M), 2.0) - (l - Math.abs((m - n)))));
}
def code(K, m, n, M, l): return math.cos((((K * (m + n)) / 2.0) - M)) * math.exp((-math.pow((((m + n) / 2.0) - M), 2.0) - (l - math.fabs((m - n)))))
function code(K, m, n, M, l) return Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * exp(Float64(Float64(-(Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)) - Float64(l - abs(Float64(m - n)))))) end
function tmp = code(K, m, n, M, l) tmp = cos((((K * (m + n)) / 2.0) - M)) * exp((-((((m + n) / 2.0) - M) ^ 2.0) - (l - abs((m - n))))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[((-N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]) - N[(l - N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}
\end{array}
(FPCore (K m n M l) :precision binary64 (* (cos M) (exp (- (fabs (- n m)) (+ (pow (- (/ (+ m n) 2.0) M) 2.0) l)))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp((fabs((n - m)) - (pow((((m + n) / 2.0) - M), 2.0) + l)));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos(m_1) * exp((abs((n - m)) - (((((m + n) / 2.0d0) - m_1) ** 2.0d0) + l)))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.exp((Math.abs((n - m)) - (Math.pow((((m + n) / 2.0) - M), 2.0) + l)));
}
def code(K, m, n, M, l): return math.cos(M) * math.exp((math.fabs((n - m)) - (math.pow((((m + n) / 2.0) - M), 2.0) + l)))
function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(abs(Float64(n - m)) - Float64((Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0) + l)))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * exp((abs((n - m)) - (((((m + n) / 2.0) - M) ^ 2.0) + l))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - N[(N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{\left|n - m\right| - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \ell\right)}
\end{array}
Initial program 78.0%
+-commutative78.0%
+-commutative78.0%
fabs-sub78.0%
associate-/l*78.0%
+-commutative78.0%
Simplified78.0%
Taylor expanded in K around 0 96.5%
cos-neg96.5%
Simplified96.5%
Final simplification96.5%
(FPCore (K m n M l) :precision binary64 (if (or (<= M -2.25e+21) (not (<= M 28.0))) (* (cos M) (exp (* M (- M)))) (exp (- (- (fabs (- n m)) l) (* 0.25 (pow (+ m n) 2.0))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((M <= -2.25e+21) || !(M <= 28.0)) {
tmp = cos(M) * exp((M * -M));
} else {
tmp = exp(((fabs((n - m)) - l) - (0.25 * pow((m + n), 2.0))));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if ((m_1 <= (-2.25d+21)) .or. (.not. (m_1 <= 28.0d0))) then
tmp = cos(m_1) * exp((m_1 * -m_1))
else
tmp = exp(((abs((n - m)) - l) - (0.25d0 * ((m + n) ** 2.0d0))))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if ((M <= -2.25e+21) || !(M <= 28.0)) {
tmp = Math.cos(M) * Math.exp((M * -M));
} else {
tmp = Math.exp(((Math.abs((n - m)) - l) - (0.25 * Math.pow((m + n), 2.0))));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (M <= -2.25e+21) or not (M <= 28.0): tmp = math.cos(M) * math.exp((M * -M)) else: tmp = math.exp(((math.fabs((n - m)) - l) - (0.25 * math.pow((m + n), 2.0)))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((M <= -2.25e+21) || !(M <= 28.0)) tmp = Float64(cos(M) * exp(Float64(M * Float64(-M)))); else tmp = exp(Float64(Float64(abs(Float64(n - m)) - l) - Float64(0.25 * (Float64(m + n) ^ 2.0)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((M <= -2.25e+21) || ~((M <= 28.0))) tmp = cos(M) * exp((M * -M)); else tmp = exp(((abs((n - m)) - l) - (0.25 * ((m + n) ^ 2.0)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[M, -2.25e+21], N[Not[LessEqual[M, 28.0]], $MachinePrecision]], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * (-M)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[(0.25 * N[Power[N[(m + n), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq -2.25 \cdot 10^{+21} \lor \neg \left(M \leq 28\right):\\
\;\;\;\;\cos M \cdot e^{M \cdot \left(-M\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(\left|n - m\right| - \ell\right) - 0.25 \cdot {\left(m + n\right)}^{2}}\\
\end{array}
\end{array}
if M < -2.25e21 or 28 < M Initial program 81.3%
+-commutative81.3%
+-commutative81.3%
fabs-sub81.3%
associate-/l*81.3%
+-commutative81.3%
Simplified81.3%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in l around 0 99.3%
Taylor expanded in M around inf 99.3%
mul-1-neg99.3%
unpow299.3%
distribute-rgt-neg-in99.3%
Simplified99.3%
if -2.25e21 < M < 28Initial program 74.3%
+-commutative74.3%
+-commutative74.3%
fabs-sub74.3%
associate-/l*74.3%
+-commutative74.3%
Simplified74.3%
Taylor expanded in K around 0 92.7%
cos-neg92.7%
Simplified92.7%
Taylor expanded in M around 0 92.6%
associate--r+92.6%
+-commutative92.6%
Simplified92.6%
Final simplification96.1%
(FPCore (K m n M l) :precision binary64 (if (or (<= M -5.8e+14) (not (<= M 0.0034))) (* (cos M) (exp (* M (- M)))) (exp (- (fabs (- n m)) (* 0.25 (pow (+ m n) 2.0))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((M <= -5.8e+14) || !(M <= 0.0034)) {
tmp = cos(M) * exp((M * -M));
} else {
tmp = exp((fabs((n - m)) - (0.25 * pow((m + n), 2.0))));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if ((m_1 <= (-5.8d+14)) .or. (.not. (m_1 <= 0.0034d0))) then
tmp = cos(m_1) * exp((m_1 * -m_1))
else
tmp = exp((abs((n - m)) - (0.25d0 * ((m + n) ** 2.0d0))))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if ((M <= -5.8e+14) || !(M <= 0.0034)) {
tmp = Math.cos(M) * Math.exp((M * -M));
} else {
tmp = Math.exp((Math.abs((n - m)) - (0.25 * Math.pow((m + n), 2.0))));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (M <= -5.8e+14) or not (M <= 0.0034): tmp = math.cos(M) * math.exp((M * -M)) else: tmp = math.exp((math.fabs((n - m)) - (0.25 * math.pow((m + n), 2.0)))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((M <= -5.8e+14) || !(M <= 0.0034)) tmp = Float64(cos(M) * exp(Float64(M * Float64(-M)))); else tmp = exp(Float64(abs(Float64(n - m)) - Float64(0.25 * (Float64(m + n) ^ 2.0)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((M <= -5.8e+14) || ~((M <= 0.0034))) tmp = cos(M) * exp((M * -M)); else tmp = exp((abs((n - m)) - (0.25 * ((m + n) ^ 2.0)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[M, -5.8e+14], N[Not[LessEqual[M, 0.0034]], $MachinePrecision]], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * (-M)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - N[(0.25 * N[Power[N[(m + n), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq -5.8 \cdot 10^{+14} \lor \neg \left(M \leq 0.0034\right):\\
\;\;\;\;\cos M \cdot e^{M \cdot \left(-M\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{\left|n - m\right| - 0.25 \cdot {\left(m + n\right)}^{2}}\\
\end{array}
\end{array}
if M < -5.8e14 or 0.00339999999999999981 < M Initial program 81.8%
+-commutative81.8%
+-commutative81.8%
fabs-sub81.8%
associate-/l*81.8%
+-commutative81.8%
Simplified81.8%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in l around 0 98.6%
Taylor expanded in M around inf 98.6%
mul-1-neg98.6%
unpow298.6%
distribute-rgt-neg-in98.6%
Simplified98.6%
if -5.8e14 < M < 0.00339999999999999981Initial program 73.6%
+-commutative73.6%
+-commutative73.6%
fabs-sub73.6%
associate-/l*73.6%
+-commutative73.6%
Simplified73.6%
Taylor expanded in K around 0 92.5%
cos-neg92.5%
Simplified92.5%
Taylor expanded in l around 0 78.7%
Taylor expanded in M around 0 78.6%
Final simplification89.3%
(FPCore (K m n M l) :precision binary64 (if (<= n -4e-291) (exp (* (* m m) -0.25)) (if (<= n 1.6e-6) (* (cos M) (exp (* M (- M)))) (exp (* n (* n -0.25))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= -4e-291) {
tmp = exp(((m * m) * -0.25));
} else if (n <= 1.6e-6) {
tmp = cos(M) * exp((M * -M));
} else {
tmp = exp((n * (n * -0.25)));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (n <= (-4d-291)) then
tmp = exp(((m * m) * (-0.25d0)))
else if (n <= 1.6d-6) then
tmp = cos(m_1) * exp((m_1 * -m_1))
else
tmp = exp((n * (n * (-0.25d0))))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= -4e-291) {
tmp = Math.exp(((m * m) * -0.25));
} else if (n <= 1.6e-6) {
tmp = Math.cos(M) * Math.exp((M * -M));
} else {
tmp = Math.exp((n * (n * -0.25)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= -4e-291: tmp = math.exp(((m * m) * -0.25)) elif n <= 1.6e-6: tmp = math.cos(M) * math.exp((M * -M)) else: tmp = math.exp((n * (n * -0.25))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= -4e-291) tmp = exp(Float64(Float64(m * m) * -0.25)); elseif (n <= 1.6e-6) tmp = Float64(cos(M) * exp(Float64(M * Float64(-M)))); else tmp = exp(Float64(n * Float64(n * -0.25))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= -4e-291) tmp = exp(((m * m) * -0.25)); elseif (n <= 1.6e-6) tmp = cos(M) * exp((M * -M)); else tmp = exp((n * (n * -0.25))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, -4e-291], N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision], If[LessEqual[n, 1.6e-6], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * (-M)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(n * N[(n * -0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -4 \cdot 10^{-291}:\\
\;\;\;\;e^{\left(m \cdot m\right) \cdot -0.25}\\
\mathbf{elif}\;n \leq 1.6 \cdot 10^{-6}:\\
\;\;\;\;\cos M \cdot e^{M \cdot \left(-M\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{n \cdot \left(n \cdot -0.25\right)}\\
\end{array}
\end{array}
if n < -3.99999999999999985e-291Initial program 80.7%
+-commutative80.7%
+-commutative80.7%
fabs-sub80.7%
associate-/l*80.7%
+-commutative80.7%
Simplified80.7%
Taylor expanded in K around 0 97.6%
cos-neg97.6%
Simplified97.6%
Taylor expanded in l around 0 90.2%
Taylor expanded in M around 0 77.1%
Taylor expanded in m around inf 51.6%
*-commutative51.6%
unpow251.6%
Simplified51.6%
if -3.99999999999999985e-291 < n < 1.5999999999999999e-6Initial program 82.0%
+-commutative82.0%
+-commutative82.0%
fabs-sub82.0%
associate-/l*82.0%
+-commutative82.0%
Simplified82.0%
Taylor expanded in K around 0 94.2%
cos-neg94.2%
Simplified94.2%
Taylor expanded in l around 0 80.3%
Taylor expanded in M around inf 65.0%
mul-1-neg65.0%
unpow265.0%
distribute-rgt-neg-in65.0%
Simplified65.0%
if 1.5999999999999999e-6 < n Initial program 69.1%
+-commutative69.1%
+-commutative69.1%
fabs-sub69.1%
associate-/l*69.1%
+-commutative69.1%
Simplified69.1%
Taylor expanded in K around 0 97.1%
cos-neg97.1%
Simplified97.1%
Taylor expanded in l around 0 97.1%
Taylor expanded in M around 0 97.1%
Taylor expanded in n around inf 97.1%
*-commutative97.1%
unpow297.1%
associate-*l*97.1%
Simplified97.1%
Final simplification67.4%
(FPCore (K m n M l) :precision binary64 (if (<= n -3.3e-291) (* (cos M) (exp (* (* m m) -0.25))) (if (<= n 1.6e-6) (* (cos M) (exp (* M (- M)))) (exp (* n (* n -0.25))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= -3.3e-291) {
tmp = cos(M) * exp(((m * m) * -0.25));
} else if (n <= 1.6e-6) {
tmp = cos(M) * exp((M * -M));
} else {
tmp = exp((n * (n * -0.25)));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (n <= (-3.3d-291)) then
tmp = cos(m_1) * exp(((m * m) * (-0.25d0)))
else if (n <= 1.6d-6) then
tmp = cos(m_1) * exp((m_1 * -m_1))
else
tmp = exp((n * (n * (-0.25d0))))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= -3.3e-291) {
tmp = Math.cos(M) * Math.exp(((m * m) * -0.25));
} else if (n <= 1.6e-6) {
tmp = Math.cos(M) * Math.exp((M * -M));
} else {
tmp = Math.exp((n * (n * -0.25)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= -3.3e-291: tmp = math.cos(M) * math.exp(((m * m) * -0.25)) elif n <= 1.6e-6: tmp = math.cos(M) * math.exp((M * -M)) else: tmp = math.exp((n * (n * -0.25))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= -3.3e-291) tmp = Float64(cos(M) * exp(Float64(Float64(m * m) * -0.25))); elseif (n <= 1.6e-6) tmp = Float64(cos(M) * exp(Float64(M * Float64(-M)))); else tmp = exp(Float64(n * Float64(n * -0.25))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= -3.3e-291) tmp = cos(M) * exp(((m * m) * -0.25)); elseif (n <= 1.6e-6) tmp = cos(M) * exp((M * -M)); else tmp = exp((n * (n * -0.25))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, -3.3e-291], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.6e-6], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * (-M)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(n * N[(n * -0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -3.3 \cdot 10^{-291}:\\
\;\;\;\;\cos M \cdot e^{\left(m \cdot m\right) \cdot -0.25}\\
\mathbf{elif}\;n \leq 1.6 \cdot 10^{-6}:\\
\;\;\;\;\cos M \cdot e^{M \cdot \left(-M\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{n \cdot \left(n \cdot -0.25\right)}\\
\end{array}
\end{array}
if n < -3.2999999999999999e-291Initial program 80.7%
+-commutative80.7%
+-commutative80.7%
fabs-sub80.7%
associate-/l*80.7%
+-commutative80.7%
Simplified80.7%
Taylor expanded in K around 0 97.6%
cos-neg97.6%
Simplified97.6%
Taylor expanded in l around 0 90.2%
Taylor expanded in m around inf 51.6%
*-commutative51.6%
unpow251.6%
Simplified51.6%
if -3.2999999999999999e-291 < n < 1.5999999999999999e-6Initial program 82.0%
+-commutative82.0%
+-commutative82.0%
fabs-sub82.0%
associate-/l*82.0%
+-commutative82.0%
Simplified82.0%
Taylor expanded in K around 0 94.2%
cos-neg94.2%
Simplified94.2%
Taylor expanded in l around 0 80.3%
Taylor expanded in M around inf 65.0%
mul-1-neg65.0%
unpow265.0%
distribute-rgt-neg-in65.0%
Simplified65.0%
if 1.5999999999999999e-6 < n Initial program 69.1%
+-commutative69.1%
+-commutative69.1%
fabs-sub69.1%
associate-/l*69.1%
+-commutative69.1%
Simplified69.1%
Taylor expanded in K around 0 97.1%
cos-neg97.1%
Simplified97.1%
Taylor expanded in l around 0 97.1%
Taylor expanded in M around 0 97.1%
Taylor expanded in n around inf 97.1%
*-commutative97.1%
unpow297.1%
associate-*l*97.1%
Simplified97.1%
Final simplification67.4%
(FPCore (K m n M l) :precision binary64 (if (<= n 5.7e-99) (exp (* (* m m) -0.25)) (if (<= n 14.0) (exp (- (fabs (- n m)) l)) (exp (* n (* n -0.25))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 5.7e-99) {
tmp = exp(((m * m) * -0.25));
} else if (n <= 14.0) {
tmp = exp((fabs((n - m)) - l));
} else {
tmp = exp((n * (n * -0.25)));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (n <= 5.7d-99) then
tmp = exp(((m * m) * (-0.25d0)))
else if (n <= 14.0d0) then
tmp = exp((abs((n - m)) - l))
else
tmp = exp((n * (n * (-0.25d0))))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 5.7e-99) {
tmp = Math.exp(((m * m) * -0.25));
} else if (n <= 14.0) {
tmp = Math.exp((Math.abs((n - m)) - l));
} else {
tmp = Math.exp((n * (n * -0.25)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 5.7e-99: tmp = math.exp(((m * m) * -0.25)) elif n <= 14.0: tmp = math.exp((math.fabs((n - m)) - l)) else: tmp = math.exp((n * (n * -0.25))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 5.7e-99) tmp = exp(Float64(Float64(m * m) * -0.25)); elseif (n <= 14.0) tmp = exp(Float64(abs(Float64(n - m)) - l)); else tmp = exp(Float64(n * Float64(n * -0.25))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 5.7e-99) tmp = exp(((m * m) * -0.25)); elseif (n <= 14.0) tmp = exp((abs((n - m)) - l)); else tmp = exp((n * (n * -0.25))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 5.7e-99], N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision], If[LessEqual[n, 14.0], N[Exp[N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision]], $MachinePrecision], N[Exp[N[(n * N[(n * -0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 5.7 \cdot 10^{-99}:\\
\;\;\;\;e^{\left(m \cdot m\right) \cdot -0.25}\\
\mathbf{elif}\;n \leq 14:\\
\;\;\;\;e^{\left|n - m\right| - \ell}\\
\mathbf{else}:\\
\;\;\;\;e^{n \cdot \left(n \cdot -0.25\right)}\\
\end{array}
\end{array}
if n < 5.70000000000000032e-99Initial program 79.8%
+-commutative79.8%
+-commutative79.8%
fabs-sub79.8%
associate-/l*79.8%
+-commutative79.8%
Simplified79.8%
Taylor expanded in K around 0 96.8%
cos-neg96.8%
Simplified96.8%
Taylor expanded in l around 0 88.0%
Taylor expanded in M around 0 72.7%
Taylor expanded in m around inf 54.5%
*-commutative54.5%
unpow254.5%
Simplified54.5%
if 5.70000000000000032e-99 < n < 14Initial program 91.0%
+-commutative91.0%
+-commutative91.0%
fabs-sub91.0%
associate-/l*91.0%
+-commutative91.0%
Simplified91.0%
Taylor expanded in M around inf 82.4%
unpow282.4%
Simplified82.4%
Taylor expanded in K around 0 84.4%
cos-neg84.4%
exp-diff62.6%
sub-neg62.6%
mul-1-neg62.6%
mul-1-neg62.6%
remove-double-neg62.6%
mul-1-neg62.6%
distribute-neg-in62.6%
+-commutative62.6%
exp-diff84.4%
fabs-neg84.4%
mul-1-neg84.4%
sub-neg84.4%
fabs-sub84.4%
unpow284.4%
Simplified84.4%
Taylor expanded in M around 0 45.3%
if 14 < n Initial program 69.1%
+-commutative69.1%
+-commutative69.1%
fabs-sub69.1%
associate-/l*69.1%
+-commutative69.1%
Simplified69.1%
Taylor expanded in K around 0 97.1%
cos-neg97.1%
Simplified97.1%
Taylor expanded in l around 0 97.1%
Taylor expanded in M around 0 97.1%
Taylor expanded in n around inf 97.1%
*-commutative97.1%
unpow297.1%
associate-*l*97.1%
Simplified97.1%
Final simplification65.0%
(FPCore (K m n M l) :precision binary64 (if (<= n 2.9e-20) (exp (* (* m m) -0.25)) (exp (* n (* n -0.25)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 2.9e-20) {
tmp = exp(((m * m) * -0.25));
} else {
tmp = exp((n * (n * -0.25)));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (n <= 2.9d-20) then
tmp = exp(((m * m) * (-0.25d0)))
else
tmp = exp((n * (n * (-0.25d0))))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 2.9e-20) {
tmp = Math.exp(((m * m) * -0.25));
} else {
tmp = Math.exp((n * (n * -0.25)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 2.9e-20: tmp = math.exp(((m * m) * -0.25)) else: tmp = math.exp((n * (n * -0.25))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 2.9e-20) tmp = exp(Float64(Float64(m * m) * -0.25)); else tmp = exp(Float64(n * Float64(n * -0.25))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 2.9e-20) tmp = exp(((m * m) * -0.25)); else tmp = exp((n * (n * -0.25))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 2.9e-20], N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision], N[Exp[N[(n * N[(n * -0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 2.9 \cdot 10^{-20}:\\
\;\;\;\;e^{\left(m \cdot m\right) \cdot -0.25}\\
\mathbf{else}:\\
\;\;\;\;e^{n \cdot \left(n \cdot -0.25\right)}\\
\end{array}
\end{array}
if n < 2.9e-20Initial program 81.0%
+-commutative81.0%
+-commutative81.0%
fabs-sub81.0%
associate-/l*81.0%
+-commutative81.0%
Simplified81.0%
Taylor expanded in K around 0 96.3%
cos-neg96.3%
Simplified96.3%
Taylor expanded in l around 0 86.4%
Taylor expanded in M around 0 69.6%
Taylor expanded in m around inf 53.5%
*-commutative53.5%
unpow253.5%
Simplified53.5%
if 2.9e-20 < n Initial program 70.0%
+-commutative70.0%
+-commutative70.0%
fabs-sub70.0%
associate-/l*70.0%
+-commutative70.0%
Simplified70.0%
Taylor expanded in K around 0 97.1%
cos-neg97.1%
Simplified97.1%
Taylor expanded in l around 0 97.2%
Taylor expanded in M around 0 95.8%
Taylor expanded in n around inf 94.4%
*-commutative94.4%
unpow294.4%
associate-*l*94.4%
Simplified94.4%
Final simplification64.7%
(FPCore (K m n M l) :precision binary64 (exp (* n (* n -0.25))))
double code(double K, double m, double n, double M, double l) {
return exp((n * (n * -0.25)));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = exp((n * (n * (-0.25d0))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.exp((n * (n * -0.25)));
}
def code(K, m, n, M, l): return math.exp((n * (n * -0.25)))
function code(K, m, n, M, l) return exp(Float64(n * Float64(n * -0.25))) end
function tmp = code(K, m, n, M, l) tmp = exp((n * (n * -0.25))); end
code[K_, m_, n_, M_, l_] := N[Exp[N[(n * N[(n * -0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{n \cdot \left(n \cdot -0.25\right)}
\end{array}
Initial program 78.0%
+-commutative78.0%
+-commutative78.0%
fabs-sub78.0%
associate-/l*78.0%
+-commutative78.0%
Simplified78.0%
Taylor expanded in K around 0 96.5%
cos-neg96.5%
Simplified96.5%
Taylor expanded in l around 0 89.3%
Taylor expanded in M around 0 76.8%
Taylor expanded in n around inf 55.2%
*-commutative55.2%
unpow255.2%
associate-*l*55.2%
Simplified55.2%
Final simplification55.2%
herbie shell --seed 2023293
(FPCore (K m n M l)
:name "Maksimov and Kolovsky, Equation (32)"
:precision binary64
(* (cos (- (/ (* K (+ m n)) 2.0) M)) (exp (- (- (pow (- (/ (+ m n) 2.0) M) 2.0)) (- l (fabs (- m n)))))))