
(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 74.4%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6498.3
Simplified98.3%
Final simplification98.3%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (exp (* M (- M)))))
(if (<= M -0.175)
(* (cos M) t_0)
(if (<= M 27.0)
(exp (- (fabs (- m n)) (fma 0.25 (* (+ m n) (+ m n)) l)))
t_0))))
double code(double K, double m, double n, double M, double l) {
double t_0 = exp((M * -M));
double tmp;
if (M <= -0.175) {
tmp = cos(M) * t_0;
} else if (M <= 27.0) {
tmp = exp((fabs((m - n)) - fma(0.25, ((m + n) * (m + n)), l)));
} else {
tmp = t_0;
}
return tmp;
}
function code(K, m, n, M, l) t_0 = exp(Float64(M * Float64(-M))) tmp = 0.0 if (M <= -0.175) tmp = Float64(cos(M) * t_0); elseif (M <= 27.0) tmp = exp(Float64(abs(Float64(m - n)) - fma(0.25, Float64(Float64(m + n) * Float64(m + n)), l))); else tmp = t_0; end return tmp end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[N[(M * (-M)), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[M, -0.175], N[(N[Cos[M], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[M, 27.0], N[Exp[N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - N[(0.25 * N[(N[(m + n), $MachinePrecision] * N[(m + n), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{M \cdot \left(-M\right)}\\
\mathbf{if}\;M \leq -0.175:\\
\;\;\;\;\cos M \cdot t\_0\\
\mathbf{elif}\;M \leq 27:\\
\;\;\;\;e^{\left|m - n\right| - \mathsf{fma}\left(0.25, \left(m + n\right) \cdot \left(m + n\right), \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if M < -0.17499999999999999Initial program 80.4%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6497.2
Simplified97.2%
Taylor expanded in M around inf
mul-1-negN/A
unpow2N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6495.5
Simplified95.5%
if -0.17499999999999999 < M < 27Initial program 71.8%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6498.1
Simplified98.1%
Taylor expanded in M around 0
lower-exp.f64N/A
lower--.f64N/A
fabs-subN/A
sub-negN/A
mul-1-negN/A
lower-fabs.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6498.1
Simplified98.1%
if 27 < M Initial program 75.0%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f64100.0
Simplified100.0%
Taylor expanded in M around inf
mul-1-negN/A
unpow2N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f64100.0
Simplified100.0%
Taylor expanded in M around 0
Simplified100.0%
Final simplification98.0%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (exp (* M (- M)))))
(if (<= M -0.175)
t_0
(if (<= M 27.0)
(exp (- (fabs (- m n)) (fma 0.25 (* (+ m n) (+ m n)) l)))
t_0))))
double code(double K, double m, double n, double M, double l) {
double t_0 = exp((M * -M));
double tmp;
if (M <= -0.175) {
tmp = t_0;
} else if (M <= 27.0) {
tmp = exp((fabs((m - n)) - fma(0.25, ((m + n) * (m + n)), l)));
} else {
tmp = t_0;
}
return tmp;
}
function code(K, m, n, M, l) t_0 = exp(Float64(M * Float64(-M))) tmp = 0.0 if (M <= -0.175) tmp = t_0; elseif (M <= 27.0) tmp = exp(Float64(abs(Float64(m - n)) - fma(0.25, Float64(Float64(m + n) * Float64(m + n)), l))); else tmp = t_0; end return tmp end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[N[(M * (-M)), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[M, -0.175], t$95$0, If[LessEqual[M, 27.0], N[Exp[N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - N[(0.25 * N[(N[(m + n), $MachinePrecision] * N[(m + n), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{M \cdot \left(-M\right)}\\
\mathbf{if}\;M \leq -0.175:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;M \leq 27:\\
\;\;\;\;e^{\left|m - n\right| - \mathsf{fma}\left(0.25, \left(m + n\right) \cdot \left(m + n\right), \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if M < -0.17499999999999999 or 27 < M Initial program 77.7%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6498.6
Simplified98.6%
Taylor expanded in M around inf
mul-1-negN/A
unpow2N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6497.7
Simplified97.7%
Taylor expanded in M around 0
Simplified97.6%
if -0.17499999999999999 < M < 27Initial program 71.8%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6498.1
Simplified98.1%
Taylor expanded in M around 0
lower-exp.f64N/A
lower--.f64N/A
fabs-subN/A
sub-negN/A
mul-1-negN/A
lower-fabs.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6498.1
Simplified98.1%
Final simplification97.9%
(FPCore (K m n M l) :precision binary64 (if (<= m -0.105) (exp (* (* m m) -0.25)) (if (<= m -2.6e-288) (exp (* M (- M))) (exp (* n (* n -0.25))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -0.105) {
tmp = exp(((m * m) * -0.25));
} else if (m <= -2.6e-288) {
tmp = 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 (m <= (-0.105d0)) then
tmp = exp(((m * m) * (-0.25d0)))
else if (m <= (-2.6d-288)) then
tmp = 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 (m <= -0.105) {
tmp = Math.exp(((m * m) * -0.25));
} else if (m <= -2.6e-288) {
tmp = Math.exp((M * -M));
} else {
tmp = Math.exp((n * (n * -0.25)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -0.105: tmp = math.exp(((m * m) * -0.25)) elif m <= -2.6e-288: tmp = 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 (m <= -0.105) tmp = exp(Float64(Float64(m * m) * -0.25)); elseif (m <= -2.6e-288) tmp = 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 (m <= -0.105) tmp = exp(((m * m) * -0.25)); elseif (m <= -2.6e-288) tmp = exp((M * -M)); else tmp = exp((n * (n * -0.25))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -0.105], N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision], If[LessEqual[m, -2.6e-288], N[Exp[N[(M * (-M)), $MachinePrecision]], $MachinePrecision], N[Exp[N[(n * N[(n * -0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.105:\\
\;\;\;\;e^{\left(m \cdot m\right) \cdot -0.25}\\
\mathbf{elif}\;m \leq -2.6 \cdot 10^{-288}:\\
\;\;\;\;e^{M \cdot \left(-M\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{n \cdot \left(n \cdot -0.25\right)}\\
\end{array}
\end{array}
if m < -0.104999999999999996Initial program 70.2%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6499.9
Simplified99.9%
Taylor expanded in M around 0
lower-exp.f64N/A
lower--.f64N/A
fabs-subN/A
sub-negN/A
mul-1-negN/A
lower-fabs.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6498.6
Simplified98.6%
Taylor expanded in m around inf
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6496.1
Simplified96.1%
if -0.104999999999999996 < m < -2.59999999999999989e-288Initial program 81.8%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6498.2
Simplified98.2%
Taylor expanded in M around inf
mul-1-negN/A
unpow2N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6461.2
Simplified61.2%
Taylor expanded in M around 0
Simplified61.2%
if -2.59999999999999989e-288 < m Initial program 73.6%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6497.5
Simplified97.5%
Taylor expanded in M around 0
lower-exp.f64N/A
lower--.f64N/A
fabs-subN/A
sub-negN/A
mul-1-negN/A
lower-fabs.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6487.4
Simplified87.4%
Taylor expanded in n around inf
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6460.7
Simplified60.7%
Final simplification71.1%
(FPCore (K m n M l) :precision binary64 (if (<= m -42.0) (exp (* (* m m) -0.25)) (if (<= m -1.15e-157) (exp (- l)) (exp (* n (* n -0.25))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -42.0) {
tmp = exp(((m * m) * -0.25));
} else if (m <= -1.15e-157) {
tmp = 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 (m <= (-42.0d0)) then
tmp = exp(((m * m) * (-0.25d0)))
else if (m <= (-1.15d-157)) then
tmp = 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 (m <= -42.0) {
tmp = Math.exp(((m * m) * -0.25));
} else if (m <= -1.15e-157) {
tmp = Math.exp(-l);
} else {
tmp = Math.exp((n * (n * -0.25)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -42.0: tmp = math.exp(((m * m) * -0.25)) elif m <= -1.15e-157: tmp = math.exp(-l) else: tmp = math.exp((n * (n * -0.25))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -42.0) tmp = exp(Float64(Float64(m * m) * -0.25)); elseif (m <= -1.15e-157) tmp = exp(Float64(-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 (m <= -42.0) tmp = exp(((m * m) * -0.25)); elseif (m <= -1.15e-157) tmp = exp(-l); else tmp = exp((n * (n * -0.25))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -42.0], N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision], If[LessEqual[m, -1.15e-157], N[Exp[(-l)], $MachinePrecision], N[Exp[N[(n * N[(n * -0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -42:\\
\;\;\;\;e^{\left(m \cdot m\right) \cdot -0.25}\\
\mathbf{elif}\;m \leq -1.15 \cdot 10^{-157}:\\
\;\;\;\;e^{-\ell}\\
\mathbf{else}:\\
\;\;\;\;e^{n \cdot \left(n \cdot -0.25\right)}\\
\end{array}
\end{array}
if m < -42Initial program 69.7%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6499.9
Simplified99.9%
Taylor expanded in M around 0
lower-exp.f64N/A
lower--.f64N/A
fabs-subN/A
sub-negN/A
mul-1-negN/A
lower-fabs.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6498.5
Simplified98.5%
Taylor expanded in m around inf
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6497.4
Simplified97.4%
if -42 < m < -1.14999999999999994e-157Initial program 90.0%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f64100.0
Simplified100.0%
Taylor expanded in M around 0
lower-exp.f64N/A
lower--.f64N/A
fabs-subN/A
sub-negN/A
mul-1-negN/A
lower-fabs.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6480.5
Simplified80.5%
Taylor expanded in l around inf
mul-1-negN/A
lower-neg.f6454.6
Simplified54.6%
if -1.14999999999999994e-157 < m Initial program 73.5%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6497.3
Simplified97.3%
Taylor expanded in M around 0
lower-exp.f64N/A
lower--.f64N/A
fabs-subN/A
sub-negN/A
mul-1-negN/A
lower-fabs.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6483.8
Simplified83.8%
Taylor expanded in n around inf
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6459.8
Simplified59.8%
(FPCore (K m n M l) :precision binary64 (let* ((t_0 (exp (* n (* n -0.25))))) (if (<= n -2.9e+19) t_0 (if (<= n 4.3e-14) (exp (- l)) t_0))))
double code(double K, double m, double n, double M, double l) {
double t_0 = exp((n * (n * -0.25)));
double tmp;
if (n <= -2.9e+19) {
tmp = t_0;
} else if (n <= 4.3e-14) {
tmp = 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((n * (n * (-0.25d0))))
if (n <= (-2.9d+19)) then
tmp = t_0
else if (n <= 4.3d-14) then
tmp = 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((n * (n * -0.25)));
double tmp;
if (n <= -2.9e+19) {
tmp = t_0;
} else if (n <= 4.3e-14) {
tmp = Math.exp(-l);
} else {
tmp = t_0;
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.exp((n * (n * -0.25))) tmp = 0 if n <= -2.9e+19: tmp = t_0 elif n <= 4.3e-14: tmp = math.exp(-l) else: tmp = t_0 return tmp
function code(K, m, n, M, l) t_0 = exp(Float64(n * Float64(n * -0.25))) tmp = 0.0 if (n <= -2.9e+19) tmp = t_0; elseif (n <= 4.3e-14) tmp = exp(Float64(-l)); else tmp = t_0; end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = exp((n * (n * -0.25))); tmp = 0.0; if (n <= -2.9e+19) tmp = t_0; elseif (n <= 4.3e-14) tmp = exp(-l); else tmp = t_0; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[N[(n * N[(n * -0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[n, -2.9e+19], t$95$0, If[LessEqual[n, 4.3e-14], N[Exp[(-l)], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{n \cdot \left(n \cdot -0.25\right)}\\
\mathbf{if}\;n \leq -2.9 \cdot 10^{+19}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 4.3 \cdot 10^{-14}:\\
\;\;\;\;e^{-\ell}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -2.9e19 or 4.29999999999999998e-14 < n Initial program 68.9%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6499.2
Simplified99.2%
Taylor expanded in M around 0
lower-exp.f64N/A
lower--.f64N/A
fabs-subN/A
sub-negN/A
mul-1-negN/A
lower-fabs.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6496.2
Simplified96.2%
Taylor expanded in n around inf
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6494.0
Simplified94.0%
if -2.9e19 < n < 4.29999999999999998e-14Initial program 80.1%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6497.4
Simplified97.4%
Taylor expanded in M around 0
lower-exp.f64N/A
lower--.f64N/A
fabs-subN/A
sub-negN/A
mul-1-negN/A
lower-fabs.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6478.5
Simplified78.5%
Taylor expanded in l around inf
mul-1-negN/A
lower-neg.f6441.3
Simplified41.3%
(FPCore (K m n M l) :precision binary64 (exp (- l)))
double code(double K, double m, double n, double M, double l) {
return 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 = exp(-l)
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.exp(-l);
}
def code(K, m, n, M, l): return math.exp(-l)
function code(K, m, n, M, l) return exp(Float64(-l)) end
function tmp = code(K, m, n, M, l) tmp = exp(-l); end
code[K_, m_, n_, M_, l_] := N[Exp[(-l)], $MachinePrecision]
\begin{array}{l}
\\
e^{-\ell}
\end{array}
Initial program 74.4%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6498.3
Simplified98.3%
Taylor expanded in M around 0
lower-exp.f64N/A
lower--.f64N/A
fabs-subN/A
sub-negN/A
mul-1-negN/A
lower-fabs.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6487.6
Simplified87.6%
Taylor expanded in l around inf
mul-1-negN/A
lower-neg.f6435.6
Simplified35.6%
(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 74.4%
Taylor expanded in n around inf
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6440.4
Simplified40.4%
Taylor expanded in n around 0
lower-cos.f64N/A
sub-negN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f648.1
Simplified8.1%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f648.6
Simplified8.6%
(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 74.4%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f6498.3
Simplified98.3%
Taylor expanded in M around inf
mul-1-negN/A
unpow2N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6449.9
Simplified49.9%
Taylor expanded in M around 0
Simplified8.6%
herbie shell --seed 2024207
(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)))))))