
(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 10 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 (let* ((t_0 (- (/ (+ m n) 2.0) M))) (/ (cos M) (exp (- (+ (* t_0 t_0) l) (fabs (- m n)))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = ((m + n) / 2.0) - M;
return cos(M) / exp((((t_0 * t_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
real(8) :: t_0
t_0 = ((m + n) / 2.0d0) - m_1
code = cos(m_1) / exp((((t_0 * t_0) + l) - abs((m - n))))
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = ((m + n) / 2.0) - M;
return Math.cos(M) / Math.exp((((t_0 * t_0) + l) - Math.abs((m - n))));
}
def code(K, m, n, M, l): t_0 = ((m + n) / 2.0) - M return math.cos(M) / math.exp((((t_0 * t_0) + l) - math.fabs((m - n))))
function code(K, m, n, M, l) t_0 = Float64(Float64(Float64(m + n) / 2.0) - M) return Float64(cos(M) / exp(Float64(Float64(Float64(t_0 * t_0) + l) - abs(Float64(m - n))))) end
function tmp = code(K, m, n, M, l) t_0 = ((m + n) / 2.0) - M; tmp = cos(M) / exp((((t_0 * t_0) + l) - abs((m - n)))); end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]}, N[(N[Cos[M], $MachinePrecision] / N[Exp[N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] + l), $MachinePrecision] - N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{m + n}{2} - M\\
\frac{\cos M}{e^{\left(t\_0 \cdot t\_0 + \ell\right) - \left|m - n\right|}}
\end{array}
\end{array}
Initial program 77.4%
neg-sub0N/A
associate--l-N/A
exp-diffN/A
associate-*r/N/A
exp-0N/A
*-rgt-identityN/A
/-lowering-/.f64N/A
Simplified77.4%
Taylor expanded in K around 0
cos-negN/A
cos-lowering-cos.f6496.7%
Simplified96.7%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (/ (cos M) (exp (* M M)))))
(if (<= M -8e+75)
t_0
(if (<= M 86.0)
(exp (- (- (fabs (- m n)) (* 0.25 (* (+ m n) (+ m n)))) l))
t_0))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(M) / exp((M * M));
double tmp;
if (M <= -8e+75) {
tmp = t_0;
} else if (M <= 86.0) {
tmp = exp(((fabs((m - n)) - (0.25 * ((m + n) * (m + n)))) - l));
} else {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = cos(m_1) / exp((m_1 * m_1))
if (m_1 <= (-8d+75)) then
tmp = t_0
else if (m_1 <= 86.0d0) then
tmp = exp(((abs((m - n)) - (0.25d0 * ((m + n) * (m + n)))) - l))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.cos(M) / Math.exp((M * M));
double tmp;
if (M <= -8e+75) {
tmp = t_0;
} else if (M <= 86.0) {
tmp = Math.exp(((Math.abs((m - n)) - (0.25 * ((m + n) * (m + n)))) - l));
} else {
tmp = t_0;
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(M) / math.exp((M * M)) tmp = 0 if M <= -8e+75: tmp = t_0 elif M <= 86.0: tmp = math.exp(((math.fabs((m - n)) - (0.25 * ((m + n) * (m + n)))) - l)) else: tmp = t_0 return tmp
function code(K, m, n, M, l) t_0 = Float64(cos(M) / exp(Float64(M * M))) tmp = 0.0 if (M <= -8e+75) tmp = t_0; elseif (M <= 86.0) tmp = exp(Float64(Float64(abs(Float64(m - n)) - Float64(0.25 * Float64(Float64(m + n) * Float64(m + n)))) - l)); else tmp = t_0; end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(M) / exp((M * M)); tmp = 0.0; if (M <= -8e+75) tmp = t_0; elseif (M <= 86.0) tmp = exp(((abs((m - n)) - (0.25 * ((m + n) * (m + n)))) - l)); else tmp = t_0; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Cos[M], $MachinePrecision] / N[Exp[N[(M * M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, -8e+75], t$95$0, If[LessEqual[M, 86.0], N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - N[(0.25 * N[(N[(m + n), $MachinePrecision] * N[(m + n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\cos M}{e^{M \cdot M}}\\
\mathbf{if}\;M \leq -8 \cdot 10^{+75}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;M \leq 86:\\
\;\;\;\;e^{\left(\left|m - n\right| - 0.25 \cdot \left(\left(m + n\right) \cdot \left(m + n\right)\right)\right) - \ell}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if M < -7.99999999999999941e75 or 86 < M Initial program 82.6%
neg-sub0N/A
associate--l-N/A
exp-diffN/A
associate-*r/N/A
exp-0N/A
*-rgt-identityN/A
/-lowering-/.f64N/A
Simplified82.6%
Taylor expanded in K around 0
cos-negN/A
cos-lowering-cos.f64100.0%
Simplified100.0%
Taylor expanded in M around inf
unpow2N/A
*-lowering-*.f6499.1%
Simplified99.1%
if -7.99999999999999941e75 < M < 86Initial program 73.6%
neg-sub0N/A
associate--l-N/A
exp-diffN/A
associate-*r/N/A
exp-0N/A
*-rgt-identityN/A
/-lowering-/.f64N/A
Simplified73.6%
Taylor expanded in K around 0
cos-negN/A
cos-lowering-cos.f6494.3%
Simplified94.3%
Taylor expanded in M around 0
rec-expN/A
exp-lowering-exp.f64N/A
neg-sub0N/A
--lowering--.f64N/A
associate--l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
fabs-subN/A
sub-negN/A
mul-1-negN/A
fabs-lowering-fabs.f64N/A
mul-1-negN/A
sub-negN/A
--lowering--.f6493.7%
Simplified93.7%
Final simplification96.0%
(FPCore (K m n M l)
:precision binary64
(if (<= m -54.0)
(exp (* (* m m) -0.25))
(if (<= m 1.4e-305)
(/ (cos M) (exp (* M M)))
(/ (cos M) (exp (* 0.25 (* n n)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -54.0) {
tmp = exp(((m * m) * -0.25));
} else if (m <= 1.4e-305) {
tmp = cos(M) / exp((M * M));
} else {
tmp = cos(M) / exp((0.25 * (n * n)));
}
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 <= (-54.0d0)) then
tmp = exp(((m * m) * (-0.25d0)))
else if (m <= 1.4d-305) then
tmp = cos(m_1) / exp((m_1 * m_1))
else
tmp = cos(m_1) / exp((0.25d0 * (n * n)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -54.0) {
tmp = Math.exp(((m * m) * -0.25));
} else if (m <= 1.4e-305) {
tmp = Math.cos(M) / Math.exp((M * M));
} else {
tmp = Math.cos(M) / Math.exp((0.25 * (n * n)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -54.0: tmp = math.exp(((m * m) * -0.25)) elif m <= 1.4e-305: tmp = math.cos(M) / math.exp((M * M)) else: tmp = math.cos(M) / math.exp((0.25 * (n * n))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -54.0) tmp = exp(Float64(Float64(m * m) * -0.25)); elseif (m <= 1.4e-305) tmp = Float64(cos(M) / exp(Float64(M * M))); else tmp = Float64(cos(M) / exp(Float64(0.25 * Float64(n * n)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -54.0) tmp = exp(((m * m) * -0.25)); elseif (m <= 1.4e-305) tmp = cos(M) / exp((M * M)); else tmp = cos(M) / exp((0.25 * (n * n))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -54.0], N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision], If[LessEqual[m, 1.4e-305], N[(N[Cos[M], $MachinePrecision] / N[Exp[N[(M * M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] / N[Exp[N[(0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -54:\\
\;\;\;\;e^{\left(m \cdot m\right) \cdot -0.25}\\
\mathbf{elif}\;m \leq 1.4 \cdot 10^{-305}:\\
\;\;\;\;\frac{\cos M}{e^{M \cdot M}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos M}{e^{0.25 \cdot \left(n \cdot n\right)}}\\
\end{array}
\end{array}
if m < -54Initial program 76.6%
neg-sub0N/A
associate--l-N/A
exp-diffN/A
associate-*r/N/A
exp-0N/A
*-rgt-identityN/A
/-lowering-/.f64N/A
Simplified76.6%
Taylor expanded in K around 0
cos-negN/A
cos-lowering-cos.f64100.0%
Simplified100.0%
Taylor expanded in M around 0
rec-expN/A
exp-lowering-exp.f64N/A
neg-sub0N/A
--lowering--.f64N/A
associate--l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
fabs-subN/A
sub-negN/A
mul-1-negN/A
fabs-lowering-fabs.f64N/A
mul-1-negN/A
sub-negN/A
--lowering--.f6495.4%
Simplified95.4%
Taylor expanded in m around inf
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6496.9%
Simplified96.9%
if -54 < m < 1.40000000000000007e-305Initial program 78.8%
neg-sub0N/A
associate--l-N/A
exp-diffN/A
associate-*r/N/A
exp-0N/A
*-rgt-identityN/A
/-lowering-/.f64N/A
Simplified78.8%
Taylor expanded in K around 0
cos-negN/A
cos-lowering-cos.f6489.8%
Simplified89.8%
Taylor expanded in M around inf
unpow2N/A
*-lowering-*.f6457.4%
Simplified57.4%
if 1.40000000000000007e-305 < m Initial program 77.2%
neg-sub0N/A
associate--l-N/A
exp-diffN/A
associate-*r/N/A
exp-0N/A
*-rgt-identityN/A
/-lowering-/.f64N/A
Simplified77.2%
Taylor expanded in K around 0
cos-negN/A
cos-lowering-cos.f6498.6%
Simplified98.6%
Taylor expanded in n around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6457.7%
Simplified57.7%
(FPCore (K m n M l) :precision binary64 (if (<= m -2.45e+22) (exp (* (* m m) -0.25)) (exp (- (fabs (- m n)) (+ l (* 0.25 (* n n)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -2.45e+22) {
tmp = exp(((m * m) * -0.25));
} else {
tmp = exp((fabs((m - n)) - (l + (0.25 * (n * n)))));
}
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 <= (-2.45d+22)) then
tmp = exp(((m * m) * (-0.25d0)))
else
tmp = exp((abs((m - n)) - (l + (0.25d0 * (n * n)))))
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.45e+22) {
tmp = Math.exp(((m * m) * -0.25));
} else {
tmp = Math.exp((Math.abs((m - n)) - (l + (0.25 * (n * n)))));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -2.45e+22: tmp = math.exp(((m * m) * -0.25)) else: tmp = math.exp((math.fabs((m - n)) - (l + (0.25 * (n * n))))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -2.45e+22) tmp = exp(Float64(Float64(m * m) * -0.25)); else tmp = exp(Float64(abs(Float64(m - n)) - Float64(l + Float64(0.25 * Float64(n * n))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -2.45e+22) tmp = exp(((m * m) * -0.25)); else tmp = exp((abs((m - n)) - (l + (0.25 * (n * n))))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -2.45e+22], N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision], N[Exp[N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - N[(l + N[(0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -2.45 \cdot 10^{+22}:\\
\;\;\;\;e^{\left(m \cdot m\right) \cdot -0.25}\\
\mathbf{else}:\\
\;\;\;\;e^{\left|m - n\right| - \left(\ell + 0.25 \cdot \left(n \cdot n\right)\right)}\\
\end{array}
\end{array}
if m < -2.4499999999999999e22Initial program 77.0%
neg-sub0N/A
associate--l-N/A
exp-diffN/A
associate-*r/N/A
exp-0N/A
*-rgt-identityN/A
/-lowering-/.f64N/A
Simplified77.0%
Taylor expanded in K around 0
cos-negN/A
cos-lowering-cos.f64100.0%
Simplified100.0%
Taylor expanded in M around 0
rec-expN/A
exp-lowering-exp.f64N/A
neg-sub0N/A
--lowering--.f64N/A
associate--l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
fabs-subN/A
sub-negN/A
mul-1-negN/A
fabs-lowering-fabs.f64N/A
mul-1-negN/A
sub-negN/A
--lowering--.f6495.2%
Simplified95.2%
Taylor expanded in m around inf
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64100.0%
Simplified100.0%
if -2.4499999999999999e22 < m Initial program 77.6%
neg-sub0N/A
associate--l-N/A
exp-diffN/A
associate-*r/N/A
exp-0N/A
*-rgt-identityN/A
/-lowering-/.f64N/A
Simplified77.6%
Taylor expanded in K around 0
cos-negN/A
cos-lowering-cos.f6495.7%
Simplified95.7%
Taylor expanded in M around 0
rec-expN/A
exp-lowering-exp.f64N/A
neg-sub0N/A
--lowering--.f64N/A
associate--l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
fabs-subN/A
sub-negN/A
mul-1-negN/A
fabs-lowering-fabs.f64N/A
mul-1-negN/A
sub-negN/A
--lowering--.f6483.7%
Simplified83.7%
Taylor expanded in m around 0
sub-negN/A
mul-1-negN/A
exp-lowering-exp.f64N/A
mul-1-negN/A
sub-negN/A
--lowering--.f64N/A
fabs-subN/A
sub-negN/A
mul-1-negN/A
fabs-lowering-fabs.f64N/A
mul-1-negN/A
sub-negN/A
--lowering--.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6465.5%
Simplified65.5%
(FPCore (K m n M l) :precision binary64 (if (<= m -55.0) (exp (* (* m m) -0.25)) (if (<= m 9.2e-306) (/ (cos M) (exp (* M M))) (exp (* -0.25 (* n n))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -55.0) {
tmp = exp(((m * m) * -0.25));
} else if (m <= 9.2e-306) {
tmp = cos(M) / exp((M * M));
} else {
tmp = exp((-0.25 * (n * n)));
}
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 <= (-55.0d0)) then
tmp = exp(((m * m) * (-0.25d0)))
else if (m <= 9.2d-306) then
tmp = cos(m_1) / exp((m_1 * m_1))
else
tmp = exp(((-0.25d0) * (n * n)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -55.0) {
tmp = Math.exp(((m * m) * -0.25));
} else if (m <= 9.2e-306) {
tmp = Math.cos(M) / Math.exp((M * M));
} else {
tmp = Math.exp((-0.25 * (n * n)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -55.0: tmp = math.exp(((m * m) * -0.25)) elif m <= 9.2e-306: tmp = math.cos(M) / math.exp((M * M)) else: tmp = math.exp((-0.25 * (n * n))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -55.0) tmp = exp(Float64(Float64(m * m) * -0.25)); elseif (m <= 9.2e-306) tmp = Float64(cos(M) / exp(Float64(M * M))); else tmp = exp(Float64(-0.25 * Float64(n * n))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -55.0) tmp = exp(((m * m) * -0.25)); elseif (m <= 9.2e-306) tmp = cos(M) / exp((M * M)); else tmp = exp((-0.25 * (n * n))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -55.0], N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision], If[LessEqual[m, 9.2e-306], N[(N[Cos[M], $MachinePrecision] / N[Exp[N[(M * M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -55:\\
\;\;\;\;e^{\left(m \cdot m\right) \cdot -0.25}\\
\mathbf{elif}\;m \leq 9.2 \cdot 10^{-306}:\\
\;\;\;\;\frac{\cos M}{e^{M \cdot M}}\\
\mathbf{else}:\\
\;\;\;\;e^{-0.25 \cdot \left(n \cdot n\right)}\\
\end{array}
\end{array}
if m < -55Initial program 76.6%
neg-sub0N/A
associate--l-N/A
exp-diffN/A
associate-*r/N/A
exp-0N/A
*-rgt-identityN/A
/-lowering-/.f64N/A
Simplified76.6%
Taylor expanded in K around 0
cos-negN/A
cos-lowering-cos.f64100.0%
Simplified100.0%
Taylor expanded in M around 0
rec-expN/A
exp-lowering-exp.f64N/A
neg-sub0N/A
--lowering--.f64N/A
associate--l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
fabs-subN/A
sub-negN/A
mul-1-negN/A
fabs-lowering-fabs.f64N/A
mul-1-negN/A
sub-negN/A
--lowering--.f6495.4%
Simplified95.4%
Taylor expanded in m around inf
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6496.9%
Simplified96.9%
if -55 < m < 9.19999999999999956e-306Initial program 78.8%
neg-sub0N/A
associate--l-N/A
exp-diffN/A
associate-*r/N/A
exp-0N/A
*-rgt-identityN/A
/-lowering-/.f64N/A
Simplified78.8%
Taylor expanded in K around 0
cos-negN/A
cos-lowering-cos.f6489.8%
Simplified89.8%
Taylor expanded in M around inf
unpow2N/A
*-lowering-*.f6457.4%
Simplified57.4%
if 9.19999999999999956e-306 < m Initial program 77.2%
neg-sub0N/A
associate--l-N/A
exp-diffN/A
associate-*r/N/A
exp-0N/A
*-rgt-identityN/A
/-lowering-/.f64N/A
Simplified77.2%
Taylor expanded in K around 0
cos-negN/A
cos-lowering-cos.f6498.6%
Simplified98.6%
Taylor expanded in M around 0
rec-expN/A
exp-lowering-exp.f64N/A
neg-sub0N/A
--lowering--.f64N/A
associate--l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
fabs-subN/A
sub-negN/A
mul-1-negN/A
fabs-lowering-fabs.f64N/A
mul-1-negN/A
sub-negN/A
--lowering--.f6489.5%
Simplified89.5%
Taylor expanded in n around inf
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6457.7%
Simplified57.7%
Final simplification67.4%
(FPCore (K m n M l) :precision binary64 (let* ((t_0 (exp (* (* m m) -0.25)))) (if (<= m -9.5e+17) t_0 (if (<= m 3.9e-16) (exp (- 0.0 l)) t_0))))
double code(double K, double m, double n, double M, double l) {
double t_0 = exp(((m * m) * -0.25));
double tmp;
if (m <= -9.5e+17) {
tmp = t_0;
} else if (m <= 3.9e-16) {
tmp = exp((0.0 - l));
} else {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = exp(((m * m) * (-0.25d0)))
if (m <= (-9.5d+17)) then
tmp = t_0
else if (m <= 3.9d-16) then
tmp = exp((0.0d0 - l))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.exp(((m * m) * -0.25));
double tmp;
if (m <= -9.5e+17) {
tmp = t_0;
} else if (m <= 3.9e-16) {
tmp = Math.exp((0.0 - l));
} else {
tmp = t_0;
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.exp(((m * m) * -0.25)) tmp = 0 if m <= -9.5e+17: tmp = t_0 elif m <= 3.9e-16: tmp = math.exp((0.0 - l)) else: tmp = t_0 return tmp
function code(K, m, n, M, l) t_0 = exp(Float64(Float64(m * m) * -0.25)) tmp = 0.0 if (m <= -9.5e+17) tmp = t_0; elseif (m <= 3.9e-16) tmp = exp(Float64(0.0 - l)); else tmp = t_0; end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = exp(((m * m) * -0.25)); tmp = 0.0; if (m <= -9.5e+17) tmp = t_0; elseif (m <= 3.9e-16) tmp = exp((0.0 - l)); else tmp = t_0; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[m, -9.5e+17], t$95$0, If[LessEqual[m, 3.9e-16], N[Exp[N[(0.0 - l), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\left(m \cdot m\right) \cdot -0.25}\\
\mathbf{if}\;m \leq -9.5 \cdot 10^{+17}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq 3.9 \cdot 10^{-16}:\\
\;\;\;\;e^{0 - \ell}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < -9.5e17 or 3.89999999999999977e-16 < m Initial program 77.2%
neg-sub0N/A
associate--l-N/A
exp-diffN/A
associate-*r/N/A
exp-0N/A
*-rgt-identityN/A
/-lowering-/.f64N/A
Simplified77.2%
Taylor expanded in K around 0
cos-negN/A
cos-lowering-cos.f64100.0%
Simplified100.0%
Taylor expanded in M around 0
rec-expN/A
exp-lowering-exp.f64N/A
neg-sub0N/A
--lowering--.f64N/A
associate--l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
fabs-subN/A
sub-negN/A
mul-1-negN/A
fabs-lowering-fabs.f64N/A
mul-1-negN/A
sub-negN/A
--lowering--.f6496.4%
Simplified96.4%
Taylor expanded in m around inf
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6496.4%
Simplified96.4%
if -9.5e17 < m < 3.89999999999999977e-16Initial program 77.7%
neg-sub0N/A
associate--l-N/A
exp-diffN/A
associate-*r/N/A
exp-0N/A
*-rgt-identityN/A
/-lowering-/.f64N/A
Simplified77.7%
Taylor expanded in K around 0
cos-negN/A
cos-lowering-cos.f6493.0%
Simplified93.0%
Taylor expanded in M around 0
rec-expN/A
exp-lowering-exp.f64N/A
neg-sub0N/A
--lowering--.f64N/A
associate--l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
fabs-subN/A
sub-negN/A
mul-1-negN/A
fabs-lowering-fabs.f64N/A
mul-1-negN/A
sub-negN/A
--lowering--.f6475.2%
Simplified75.2%
Taylor expanded in l around inf
neg-mul-1N/A
neg-sub0N/A
--lowering--.f6442.5%
Simplified42.5%
(FPCore (K m n M l) :precision binary64 (if (<= n 54.0) (exp (* (* m m) -0.25)) (exp (* -0.25 (* n n)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 54.0) {
tmp = exp(((m * m) * -0.25));
} else {
tmp = exp((-0.25 * (n * n)));
}
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 <= 54.0d0) then
tmp = exp(((m * m) * (-0.25d0)))
else
tmp = exp(((-0.25d0) * (n * n)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 54.0) {
tmp = Math.exp(((m * m) * -0.25));
} else {
tmp = Math.exp((-0.25 * (n * n)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 54.0: tmp = math.exp(((m * m) * -0.25)) else: tmp = math.exp((-0.25 * (n * n))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 54.0) tmp = exp(Float64(Float64(m * m) * -0.25)); else tmp = exp(Float64(-0.25 * Float64(n * n))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 54.0) tmp = exp(((m * m) * -0.25)); else tmp = exp((-0.25 * (n * n))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 54.0], N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision], N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 54:\\
\;\;\;\;e^{\left(m \cdot m\right) \cdot -0.25}\\
\mathbf{else}:\\
\;\;\;\;e^{-0.25 \cdot \left(n \cdot n\right)}\\
\end{array}
\end{array}
if n < 54Initial program 79.6%
neg-sub0N/A
associate--l-N/A
exp-diffN/A
associate-*r/N/A
exp-0N/A
*-rgt-identityN/A
/-lowering-/.f64N/A
Simplified79.6%
Taylor expanded in K around 0
cos-negN/A
cos-lowering-cos.f6496.2%
Simplified96.2%
Taylor expanded in M around 0
rec-expN/A
exp-lowering-exp.f64N/A
neg-sub0N/A
--lowering--.f64N/A
associate--l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
fabs-subN/A
sub-negN/A
mul-1-negN/A
fabs-lowering-fabs.f64N/A
mul-1-negN/A
sub-negN/A
--lowering--.f6482.7%
Simplified82.7%
Taylor expanded in m around inf
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6455.8%
Simplified55.8%
if 54 < n Initial program 70.5%
neg-sub0N/A
associate--l-N/A
exp-diffN/A
associate-*r/N/A
exp-0N/A
*-rgt-identityN/A
/-lowering-/.f64N/A
Simplified70.5%
Taylor expanded in K around 0
cos-negN/A
cos-lowering-cos.f6498.4%
Simplified98.4%
Taylor expanded in M around 0
rec-expN/A
exp-lowering-exp.f64N/A
neg-sub0N/A
--lowering--.f64N/A
associate--l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
fabs-subN/A
sub-negN/A
mul-1-negN/A
fabs-lowering-fabs.f64N/A
mul-1-negN/A
sub-negN/A
--lowering--.f6498.4%
Simplified98.4%
Taylor expanded in n around inf
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6496.8%
Simplified96.8%
Final simplification65.6%
(FPCore (K m n M l) :precision binary64 (exp (- 0.0 l)))
double code(double K, double m, double n, double M, double l) {
return exp((0.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 = exp((0.0d0 - l))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.exp((0.0 - l));
}
def code(K, m, n, M, l): return math.exp((0.0 - l))
function code(K, m, n, M, l) return exp(Float64(0.0 - l)) end
function tmp = code(K, m, n, M, l) tmp = exp((0.0 - l)); end
code[K_, m_, n_, M_, l_] := N[Exp[N[(0.0 - l), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{0 - \ell}
\end{array}
Initial program 77.4%
neg-sub0N/A
associate--l-N/A
exp-diffN/A
associate-*r/N/A
exp-0N/A
*-rgt-identityN/A
/-lowering-/.f64N/A
Simplified77.4%
Taylor expanded in K around 0
cos-negN/A
cos-lowering-cos.f6496.7%
Simplified96.7%
Taylor expanded in M around 0
rec-expN/A
exp-lowering-exp.f64N/A
neg-sub0N/A
--lowering--.f64N/A
associate--l+N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
fabs-subN/A
sub-negN/A
mul-1-negN/A
fabs-lowering-fabs.f64N/A
mul-1-negN/A
sub-negN/A
--lowering--.f6486.5%
Simplified86.5%
Taylor expanded in l around inf
neg-mul-1N/A
neg-sub0N/A
--lowering--.f6436.5%
Simplified36.5%
(FPCore (K m n M l) :precision binary64 (+ 1.0 (* l (+ (* l 0.5) -1.0))))
double code(double K, double m, double n, double M, double l) {
return 1.0 + (l * ((l * 0.5) + -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 + (l * ((l * 0.5d0) + (-1.0d0)))
end function
public static double code(double K, double m, double n, double M, double l) {
return 1.0 + (l * ((l * 0.5) + -1.0));
}
def code(K, m, n, M, l): return 1.0 + (l * ((l * 0.5) + -1.0))
function code(K, m, n, M, l) return Float64(1.0 + Float64(l * Float64(Float64(l * 0.5) + -1.0))) end
function tmp = code(K, m, n, M, l) tmp = 1.0 + (l * ((l * 0.5) + -1.0)); end
code[K_, m_, n_, M_, l_] := N[(1.0 + N[(l * N[(N[(l * 0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \ell \cdot \left(\ell \cdot 0.5 + -1\right)
\end{array}
Initial program 77.4%
Taylor expanded in l around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f6433.5%
Simplified33.5%
Taylor expanded in l around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6410.7%
Simplified10.7%
Taylor expanded in K around 0
cos-negN/A
cos-lowering-cos.f649.8%
Simplified9.8%
Taylor expanded in M around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f649.8%
Simplified9.8%
Final simplification9.8%
(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 77.4%
Taylor expanded in n around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6437.9%
Simplified37.9%
Taylor expanded in n around 0
cos-lowering-cos.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f648.2%
Simplified8.2%
Taylor expanded in m around 0
cos-negN/A
cos-lowering-cos.f648.4%
Simplified8.4%
Taylor expanded in M around 0
Simplified8.4%
herbie shell --seed 2024144
(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)))))))