
(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 (* 0.5 (+ n m)))) (* (cos M) (exp (+ (fabs (- n m)) (- (* (- t_0 M) (- M t_0)) l))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = 0.5 * (n + m);
return cos(M) * exp((fabs((n - m)) + (((t_0 - M) * (M - t_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
real(8) :: t_0
t_0 = 0.5d0 * (n + m)
code = cos(m_1) * exp((abs((n - m)) + (((t_0 - m_1) * (m_1 - t_0)) - l)))
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = 0.5 * (n + m);
return Math.cos(M) * Math.exp((Math.abs((n - m)) + (((t_0 - M) * (M - t_0)) - l)));
}
def code(K, m, n, M, l): t_0 = 0.5 * (n + m) return math.cos(M) * math.exp((math.fabs((n - m)) + (((t_0 - M) * (M - t_0)) - l)))
function code(K, m, n, M, l) t_0 = Float64(0.5 * Float64(n + m)) return Float64(cos(M) * exp(Float64(abs(Float64(n - m)) + Float64(Float64(Float64(t_0 - M) * Float64(M - t_0)) - l)))) end
function tmp = code(K, m, n, M, l) t_0 = 0.5 * (n + m); tmp = cos(M) * exp((abs((n - m)) + (((t_0 - M) * (M - t_0)) - l))); end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(0.5 * N[(n + m), $MachinePrecision]), $MachinePrecision]}, N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] + N[(N[(N[(t$95$0 - M), $MachinePrecision] * N[(M - t$95$0), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(n + m\right)\\
\cos M \cdot e^{\left|n - m\right| + \left(\left(t\_0 - M\right) \cdot \left(M - t\_0\right) - \ell\right)}
\end{array}
\end{array}
Initial program 76.2%
Taylor expanded in K around 0
*-lowering-*.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
exp-lowering-exp.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--.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
Simplified96.4%
Final simplification96.4%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (exp (- 0.0 (* M M)))) (t_1 (* 0.5 (+ n m))))
(if (<= M -1e+116)
t_0
(if (<= M 1.85e+33)
(*
(exp (+ (fabs (- n m)) (- (* (- t_1 M) (- M t_1)) l)))
(+ 1.0 (* (* M M) -0.5)))
t_0))))
double code(double K, double m, double n, double M, double l) {
double t_0 = exp((0.0 - (M * M)));
double t_1 = 0.5 * (n + m);
double tmp;
if (M <= -1e+116) {
tmp = t_0;
} else if (M <= 1.85e+33) {
tmp = exp((fabs((n - m)) + (((t_1 - M) * (M - t_1)) - l))) * (1.0 + ((M * M) * -0.5));
} 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) :: t_1
real(8) :: tmp
t_0 = exp((0.0d0 - (m_1 * m_1)))
t_1 = 0.5d0 * (n + m)
if (m_1 <= (-1d+116)) then
tmp = t_0
else if (m_1 <= 1.85d+33) then
tmp = exp((abs((n - m)) + (((t_1 - m_1) * (m_1 - t_1)) - l))) * (1.0d0 + ((m_1 * m_1) * (-0.5d0)))
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((0.0 - (M * M)));
double t_1 = 0.5 * (n + m);
double tmp;
if (M <= -1e+116) {
tmp = t_0;
} else if (M <= 1.85e+33) {
tmp = Math.exp((Math.abs((n - m)) + (((t_1 - M) * (M - t_1)) - l))) * (1.0 + ((M * M) * -0.5));
} else {
tmp = t_0;
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.exp((0.0 - (M * M))) t_1 = 0.5 * (n + m) tmp = 0 if M <= -1e+116: tmp = t_0 elif M <= 1.85e+33: tmp = math.exp((math.fabs((n - m)) + (((t_1 - M) * (M - t_1)) - l))) * (1.0 + ((M * M) * -0.5)) else: tmp = t_0 return tmp
function code(K, m, n, M, l) t_0 = exp(Float64(0.0 - Float64(M * M))) t_1 = Float64(0.5 * Float64(n + m)) tmp = 0.0 if (M <= -1e+116) tmp = t_0; elseif (M <= 1.85e+33) tmp = Float64(exp(Float64(abs(Float64(n - m)) + Float64(Float64(Float64(t_1 - M) * Float64(M - t_1)) - l))) * Float64(1.0 + Float64(Float64(M * M) * -0.5))); else tmp = t_0; end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = exp((0.0 - (M * M))); t_1 = 0.5 * (n + m); tmp = 0.0; if (M <= -1e+116) tmp = t_0; elseif (M <= 1.85e+33) tmp = exp((abs((n - m)) + (((t_1 - M) * (M - t_1)) - l))) * (1.0 + ((M * M) * -0.5)); else tmp = t_0; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[N[(0.0 - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[(n + m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, -1e+116], t$95$0, If[LessEqual[M, 1.85e+33], N[(N[Exp[N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] + N[(N[(N[(t$95$1 - M), $MachinePrecision] * N[(M - t$95$1), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(M * M), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{0 - M \cdot M}\\
t_1 := 0.5 \cdot \left(n + m\right)\\
\mathbf{if}\;M \leq -1 \cdot 10^{+116}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;M \leq 1.85 \cdot 10^{+33}:\\
\;\;\;\;e^{\left|n - m\right| + \left(\left(t\_1 - M\right) \cdot \left(M - t\_1\right) - \ell\right)} \cdot \left(1 + \left(M \cdot M\right) \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if M < -1.00000000000000002e116 or 1.8499999999999999e33 < M Initial program 83.2%
Taylor expanded in M around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
unpow2N/A
*-lowering-*.f6481.2%
Simplified81.2%
Taylor expanded in K around 0
cos-negN/A
cos-lowering-cos.f6498.1%
Simplified98.1%
Taylor expanded in M around 0
Simplified98.1%
if -1.00000000000000002e116 < M < 1.8499999999999999e33Initial program 71.7%
Taylor expanded in K around 0
*-lowering-*.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
exp-lowering-exp.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--.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
Simplified94.1%
Taylor expanded in M around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6494.1%
Simplified94.1%
Final simplification95.6%
(FPCore (K m n M l)
:precision binary64
(if (<= n -1.5e-175)
(* (cos M) (exp (* -0.25 (* m m))))
(if (<= n 3250.0)
(* (cos M) (/ (- 0.0 -1.0) (exp (+ l (* M M)))))
(exp (* -0.25 (* n n))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= -1.5e-175) {
tmp = cos(M) * exp((-0.25 * (m * m)));
} else if (n <= 3250.0) {
tmp = cos(M) * ((0.0 - -1.0) / exp((l + (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 (n <= (-1.5d-175)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m * m)))
else if (n <= 3250.0d0) then
tmp = cos(m_1) * ((0.0d0 - (-1.0d0)) / exp((l + (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 (n <= -1.5e-175) {
tmp = Math.cos(M) * Math.exp((-0.25 * (m * m)));
} else if (n <= 3250.0) {
tmp = Math.cos(M) * ((0.0 - -1.0) / Math.exp((l + (M * M))));
} else {
tmp = Math.exp((-0.25 * (n * n)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= -1.5e-175: tmp = math.cos(M) * math.exp((-0.25 * (m * m))) elif n <= 3250.0: tmp = math.cos(M) * ((0.0 - -1.0) / math.exp((l + (M * M)))) else: tmp = math.exp((-0.25 * (n * n))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= -1.5e-175) tmp = Float64(cos(M) * exp(Float64(-0.25 * Float64(m * m)))); elseif (n <= 3250.0) tmp = Float64(cos(M) * Float64(Float64(0.0 - -1.0) / exp(Float64(l + 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 (n <= -1.5e-175) tmp = cos(M) * exp((-0.25 * (m * m))); elseif (n <= 3250.0) tmp = cos(M) * ((0.0 - -1.0) / exp((l + (M * M)))); else tmp = exp((-0.25 * (n * n))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, -1.5e-175], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3250.0], N[(N[Cos[M], $MachinePrecision] * N[(N[(0.0 - -1.0), $MachinePrecision] / N[Exp[N[(l + N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.5 \cdot 10^{-175}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(m \cdot m\right)}\\
\mathbf{elif}\;n \leq 3250:\\
\;\;\;\;\cos M \cdot \frac{0 - -1}{e^{\ell + M \cdot M}}\\
\mathbf{else}:\\
\;\;\;\;e^{-0.25 \cdot \left(n \cdot n\right)}\\
\end{array}
\end{array}
if n < -1.5e-175Initial program 75.4%
Taylor expanded in K around 0
*-lowering-*.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
exp-lowering-exp.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--.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
Simplified97.0%
Taylor expanded in m around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6453.2%
Simplified53.2%
if -1.5e-175 < n < 3250Initial program 82.9%
Taylor expanded in K around 0
*-lowering-*.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
exp-lowering-exp.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--.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
Simplified94.1%
exp-diffN/A
+-commutativeN/A
pow2N/A
*-commutativeN/A
metadata-evalN/A
div-invN/A
pow2N/A
clear-numN/A
fabs-subN/A
exp-diffN/A
Applied egg-rr90.2%
Taylor expanded in M around inf
unpow2N/A
*-lowering-*.f6475.0%
Simplified75.0%
if 3250 < n Initial program 69.4%
Taylor expanded in K around 0
*-lowering-*.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
exp-lowering-exp.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--.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
Simplified98.4%
Taylor expanded in n around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6496.8%
Simplified96.8%
Taylor expanded in M around 0
exp-lowering-exp.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6496.8%
Simplified96.8%
Final simplification71.7%
(FPCore (K m n M l)
:precision binary64
(if (<= n -3.5e-181)
(* (cos M) (exp (* -0.25 (* m m))))
(if (<= n 3250.0)
(/ (- 0.0 -1.0) (exp (+ l (* M M))))
(exp (* -0.25 (* n n))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= -3.5e-181) {
tmp = cos(M) * exp((-0.25 * (m * m)));
} else if (n <= 3250.0) {
tmp = (0.0 - -1.0) / exp((l + (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 (n <= (-3.5d-181)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m * m)))
else if (n <= 3250.0d0) then
tmp = (0.0d0 - (-1.0d0)) / exp((l + (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 (n <= -3.5e-181) {
tmp = Math.cos(M) * Math.exp((-0.25 * (m * m)));
} else if (n <= 3250.0) {
tmp = (0.0 - -1.0) / Math.exp((l + (M * M)));
} else {
tmp = Math.exp((-0.25 * (n * n)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= -3.5e-181: tmp = math.cos(M) * math.exp((-0.25 * (m * m))) elif n <= 3250.0: tmp = (0.0 - -1.0) / math.exp((l + (M * M))) else: tmp = math.exp((-0.25 * (n * n))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= -3.5e-181) tmp = Float64(cos(M) * exp(Float64(-0.25 * Float64(m * m)))); elseif (n <= 3250.0) tmp = Float64(Float64(0.0 - -1.0) / exp(Float64(l + 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 (n <= -3.5e-181) tmp = cos(M) * exp((-0.25 * (m * m))); elseif (n <= 3250.0) tmp = (0.0 - -1.0) / exp((l + (M * M))); else tmp = exp((-0.25 * (n * n))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, -3.5e-181], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3250.0], N[(N[(0.0 - -1.0), $MachinePrecision] / N[Exp[N[(l + N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -3.5 \cdot 10^{-181}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(m \cdot m\right)}\\
\mathbf{elif}\;n \leq 3250:\\
\;\;\;\;\frac{0 - -1}{e^{\ell + M \cdot M}}\\
\mathbf{else}:\\
\;\;\;\;e^{-0.25 \cdot \left(n \cdot n\right)}\\
\end{array}
\end{array}
if n < -3.49999999999999996e-181Initial program 75.6%
Taylor expanded in K around 0
*-lowering-*.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
exp-lowering-exp.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--.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
Simplified97.0%
Taylor expanded in m around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6453.6%
Simplified53.6%
if -3.49999999999999996e-181 < n < 3250Initial program 82.7%
Taylor expanded in K around 0
*-lowering-*.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
exp-lowering-exp.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--.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
Simplified94.0%
exp-diffN/A
+-commutativeN/A
pow2N/A
*-commutativeN/A
metadata-evalN/A
div-invN/A
pow2N/A
clear-numN/A
fabs-subN/A
exp-diffN/A
Applied egg-rr90.1%
Taylor expanded in M around inf
unpow2N/A
*-lowering-*.f6474.7%
Simplified74.7%
Taylor expanded in M around 0
Simplified74.6%
if 3250 < n Initial program 69.4%
Taylor expanded in K around 0
*-lowering-*.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
exp-lowering-exp.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--.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
Simplified98.4%
Taylor expanded in n around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6496.8%
Simplified96.8%
Taylor expanded in M around 0
exp-lowering-exp.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6496.8%
Simplified96.8%
Final simplification71.6%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (exp (* -0.25 (* n n)))))
(if (<= n -2050000.0)
t_0
(if (<= n 3250.0) (/ (- 0.0 -1.0) (exp (+ l (* M M)))) t_0))))
double code(double K, double m, double n, double M, double l) {
double t_0 = exp((-0.25 * (n * n)));
double tmp;
if (n <= -2050000.0) {
tmp = t_0;
} else if (n <= 3250.0) {
tmp = (0.0 - -1.0) / exp((l + (M * M)));
} 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(((-0.25d0) * (n * n)))
if (n <= (-2050000.0d0)) then
tmp = t_0
else if (n <= 3250.0d0) then
tmp = (0.0d0 - (-1.0d0)) / exp((l + (m_1 * m_1)))
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((-0.25 * (n * n)));
double tmp;
if (n <= -2050000.0) {
tmp = t_0;
} else if (n <= 3250.0) {
tmp = (0.0 - -1.0) / Math.exp((l + (M * M)));
} else {
tmp = t_0;
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.exp((-0.25 * (n * n))) tmp = 0 if n <= -2050000.0: tmp = t_0 elif n <= 3250.0: tmp = (0.0 - -1.0) / math.exp((l + (M * M))) else: tmp = t_0 return tmp
function code(K, m, n, M, l) t_0 = exp(Float64(-0.25 * Float64(n * n))) tmp = 0.0 if (n <= -2050000.0) tmp = t_0; elseif (n <= 3250.0) tmp = Float64(Float64(0.0 - -1.0) / exp(Float64(l + Float64(M * M)))); else tmp = t_0; end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = exp((-0.25 * (n * n))); tmp = 0.0; if (n <= -2050000.0) tmp = t_0; elseif (n <= 3250.0) tmp = (0.0 - -1.0) / exp((l + (M * M))); else tmp = t_0; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[n, -2050000.0], t$95$0, If[LessEqual[n, 3250.0], N[(N[(0.0 - -1.0), $MachinePrecision] / N[Exp[N[(l + N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-0.25 \cdot \left(n \cdot n\right)}\\
\mathbf{if}\;n \leq -2050000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 3250:\\
\;\;\;\;\frac{0 - -1}{e^{\ell + M \cdot M}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -2.05e6 or 3250 < n Initial program 72.6%
Taylor expanded in K around 0
*-lowering-*.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
exp-lowering-exp.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--.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
Simplified98.5%
Taylor expanded in n around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6495.6%
Simplified95.6%
Taylor expanded in M around 0
exp-lowering-exp.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6495.6%
Simplified95.6%
if -2.05e6 < n < 3250Initial program 80.3%
Taylor expanded in K around 0
*-lowering-*.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
exp-lowering-exp.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--.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
Simplified94.1%
exp-diffN/A
+-commutativeN/A
pow2N/A
*-commutativeN/A
metadata-evalN/A
div-invN/A
pow2N/A
clear-numN/A
fabs-subN/A
exp-diffN/A
Applied egg-rr91.6%
Taylor expanded in M around inf
unpow2N/A
*-lowering-*.f6473.6%
Simplified73.6%
Taylor expanded in M around 0
Simplified73.5%
Final simplification86.4%
(FPCore (K m n M l) :precision binary64 (let* ((t_0 (exp (* -0.25 (* n n))))) (if (<= n -2050000.0) t_0 (if (<= n 54.0) (exp (- 0.0 (* M M))) t_0))))
double code(double K, double m, double n, double M, double l) {
double t_0 = exp((-0.25 * (n * n)));
double tmp;
if (n <= -2050000.0) {
tmp = t_0;
} else if (n <= 54.0) {
tmp = exp((0.0 - (M * M)));
} 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(((-0.25d0) * (n * n)))
if (n <= (-2050000.0d0)) then
tmp = t_0
else if (n <= 54.0d0) then
tmp = exp((0.0d0 - (m_1 * m_1)))
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((-0.25 * (n * n)));
double tmp;
if (n <= -2050000.0) {
tmp = t_0;
} else if (n <= 54.0) {
tmp = Math.exp((0.0 - (M * M)));
} else {
tmp = t_0;
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.exp((-0.25 * (n * n))) tmp = 0 if n <= -2050000.0: tmp = t_0 elif n <= 54.0: tmp = math.exp((0.0 - (M * M))) else: tmp = t_0 return tmp
function code(K, m, n, M, l) t_0 = exp(Float64(-0.25 * Float64(n * n))) tmp = 0.0 if (n <= -2050000.0) tmp = t_0; elseif (n <= 54.0) tmp = exp(Float64(0.0 - Float64(M * M))); else tmp = t_0; end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = exp((-0.25 * (n * n))); tmp = 0.0; if (n <= -2050000.0) tmp = t_0; elseif (n <= 54.0) tmp = exp((0.0 - (M * M))); else tmp = t_0; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[n, -2050000.0], t$95$0, If[LessEqual[n, 54.0], N[Exp[N[(0.0 - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-0.25 \cdot \left(n \cdot n\right)}\\
\mathbf{if}\;n \leq -2050000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 54:\\
\;\;\;\;e^{0 - M \cdot M}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -2.05e6 or 54 < n Initial program 72.1%
Taylor expanded in K around 0
*-lowering-*.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
exp-lowering-exp.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--.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
Simplified97.8%
Taylor expanded in n around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6494.9%
Simplified94.9%
Taylor expanded in M around 0
exp-lowering-exp.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6494.9%
Simplified94.9%
if -2.05e6 < n < 54Initial program 80.9%
Taylor expanded in M around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
unpow2N/A
*-lowering-*.f6453.2%
Simplified53.2%
Taylor expanded in K around 0
cos-negN/A
cos-lowering-cos.f6459.9%
Simplified59.9%
Taylor expanded in M around 0
Simplified59.8%
Final simplification78.4%
(FPCore (K m n M l) :precision binary64 (let* ((t_0 (exp (* -0.25 (* n n))))) (if (<= n -2.5e-19) t_0 (if (<= n 21.0) (/ 1.0 (exp l)) t_0))))
double code(double K, double m, double n, double M, double l) {
double t_0 = exp((-0.25 * (n * n)));
double tmp;
if (n <= -2.5e-19) {
tmp = t_0;
} else if (n <= 21.0) {
tmp = 1.0 / exp(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(((-0.25d0) * (n * n)))
if (n <= (-2.5d-19)) then
tmp = t_0
else if (n <= 21.0d0) then
tmp = 1.0d0 / exp(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((-0.25 * (n * n)));
double tmp;
if (n <= -2.5e-19) {
tmp = t_0;
} else if (n <= 21.0) {
tmp = 1.0 / Math.exp(l);
} else {
tmp = t_0;
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.exp((-0.25 * (n * n))) tmp = 0 if n <= -2.5e-19: tmp = t_0 elif n <= 21.0: tmp = 1.0 / math.exp(l) else: tmp = t_0 return tmp
function code(K, m, n, M, l) t_0 = exp(Float64(-0.25 * Float64(n * n))) tmp = 0.0 if (n <= -2.5e-19) tmp = t_0; elseif (n <= 21.0) tmp = Float64(1.0 / exp(l)); else tmp = t_0; end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = exp((-0.25 * (n * n))); tmp = 0.0; if (n <= -2.5e-19) tmp = t_0; elseif (n <= 21.0) tmp = 1.0 / exp(l); else tmp = t_0; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[n, -2.5e-19], t$95$0, If[LessEqual[n, 21.0], N[(1.0 / N[Exp[l], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-0.25 \cdot \left(n \cdot n\right)}\\
\mathbf{if}\;n \leq -2.5 \cdot 10^{-19}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 21:\\
\;\;\;\;\frac{1}{e^{\ell}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -2.5000000000000002e-19 or 21 < n Initial program 72.3%
Taylor expanded in K around 0
*-lowering-*.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
exp-lowering-exp.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--.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
Simplified97.9%
Taylor expanded in n around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6493.1%
Simplified93.1%
Taylor expanded in M around 0
exp-lowering-exp.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6493.1%
Simplified93.1%
if -2.5000000000000002e-19 < n < 21Initial program 81.0%
Taylor expanded in K around 0
*-lowering-*.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
exp-lowering-exp.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--.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
Simplified94.7%
exp-diffN/A
+-commutativeN/A
pow2N/A
*-commutativeN/A
metadata-evalN/A
div-invN/A
pow2N/A
clear-numN/A
fabs-subN/A
exp-diffN/A
Applied egg-rr91.2%
Taylor expanded in M around inf
unpow2N/A
*-lowering-*.f6473.1%
Simplified73.1%
Taylor expanded in M around 0
/-lowering-/.f64N/A
exp-lowering-exp.f6443.5%
Simplified43.5%
(FPCore (K m n M l) :precision binary64 (/ 1.0 (exp l)))
double code(double K, double m, double n, double M, double l) {
return 1.0 / exp(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 = 1.0d0 / exp(l)
end function
public static double code(double K, double m, double n, double M, double l) {
return 1.0 / Math.exp(l);
}
def code(K, m, n, M, l): return 1.0 / math.exp(l)
function code(K, m, n, M, l) return Float64(1.0 / exp(l)) end
function tmp = code(K, m, n, M, l) tmp = 1.0 / exp(l); end
code[K_, m_, n_, M_, l_] := N[(1.0 / N[Exp[l], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{e^{\ell}}
\end{array}
Initial program 76.2%
Taylor expanded in K around 0
*-lowering-*.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
exp-lowering-exp.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--.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
Simplified96.4%
exp-diffN/A
+-commutativeN/A
pow2N/A
*-commutativeN/A
metadata-evalN/A
div-invN/A
pow2N/A
clear-numN/A
fabs-subN/A
exp-diffN/A
Applied egg-rr94.5%
Taylor expanded in M around inf
unpow2N/A
*-lowering-*.f6464.6%
Simplified64.6%
Taylor expanded in M around 0
/-lowering-/.f64N/A
exp-lowering-exp.f6432.7%
Simplified32.7%
(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 76.2%
Taylor expanded in K around 0
*-lowering-*.f64N/A
cos-negN/A
cos-lowering-cos.f64N/A
exp-lowering-exp.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--.f64N/A
+-lowering-+.f64N/A
unpow2N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
--lowering--.f64N/A
Simplified96.4%
Taylor expanded in n around inf
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6456.9%
Simplified56.9%
Taylor expanded in n around 0
cos-lowering-cos.f647.3%
Simplified7.3%
(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 76.2%
Taylor expanded in M around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
unpow2N/A
*-lowering-*.f6443.5%
Simplified43.5%
Taylor expanded in M around 0
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f646.8%
Simplified6.8%
Taylor expanded in K around 0
Simplified7.3%
herbie shell --seed 2024150
(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)))))))