
(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 9 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 (- m n)) l) (pow (- (/ (+ m n) 2.0) M) 2.0)))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp(((fabs((m - n)) - l) - pow((((m + n) / 2.0) - M), 2.0)));
}
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((m - n)) - l) - ((((m + n) / 2.0d0) - m_1) ** 2.0d0)))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.exp(((Math.abs((m - n)) - l) - Math.pow((((m + n) / 2.0) - M), 2.0)));
}
def code(K, m, n, M, l): return math.cos(M) * math.exp(((math.fabs((m - n)) - l) - math.pow((((m + n) / 2.0) - M), 2.0)))
function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(Float64(abs(Float64(m - n)) - l) - (Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * exp(((abs((m - n)) - l) - ((((m + n) / 2.0) - M) ^ 2.0))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{\left(\left|m - n\right| - \ell\right) - {\left(\frac{m + n}{2} - M\right)}^{2}}
\end{array}
Initial program 75.6%
Taylor expanded in K around 0 97.1%
cos-neg97.1%
Simplified97.1%
Final simplification97.1%
(FPCore (K m n M l) :precision binary64 (if (or (<= M -3.5e+15) (not (<= M 27.0))) (exp (- (pow M 2.0))) (exp (- (- (fabs (- m n)) l) (* 0.25 (pow (+ m n) 2.0))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((M <= -3.5e+15) || !(M <= 27.0)) {
tmp = exp(-pow(M, 2.0));
} else {
tmp = exp(((fabs((m - n)) - 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 <= (-3.5d+15)) .or. (.not. (m_1 <= 27.0d0))) then
tmp = exp(-(m_1 ** 2.0d0))
else
tmp = exp(((abs((m - n)) - 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 <= -3.5e+15) || !(M <= 27.0)) {
tmp = Math.exp(-Math.pow(M, 2.0));
} else {
tmp = Math.exp(((Math.abs((m - n)) - l) - (0.25 * Math.pow((m + n), 2.0))));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (M <= -3.5e+15) or not (M <= 27.0): tmp = math.exp(-math.pow(M, 2.0)) else: tmp = math.exp(((math.fabs((m - n)) - l) - (0.25 * math.pow((m + n), 2.0)))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((M <= -3.5e+15) || !(M <= 27.0)) tmp = exp(Float64(-(M ^ 2.0))); else tmp = exp(Float64(Float64(abs(Float64(m - n)) - 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 <= -3.5e+15) || ~((M <= 27.0))) tmp = exp(-(M ^ 2.0)); else tmp = exp(((abs((m - n)) - l) - (0.25 * ((m + n) ^ 2.0)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[M, -3.5e+15], N[Not[LessEqual[M, 27.0]], $MachinePrecision]], N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision], N[Exp[N[(N[(N[Abs[N[(m - n), $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 -3.5 \cdot 10^{+15} \lor \neg \left(M \leq 27\right):\\
\;\;\;\;e^{-{M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(\left|m - n\right| - \ell\right) - 0.25 \cdot {\left(m + n\right)}^{2}}\\
\end{array}
\end{array}
if M < -3.5e15 or 27 < M Initial program 80.8%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in M around inf 99.2%
mul-1-neg99.2%
Simplified99.2%
Taylor expanded in M around 0 99.2%
if -3.5e15 < M < 27Initial program 71.0%
Taylor expanded in K around 0 94.6%
cos-neg94.6%
Simplified94.6%
Taylor expanded in M around 0 94.6%
associate--r+94.6%
fabs-sub94.6%
Simplified94.6%
Final simplification96.8%
(FPCore (K m n M l) :precision binary64 (if (<= n 57.0) (exp (- (- n m) (+ l (* 0.25 (pow m 2.0))))) (exp (* (* n n) -0.25))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 57.0) {
tmp = exp(((n - m) - (l + (0.25 * pow(m, 2.0)))));
} 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 <= 57.0d0) then
tmp = exp(((n - m) - (l + (0.25d0 * (m ** 2.0d0)))))
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 <= 57.0) {
tmp = Math.exp(((n - m) - (l + (0.25 * Math.pow(m, 2.0)))));
} else {
tmp = Math.exp(((n * n) * -0.25));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 57.0: tmp = math.exp(((n - m) - (l + (0.25 * math.pow(m, 2.0))))) else: tmp = math.exp(((n * n) * -0.25)) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 57.0) tmp = exp(Float64(Float64(n - m) - Float64(l + Float64(0.25 * (m ^ 2.0))))); else tmp = exp(Float64(Float64(n * n) * -0.25)); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 57.0) tmp = exp(((n - m) - (l + (0.25 * (m ^ 2.0))))); else tmp = exp(((n * n) * -0.25)); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 57.0], N[Exp[N[(N[(n - m), $MachinePrecision] - N[(l + N[(0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Exp[N[(N[(n * n), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 57:\\
\;\;\;\;e^{\left(n - m\right) - \left(\ell + 0.25 \cdot {m}^{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(n \cdot n\right) \cdot -0.25}\\
\end{array}
\end{array}
if n < 57Initial program 77.7%
Taylor expanded in K around 0 96.1%
cos-neg96.1%
Simplified96.1%
Taylor expanded in M around 0 86.9%
associate--r+86.9%
fabs-sub86.9%
Simplified86.9%
Taylor expanded in n around 0 68.8%
rem-square-sqrt28.8%
fabs-sqr28.8%
rem-square-sqrt85.4%
Simplified85.4%
if 57 < n Initial program 69.7%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in M around 0 97.0%
associate--r+97.0%
fabs-sub97.0%
Simplified97.0%
Taylor expanded in n around inf 100.0%
*-commutative100.0%
Simplified100.0%
unpow2100.0%
Applied egg-rr100.0%
(FPCore (K m n M l) :precision binary64 (if (<= n 2.3e-175) (exp (* (pow m 2.0) -0.25)) (if (<= n 1.95e-11) (* (cos M) (exp (- l))) (exp (* (* n n) -0.25)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 2.3e-175) {
tmp = exp((pow(m, 2.0) * -0.25));
} else if (n <= 1.95e-11) {
tmp = cos(M) * exp(-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 <= 2.3d-175) then
tmp = exp(((m ** 2.0d0) * (-0.25d0)))
else if (n <= 1.95d-11) then
tmp = cos(m_1) * exp(-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 <= 2.3e-175) {
tmp = Math.exp((Math.pow(m, 2.0) * -0.25));
} else if (n <= 1.95e-11) {
tmp = Math.cos(M) * Math.exp(-l);
} else {
tmp = Math.exp(((n * n) * -0.25));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 2.3e-175: tmp = math.exp((math.pow(m, 2.0) * -0.25)) elif n <= 1.95e-11: tmp = math.cos(M) * math.exp(-l) else: tmp = math.exp(((n * n) * -0.25)) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 2.3e-175) tmp = exp(Float64((m ^ 2.0) * -0.25)); elseif (n <= 1.95e-11) tmp = Float64(cos(M) * exp(Float64(-l))); else tmp = exp(Float64(Float64(n * n) * -0.25)); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 2.3e-175) tmp = exp(((m ^ 2.0) * -0.25)); elseif (n <= 1.95e-11) tmp = cos(M) * exp(-l); else tmp = exp(((n * n) * -0.25)); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 2.3e-175], N[Exp[N[(N[Power[m, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision], If[LessEqual[n, 1.95e-11], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], N[Exp[N[(N[(n * n), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 2.3 \cdot 10^{-175}:\\
\;\;\;\;e^{{m}^{2} \cdot -0.25}\\
\mathbf{elif}\;n \leq 1.95 \cdot 10^{-11}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(n \cdot n\right) \cdot -0.25}\\
\end{array}
\end{array}
if n < 2.3e-175Initial program 77.5%
Taylor expanded in K around 0 97.6%
cos-neg97.6%
Simplified97.6%
Taylor expanded in M around 0 88.6%
associate--r+88.6%
fabs-sub88.6%
Simplified88.6%
Taylor expanded in m around inf 53.0%
*-commutative53.0%
Simplified53.0%
if 2.3e-175 < n < 1.95000000000000005e-11Initial program 77.3%
Taylor expanded in l around inf 47.8%
mul-1-neg47.8%
Simplified47.8%
Taylor expanded in K around 0 60.3%
cos-neg60.3%
Simplified60.3%
if 1.95000000000000005e-11 < n Initial program 70.6%
Taylor expanded in K around 0 98.5%
cos-neg98.5%
Simplified98.5%
Taylor expanded in M around 0 95.6%
associate--r+95.6%
fabs-sub95.6%
Simplified95.6%
Taylor expanded in n around inf 97.1%
*-commutative97.1%
Simplified97.1%
unpow297.1%
Applied egg-rr97.1%
(FPCore (K m n M l) :precision binary64 (if (<= n 1.4e-244) (exp (* (pow m 2.0) -0.25)) (if (<= n 55.0) (exp (- (pow M 2.0))) (exp (* (* n n) -0.25)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 1.4e-244) {
tmp = exp((pow(m, 2.0) * -0.25));
} else if (n <= 55.0) {
tmp = exp(-pow(M, 2.0));
} 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 <= 1.4d-244) then
tmp = exp(((m ** 2.0d0) * (-0.25d0)))
else if (n <= 55.0d0) then
tmp = exp(-(m_1 ** 2.0d0))
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 <= 1.4e-244) {
tmp = Math.exp((Math.pow(m, 2.0) * -0.25));
} else if (n <= 55.0) {
tmp = Math.exp(-Math.pow(M, 2.0));
} else {
tmp = Math.exp(((n * n) * -0.25));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 1.4e-244: tmp = math.exp((math.pow(m, 2.0) * -0.25)) elif n <= 55.0: tmp = math.exp(-math.pow(M, 2.0)) else: tmp = math.exp(((n * n) * -0.25)) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 1.4e-244) tmp = exp(Float64((m ^ 2.0) * -0.25)); elseif (n <= 55.0) tmp = exp(Float64(-(M ^ 2.0))); else tmp = exp(Float64(Float64(n * n) * -0.25)); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 1.4e-244) tmp = exp(((m ^ 2.0) * -0.25)); elseif (n <= 55.0) tmp = exp(-(M ^ 2.0)); else tmp = exp(((n * n) * -0.25)); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 1.4e-244], N[Exp[N[(N[Power[m, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision], If[LessEqual[n, 55.0], N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision], N[Exp[N[(N[(n * n), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 1.4 \cdot 10^{-244}:\\
\;\;\;\;e^{{m}^{2} \cdot -0.25}\\
\mathbf{elif}\;n \leq 55:\\
\;\;\;\;e^{-{M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(n \cdot n\right) \cdot -0.25}\\
\end{array}
\end{array}
if n < 1.40000000000000007e-244Initial program 76.2%
Taylor expanded in K around 0 97.4%
cos-neg97.4%
Simplified97.4%
Taylor expanded in M around 0 91.4%
associate--r+91.4%
fabs-sub91.4%
Simplified91.4%
Taylor expanded in m around inf 54.4%
*-commutative54.4%
Simplified54.4%
if 1.40000000000000007e-244 < n < 55Initial program 82.3%
Taylor expanded in K around 0 92.0%
cos-neg92.0%
Simplified92.0%
Taylor expanded in M around inf 58.3%
mul-1-neg58.3%
Simplified58.3%
Taylor expanded in M around 0 58.3%
if 55 < n Initial program 69.7%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in M around 0 97.0%
associate--r+97.0%
fabs-sub97.0%
Simplified97.0%
Taylor expanded in n around inf 100.0%
*-commutative100.0%
Simplified100.0%
unpow2100.0%
Applied egg-rr100.0%
Final simplification66.8%
(FPCore (K m n M l) :precision binary64 (if (<= m -0.0072) (exp (* (pow m 2.0) -0.25)) (exp (* (* n n) -0.25))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -0.0072) {
tmp = exp((pow(m, 2.0) * -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 (m <= (-0.0072d0)) then
tmp = exp(((m ** 2.0d0) * (-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 (m <= -0.0072) {
tmp = Math.exp((Math.pow(m, 2.0) * -0.25));
} else {
tmp = Math.exp(((n * n) * -0.25));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -0.0072: tmp = math.exp((math.pow(m, 2.0) * -0.25)) else: tmp = math.exp(((n * n) * -0.25)) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -0.0072) tmp = exp(Float64((m ^ 2.0) * -0.25)); else tmp = exp(Float64(Float64(n * n) * -0.25)); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -0.0072) tmp = exp(((m ^ 2.0) * -0.25)); else tmp = exp(((n * n) * -0.25)); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -0.0072], N[Exp[N[(N[Power[m, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision], N[Exp[N[(N[(n * n), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.0072:\\
\;\;\;\;e^{{m}^{2} \cdot -0.25}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(n \cdot n\right) \cdot -0.25}\\
\end{array}
\end{array}
if m < -0.0071999999999999998Initial program 72.6%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in M around 0 100.0%
associate--r+100.0%
fabs-sub100.0%
Simplified100.0%
Taylor expanded in m around inf 95.3%
*-commutative95.3%
Simplified95.3%
if -0.0071999999999999998 < m Initial program 76.6%
Taylor expanded in K around 0 96.2%
cos-neg96.2%
Simplified96.2%
Taylor expanded in M around 0 86.2%
associate--r+86.2%
fabs-sub86.2%
Simplified86.2%
Taylor expanded in n around inf 56.7%
*-commutative56.7%
Simplified56.7%
unpow256.7%
Applied egg-rr56.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(Float64(n * 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), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{\left(n \cdot n\right) \cdot -0.25}
\end{array}
Initial program 75.6%
Taylor expanded in K around 0 97.1%
cos-neg97.1%
Simplified97.1%
Taylor expanded in M around 0 89.5%
associate--r+89.5%
fabs-sub89.5%
Simplified89.5%
Taylor expanded in n around inf 56.2%
*-commutative56.2%
Simplified56.2%
unpow256.2%
Applied egg-rr56.2%
(FPCore (K m n M l) :precision binary64 (cos M))
double code(double K, double m, double n, double M, double l) {
return cos(M);
}
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)
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M);
}
def code(K, m, n, M, l): return math.cos(M)
function code(K, m, n, M, l) return cos(M) end
function tmp = code(K, m, n, M, l) tmp = cos(M); end
code[K_, m_, n_, M_, l_] := N[Cos[M], $MachinePrecision]
\begin{array}{l}
\\
\cos M
\end{array}
Initial program 75.6%
Taylor expanded in l around inf 31.3%
mul-1-neg31.3%
Simplified31.3%
Taylor expanded in l around 0 6.0%
*-commutative6.0%
*-commutative6.0%
associate-*l*6.0%
*-commutative6.0%
Simplified6.0%
Taylor expanded in K around 0 6.7%
cos-neg6.7%
Simplified6.7%
(FPCore (K m n M l) :precision binary64 1.0)
double code(double K, double m, double n, double M, double l) {
return 1.0;
}
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 = 1.0d0
end function
public static double code(double K, double m, double n, double M, double l) {
return 1.0;
}
def code(K, m, n, M, l): return 1.0
function code(K, m, n, M, l) return 1.0 end
function tmp = code(K, m, n, M, l) tmp = 1.0; end
code[K_, m_, n_, M_, l_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 75.6%
Taylor expanded in K around 0 97.1%
cos-neg97.1%
Simplified97.1%
Taylor expanded in M around 0 89.5%
associate--r+89.5%
fabs-sub89.5%
Simplified89.5%
Taylor expanded in n around inf 56.2%
*-commutative56.2%
Simplified56.2%
Taylor expanded in n around 0 6.7%
herbie shell --seed 2024130
(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)))))))