
(FPCore (K m n M l) :precision binary64 (* (cos (- (/ (* K (+ m n)) 2.0) M)) (exp (- (- (pow (- (/ (+ m n) 2.0) M) 2.0)) (- l (fabs (- m n)))))))
double code(double K, double m, double n, double M, double l) {
return cos((((K * (m + n)) / 2.0) - M)) * exp((-pow((((m + n) / 2.0) - M), 2.0) - (l - fabs((m - n)))));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos((((k * (m + n)) / 2.0d0) - m_1)) * exp((-((((m + n) / 2.0d0) - m_1) ** 2.0d0) - (l - abs((m - n)))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos((((K * (m + n)) / 2.0) - M)) * Math.exp((-Math.pow((((m + n) / 2.0) - M), 2.0) - (l - Math.abs((m - n)))));
}
def code(K, m, n, M, l): return math.cos((((K * (m + n)) / 2.0) - M)) * math.exp((-math.pow((((m + n) / 2.0) - M), 2.0) - (l - math.fabs((m - n)))))
function code(K, m, n, M, l) return Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * exp(Float64(Float64(-(Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)) - Float64(l - abs(Float64(m - n)))))) end
function tmp = code(K, m, n, M, l) tmp = cos((((K * (m + n)) / 2.0) - M)) * exp((-((((m + n) / 2.0) - M) ^ 2.0) - (l - abs((m - n))))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[((-N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]) - N[(l - N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (K m n M l) :precision binary64 (* (cos (- (/ (* K (+ m n)) 2.0) M)) (exp (- (- (pow (- (/ (+ m n) 2.0) M) 2.0)) (- l (fabs (- m n)))))))
double code(double K, double m, double n, double M, double l) {
return cos((((K * (m + n)) / 2.0) - M)) * exp((-pow((((m + n) / 2.0) - M), 2.0) - (l - fabs((m - n)))));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos((((k * (m + n)) / 2.0d0) - m_1)) * exp((-((((m + n) / 2.0d0) - m_1) ** 2.0d0) - (l - abs((m - n)))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos((((K * (m + n)) / 2.0) - M)) * Math.exp((-Math.pow((((m + n) / 2.0) - M), 2.0) - (l - Math.abs((m - n)))));
}
def code(K, m, n, M, l): return math.cos((((K * (m + n)) / 2.0) - M)) * math.exp((-math.pow((((m + n) / 2.0) - M), 2.0) - (l - math.fabs((m - n)))))
function code(K, m, n, M, l) return Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * exp(Float64(Float64(-(Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)) - Float64(l - abs(Float64(m - n)))))) end
function tmp = code(K, m, n, M, l) tmp = cos((((K * (m + n)) / 2.0) - M)) * exp((-((((m + n) / 2.0) - M) ^ 2.0) - (l - abs((m - n))))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[((-N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]) - N[(l - N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}
\end{array}
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (exp (- (- (fabs (- m n)) l) (pow (- (/ (+ m n) 2.0) M) 2.0)))))
(if (<= (* (cos (- (/ (* K (+ m n)) 2.0) M)) t_0) INFINITY)
(* t_0 (cos (- (/ K (/ 2.0 (+ m n))) M)))
(* t_0 (cos (* K 0.5))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = exp(((fabs((m - n)) - l) - pow((((m + n) / 2.0) - M), 2.0)));
double tmp;
if ((cos((((K * (m + n)) / 2.0) - M)) * t_0) <= ((double) INFINITY)) {
tmp = t_0 * cos(((K / (2.0 / (m + n))) - M));
} else {
tmp = t_0 * cos((K * 0.5));
}
return tmp;
}
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.exp(((Math.abs((m - n)) - l) - Math.pow((((m + n) / 2.0) - M), 2.0)));
double tmp;
if ((Math.cos((((K * (m + n)) / 2.0) - M)) * t_0) <= Double.POSITIVE_INFINITY) {
tmp = t_0 * Math.cos(((K / (2.0 / (m + n))) - M));
} else {
tmp = t_0 * Math.cos((K * 0.5));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.exp(((math.fabs((m - n)) - l) - math.pow((((m + n) / 2.0) - M), 2.0))) tmp = 0 if (math.cos((((K * (m + n)) / 2.0) - M)) * t_0) <= math.inf: tmp = t_0 * math.cos(((K / (2.0 / (m + n))) - M)) else: tmp = t_0 * math.cos((K * 0.5)) return tmp
function code(K, m, n, M, l) t_0 = exp(Float64(Float64(abs(Float64(m - n)) - l) - (Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0))) tmp = 0.0 if (Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * t_0) <= Inf) tmp = Float64(t_0 * cos(Float64(Float64(K / Float64(2.0 / Float64(m + n))) - M))); else tmp = Float64(t_0 * cos(Float64(K * 0.5))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = exp(((abs((m - n)) - l) - ((((m + n) / 2.0) - M) ^ 2.0))); tmp = 0.0; if ((cos((((K * (m + n)) / 2.0) - M)) * t_0) <= Inf) tmp = t_0 * cos(((K / (2.0 / (m + n))) - M)); else tmp = t_0 * cos((K * 0.5)); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = 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]}, If[LessEqual[N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], Infinity], N[(t$95$0 * N[Cos[N[(N[(K / N[(2.0 / N[(m + n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\left(\left|m - n\right| - \ell\right) - {\left(\frac{m + n}{2} - M\right)}^{2}}\\
\mathbf{if}\;\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot t\_0 \leq \infty:\\
\;\;\;\;t\_0 \cdot \cos \left(\frac{K}{\frac{2}{m + n}} - M\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \cos \left(K \cdot 0.5\right)\\
\end{array}
\end{array}
if (*.f64 (cos.f64 (-.f64 (/.f64 (*.f64 K (+.f64 m n)) #s(literal 2 binary64)) M)) (exp.f64 (-.f64 (neg.f64 (pow.f64 (-.f64 (/.f64 (+.f64 m n) #s(literal 2 binary64)) M) #s(literal 2 binary64))) (-.f64 l (fabs.f64 (-.f64 m n)))))) < +inf.0Initial program 99.0%
lift-+.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.1
Applied egg-rr99.1%
if +inf.0 < (*.f64 (cos.f64 (-.f64 (/.f64 (*.f64 K (+.f64 m n)) #s(literal 2 binary64)) M)) (exp.f64 (-.f64 (neg.f64 (pow.f64 (-.f64 (/.f64 (+.f64 m n) #s(literal 2 binary64)) M) #s(literal 2 binary64))) (-.f64 l (fabs.f64 (-.f64 m n)))))) Initial program 0.0%
Taylor expanded in m around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f6446.0
Simplified46.0%
Taylor expanded in K around inf
lower-*.f64100.0
Simplified100.0%
Final simplification99.3%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (fma (+ m n) 0.5 (- M)))
(t_1 (fabs (- m n)))
(t_2 (exp (- (- t_1 l) (pow (- (/ (+ m n) 2.0) M) 2.0)))))
(if (<= (* (cos (- (/ (* K (+ m n)) 2.0) M)) t_2) INFINITY)
(* (exp (- (fma t_0 t_0 (- l t_1)))) (cos (fma n (* K 0.5) (- M))))
(* t_2 (cos (* K 0.5))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fma((m + n), 0.5, -M);
double t_1 = fabs((m - n));
double t_2 = exp(((t_1 - l) - pow((((m + n) / 2.0) - M), 2.0)));
double tmp;
if ((cos((((K * (m + n)) / 2.0) - M)) * t_2) <= ((double) INFINITY)) {
tmp = exp(-fma(t_0, t_0, (l - t_1))) * cos(fma(n, (K * 0.5), -M));
} else {
tmp = t_2 * cos((K * 0.5));
}
return tmp;
}
function code(K, m, n, M, l) t_0 = fma(Float64(m + n), 0.5, Float64(-M)) t_1 = abs(Float64(m - n)) t_2 = exp(Float64(Float64(t_1 - l) - (Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0))) tmp = 0.0 if (Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * t_2) <= Inf) tmp = Float64(exp(Float64(-fma(t_0, t_0, Float64(l - t_1)))) * cos(fma(n, Float64(K * 0.5), Float64(-M)))); else tmp = Float64(t_2 * cos(Float64(K * 0.5))); end return tmp end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[(m + n), $MachinePrecision] * 0.5 + (-M)), $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Exp[N[(N[(t$95$1 - l), $MachinePrecision] - N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * t$95$2), $MachinePrecision], Infinity], N[(N[Exp[(-N[(t$95$0 * t$95$0 + N[(l - t$95$1), $MachinePrecision]), $MachinePrecision])], $MachinePrecision] * N[Cos[N[(n * N[(K * 0.5), $MachinePrecision] + (-M)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(m + n, 0.5, -M\right)\\
t_1 := \left|m - n\right|\\
t_2 := e^{\left(t\_1 - \ell\right) - {\left(\frac{m + n}{2} - M\right)}^{2}}\\
\mathbf{if}\;\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot t\_2 \leq \infty:\\
\;\;\;\;e^{-\mathsf{fma}\left(t\_0, t\_0, \ell - t\_1\right)} \cdot \cos \left(\mathsf{fma}\left(n, K \cdot 0.5, -M\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2 \cdot \cos \left(K \cdot 0.5\right)\\
\end{array}
\end{array}
if (*.f64 (cos.f64 (-.f64 (/.f64 (*.f64 K (+.f64 m n)) #s(literal 2 binary64)) M)) (exp.f64 (-.f64 (neg.f64 (pow.f64 (-.f64 (/.f64 (+.f64 m n) #s(literal 2 binary64)) M) #s(literal 2 binary64))) (-.f64 l (fabs.f64 (-.f64 m n)))))) < +inf.0Initial program 99.0%
Taylor expanded in m around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f6498.5
Simplified98.5%
Applied egg-rr98.5%
if +inf.0 < (*.f64 (cos.f64 (-.f64 (/.f64 (*.f64 K (+.f64 m n)) #s(literal 2 binary64)) M)) (exp.f64 (-.f64 (neg.f64 (pow.f64 (-.f64 (/.f64 (+.f64 m n) #s(literal 2 binary64)) M) #s(literal 2 binary64))) (-.f64 l (fabs.f64 (-.f64 m n)))))) Initial program 0.0%
Taylor expanded in m around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f6446.0
Simplified46.0%
Taylor expanded in K around inf
lower-*.f64100.0
Simplified100.0%
Final simplification98.8%
(FPCore (K m n M l) :precision binary64 (let* ((t_0 (- (* (+ m n) 0.5) M))) (exp (- (fabs (- m n)) (fma t_0 t_0 l)))))
double code(double K, double m, double n, double M, double l) {
double t_0 = ((m + n) * 0.5) - M;
return exp((fabs((m - n)) - fma(t_0, t_0, l)));
}
function code(K, m, n, M, l) t_0 = Float64(Float64(Float64(m + n) * 0.5) - M) return exp(Float64(abs(Float64(m - n)) - fma(t_0, t_0, l))) end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision] - M), $MachinePrecision]}, N[Exp[N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - N[(t$95$0 * t$95$0 + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(m + n\right) \cdot 0.5 - M\\
e^{\left|m - n\right| - \mathsf{fma}\left(t\_0, t\_0, \ell\right)}
\end{array}
\end{array}
Initial program 79.7%
Taylor expanded in m around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f6488.3
Simplified88.3%
Taylor expanded in K around inf
lower-*.f6496.8
Simplified96.8%
Taylor expanded in K around 0
Simplified97.2%
Taylor expanded in m around inf
lower-exp.f64N/A
lower--.f64N/A
sub-negN/A
mul-1-negN/A
lower-fabs.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower--.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f6497.2
Simplified97.2%
Final simplification97.2%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (exp (- l))))
(if (<= M -5.5e-47)
t_0
(if (<= M 4.1e-101) (* t_0 (* -0.5 (* M (* M M)))) t_0))))
double code(double K, double m, double n, double M, double l) {
double t_0 = exp(-l);
double tmp;
if (M <= -5.5e-47) {
tmp = t_0;
} else if (M <= 4.1e-101) {
tmp = t_0 * (-0.5 * (M * (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(-l)
if (m_1 <= (-5.5d-47)) then
tmp = t_0
else if (m_1 <= 4.1d-101) then
tmp = t_0 * ((-0.5d0) * (m_1 * (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(-l);
double tmp;
if (M <= -5.5e-47) {
tmp = t_0;
} else if (M <= 4.1e-101) {
tmp = t_0 * (-0.5 * (M * (M * M)));
} else {
tmp = t_0;
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.exp(-l) tmp = 0 if M <= -5.5e-47: tmp = t_0 elif M <= 4.1e-101: tmp = t_0 * (-0.5 * (M * (M * M))) else: tmp = t_0 return tmp
function code(K, m, n, M, l) t_0 = exp(Float64(-l)) tmp = 0.0 if (M <= -5.5e-47) tmp = t_0; elseif (M <= 4.1e-101) tmp = Float64(t_0 * Float64(-0.5 * Float64(M * Float64(M * M)))); else tmp = t_0; end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = exp(-l); tmp = 0.0; if (M <= -5.5e-47) tmp = t_0; elseif (M <= 4.1e-101) tmp = t_0 * (-0.5 * (M * (M * M))); else tmp = t_0; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[(-l)], $MachinePrecision]}, If[LessEqual[M, -5.5e-47], t$95$0, If[LessEqual[M, 4.1e-101], N[(t$95$0 * N[(-0.5 * N[(M * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\ell}\\
\mathbf{if}\;M \leq -5.5 \cdot 10^{-47}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;M \leq 4.1 \cdot 10^{-101}:\\
\;\;\;\;t\_0 \cdot \left(-0.5 \cdot \left(M \cdot \left(M \cdot M\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if M < -5.5000000000000002e-47 or 4.10000000000000026e-101 < M Initial program 81.3%
Taylor expanded in l around inf
mul-1-negN/A
lower-neg.f6431.7
Simplified31.7%
Taylor expanded in K around 0
lower-*.f64N/A
cos-negN/A
lower-cos.f64N/A
neg-mul-1N/A
lower-exp.f64N/A
neg-mul-1N/A
lower-neg.f6434.7
Simplified34.7%
Taylor expanded in M around 0
neg-mul-1N/A
lower-exp.f64N/A
neg-mul-1N/A
lower-neg.f6434.0
Simplified34.0%
if -5.5000000000000002e-47 < M < 4.10000000000000026e-101Initial program 77.1%
Taylor expanded in l around inf
mul-1-negN/A
lower-neg.f6433.4
Simplified33.4%
Taylor expanded in K around 0
lower-*.f64N/A
cos-negN/A
lower-cos.f64N/A
neg-mul-1N/A
lower-exp.f64N/A
neg-mul-1N/A
lower-neg.f6437.3
Simplified37.3%
Taylor expanded in M around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6437.3
Simplified37.3%
Taylor expanded in M around inf
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6457.0
Simplified57.0%
Final simplification42.6%
(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 79.7%
Taylor expanded in l around inf
mul-1-negN/A
lower-neg.f6432.4
Simplified32.4%
Taylor expanded in K around 0
lower-*.f64N/A
cos-negN/A
lower-cos.f64N/A
neg-mul-1N/A
lower-exp.f64N/A
neg-mul-1N/A
lower-neg.f6435.7
Simplified35.7%
Taylor expanded in M around 0
neg-mul-1N/A
lower-exp.f64N/A
neg-mul-1N/A
lower-neg.f6435.3
Simplified35.3%
(FPCore (K m n M l) :precision binary64 (* (fma -0.5 (* M M) 1.0) (fma l (fma l (fma -0.16666666666666666 l 0.5) -1.0) 1.0)))
double code(double K, double m, double n, double M, double l) {
return fma(-0.5, (M * M), 1.0) * fma(l, fma(l, fma(-0.16666666666666666, l, 0.5), -1.0), 1.0);
}
function code(K, m, n, M, l) return Float64(fma(-0.5, Float64(M * M), 1.0) * fma(l, fma(l, fma(-0.16666666666666666, l, 0.5), -1.0), 1.0)) end
code[K_, m_, n_, M_, l_] := N[(N[(-0.5 * N[(M * M), $MachinePrecision] + 1.0), $MachinePrecision] * N[(l * N[(l * N[(-0.16666666666666666 * l + 0.5), $MachinePrecision] + -1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-0.5, M \cdot M, 1\right) \cdot \mathsf{fma}\left(\ell, \mathsf{fma}\left(\ell, \mathsf{fma}\left(-0.16666666666666666, \ell, 0.5\right), -1\right), 1\right)
\end{array}
Initial program 79.7%
Taylor expanded in l around inf
mul-1-negN/A
lower-neg.f6432.4
Simplified32.4%
Taylor expanded in K around 0
lower-*.f64N/A
cos-negN/A
lower-cos.f64N/A
neg-mul-1N/A
lower-exp.f64N/A
neg-mul-1N/A
lower-neg.f6435.7
Simplified35.7%
Taylor expanded in M around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6427.9
Simplified27.9%
Taylor expanded in l around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6410.4
Simplified10.4%
(FPCore (K m n M l) :precision binary64 (* (fma -0.5 (* M M) 1.0) (fma l (fma 0.5 l -1.0) 1.0)))
double code(double K, double m, double n, double M, double l) {
return fma(-0.5, (M * M), 1.0) * fma(l, fma(0.5, l, -1.0), 1.0);
}
function code(K, m, n, M, l) return Float64(fma(-0.5, Float64(M * M), 1.0) * fma(l, fma(0.5, l, -1.0), 1.0)) end
code[K_, m_, n_, M_, l_] := N[(N[(-0.5 * N[(M * M), $MachinePrecision] + 1.0), $MachinePrecision] * N[(l * N[(0.5 * l + -1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-0.5, M \cdot M, 1\right) \cdot \mathsf{fma}\left(\ell, \mathsf{fma}\left(0.5, \ell, -1\right), 1\right)
\end{array}
Initial program 79.7%
Taylor expanded in l around inf
mul-1-negN/A
lower-neg.f6432.4
Simplified32.4%
Taylor expanded in K around 0
lower-*.f64N/A
cos-negN/A
lower-cos.f64N/A
neg-mul-1N/A
lower-exp.f64N/A
neg-mul-1N/A
lower-neg.f6435.7
Simplified35.7%
Taylor expanded in M around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6427.9
Simplified27.9%
Taylor expanded in l around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f649.7
Simplified9.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 79.7%
Taylor expanded in l around inf
mul-1-negN/A
lower-neg.f6432.4
Simplified32.4%
Taylor expanded in l around 0
lower-cos.f64N/A
sub-negN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-neg.f648.3
Simplified8.3%
Taylor expanded in K around 0
cos-negN/A
lower-cos.f648.7
Simplified8.7%
Taylor expanded in M around 0
Simplified8.7%
herbie shell --seed 2024214
(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)))))))