
(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 (* (cos M) (exp (- (- (fabs (- n m)) l) (pow (- (* (+ n m) 0.5) M) 2.0)))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp(((fabs((n - m)) - l) - pow((((n + m) * 0.5) - 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((n - m)) - l) - ((((n + m) * 0.5d0) - 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((n - m)) - l) - Math.pow((((n + m) * 0.5) - M), 2.0)));
}
def code(K, m, n, M, l): return math.cos(M) * math.exp(((math.fabs((n - m)) - l) - math.pow((((n + m) * 0.5) - M), 2.0)))
function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(Float64(abs(Float64(n - m)) - l) - (Float64(Float64(Float64(n + m) * 0.5) - M) ^ 2.0)))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * exp(((abs((n - m)) - l) - ((((n + m) * 0.5) - M) ^ 2.0))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[Power[N[(N[(N[(n + m), $MachinePrecision] * 0.5), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{\left(\left|n - m\right| - \ell\right) - {\left(\left(n + m\right) \cdot 0.5 - M\right)}^{2}}
\end{array}
Initial program 76.5%
associate-/l*76.9%
+-commutative76.9%
associate-/l*76.5%
associate-/l*76.9%
+-commutative76.9%
exp-diff25.3%
sub-neg25.3%
exp-sum16.3%
associate-/r*16.3%
exp-diff21.8%
Simplified76.9%
Taylor expanded in K around 0 97.5%
cos-neg97.5%
associate--r+97.5%
*-commutative97.5%
fma-neg97.5%
exp-diff26.8%
sub-neg26.8%
mul-1-neg26.8%
fma-neg26.8%
*-commutative26.8%
exp-diff97.5%
Simplified97.5%
Final simplification97.5%
(FPCore (K m n M l)
:precision binary64
(if (<= m -54.0)
(exp (* (* m m) -0.25))
(if (<= m 1.25e-268)
(* (cos (- (* K (/ (+ n m) 2.0)) M)) (exp (- (pow M 2.0))))
(* (cos M) (exp (* -0.25 (pow n 2.0)))))))
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.25e-268) {
tmp = cos(((K * ((n + m) / 2.0)) - M)) * exp(-pow(M, 2.0));
} else {
tmp = cos(M) * exp((-0.25 * pow(n, 2.0)));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (m <= (-54.0d0)) then
tmp = exp(((m * m) * (-0.25d0)))
else if (m <= 1.25d-268) then
tmp = cos(((k * ((n + m) / 2.0d0)) - m_1)) * exp(-(m_1 ** 2.0d0))
else
tmp = cos(m_1) * exp(((-0.25d0) * (n ** 2.0d0)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -54.0) {
tmp = Math.exp(((m * m) * -0.25));
} else if (m <= 1.25e-268) {
tmp = Math.cos(((K * ((n + m) / 2.0)) - M)) * Math.exp(-Math.pow(M, 2.0));
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(n, 2.0)));
}
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.25e-268: tmp = math.cos(((K * ((n + m) / 2.0)) - M)) * math.exp(-math.pow(M, 2.0)) else: tmp = math.cos(M) * math.exp((-0.25 * math.pow(n, 2.0))) 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.25e-268) tmp = Float64(cos(Float64(Float64(K * Float64(Float64(n + m) / 2.0)) - M)) * exp(Float64(-(M ^ 2.0)))); else tmp = Float64(cos(M) * exp(Float64(-0.25 * (n ^ 2.0)))); 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.25e-268) tmp = cos(((K * ((n + m) / 2.0)) - M)) * exp(-(M ^ 2.0)); else tmp = cos(M) * exp((-0.25 * (n ^ 2.0))); 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.25e-268], N[(N[Cos[N[(N[(K * N[(N[(n + m), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[n, 2.0], $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.25 \cdot 10^{-268}:\\
\;\;\;\;\cos \left(K \cdot \frac{n + m}{2} - M\right) \cdot e^{-{M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if m < -54Initial program 69.0%
associate-/l*69.0%
+-commutative69.0%
associate-/l*69.0%
associate-/l*69.0%
+-commutative69.0%
exp-diff11.3%
sub-neg11.3%
exp-sum0.0%
associate-/r*0.0%
exp-diff2.8%
Simplified69.0%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
associate--r+100.0%
*-commutative100.0%
fma-neg100.0%
exp-diff12.7%
sub-neg12.7%
mul-1-neg12.7%
fma-neg12.7%
*-commutative12.7%
exp-diff100.0%
Simplified100.0%
Taylor expanded in m around inf 97.2%
*-commutative97.2%
Simplified97.2%
unpow297.2%
Applied egg-rr97.2%
Taylor expanded in M around 0 97.2%
if -54 < m < 1.25e-268Initial program 83.8%
associate-/l*83.8%
+-commutative83.8%
associate-/l*83.8%
associate-/l*83.8%
+-commutative83.8%
exp-diff47.4%
sub-neg47.4%
exp-sum37.9%
associate-/r*37.9%
exp-diff46.0%
Simplified83.8%
Taylor expanded in M around inf 43.3%
mul-1-neg43.3%
Simplified43.3%
if 1.25e-268 < m Initial program 76.3%
associate-/l*77.2%
+-commutative77.2%
associate-/l*76.3%
associate-/l*77.2%
+-commutative77.2%
exp-diff19.6%
sub-neg19.6%
exp-sum12.4%
associate-/r*12.4%
exp-diff17.8%
Simplified77.2%
Taylor expanded in K around 0 98.4%
cos-neg98.4%
associate--r+98.4%
*-commutative98.4%
fma-neg98.4%
exp-diff20.9%
sub-neg20.9%
mul-1-neg20.9%
fma-neg20.9%
*-commutative20.9%
exp-diff98.4%
Simplified98.4%
Taylor expanded in n around inf 60.0%
*-commutative60.0%
Simplified60.0%
Final simplification65.5%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (cos M) (exp (- (pow M 2.0))))))
(if (<= M -1.05e+14)
t_0
(if (<= M -5.2e-63)
(* (cos M) (exp (- l)))
(if (<= M 0.0018) (exp (* (* m m) -0.25)) t_0)))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(M) * exp(-pow(M, 2.0));
double tmp;
if (M <= -1.05e+14) {
tmp = t_0;
} else if (M <= -5.2e-63) {
tmp = cos(M) * exp(-l);
} else if (M <= 0.0018) {
tmp = exp(((m * m) * -0.25));
} 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 ** 2.0d0))
if (m_1 <= (-1.05d+14)) then
tmp = t_0
else if (m_1 <= (-5.2d-63)) then
tmp = cos(m_1) * exp(-l)
else if (m_1 <= 0.0018d0) then
tmp = exp(((m * m) * (-0.25d0)))
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(-Math.pow(M, 2.0));
double tmp;
if (M <= -1.05e+14) {
tmp = t_0;
} else if (M <= -5.2e-63) {
tmp = Math.cos(M) * Math.exp(-l);
} else if (M <= 0.0018) {
tmp = Math.exp(((m * m) * -0.25));
} else {
tmp = t_0;
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(M) * math.exp(-math.pow(M, 2.0)) tmp = 0 if M <= -1.05e+14: tmp = t_0 elif M <= -5.2e-63: tmp = math.cos(M) * math.exp(-l) elif M <= 0.0018: tmp = math.exp(((m * m) * -0.25)) else: tmp = t_0 return tmp
function code(K, m, n, M, l) t_0 = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))) tmp = 0.0 if (M <= -1.05e+14) tmp = t_0; elseif (M <= -5.2e-63) tmp = Float64(cos(M) * exp(Float64(-l))); elseif (M <= 0.0018) tmp = exp(Float64(Float64(m * m) * -0.25)); else tmp = t_0; end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(M) * exp(-(M ^ 2.0)); tmp = 0.0; if (M <= -1.05e+14) tmp = t_0; elseif (M <= -5.2e-63) tmp = cos(M) * exp(-l); elseif (M <= 0.0018) tmp = exp(((m * m) * -0.25)); 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[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, -1.05e+14], t$95$0, If[LessEqual[M, -5.2e-63], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 0.0018], N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos M \cdot e^{-{M}^{2}}\\
\mathbf{if}\;M \leq -1.05 \cdot 10^{+14}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;M \leq -5.2 \cdot 10^{-63}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\mathbf{elif}\;M \leq 0.0018:\\
\;\;\;\;e^{\left(m \cdot m\right) \cdot -0.25}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if M < -1.05e14 or 0.0018 < M Initial program 79.5%
associate-/l*80.3%
+-commutative80.3%
associate-/l*79.5%
associate-/l*80.3%
+-commutative80.3%
exp-diff23.8%
sub-neg23.8%
exp-sum18.9%
associate-/r*18.9%
exp-diff29.5%
Simplified80.3%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
associate--r+100.0%
*-commutative100.0%
fma-neg100.0%
exp-diff24.6%
sub-neg24.6%
mul-1-neg24.6%
fma-neg24.6%
*-commutative24.6%
exp-diff100.0%
Simplified100.0%
Taylor expanded in M around inf 93.6%
mul-1-neg93.6%
Simplified93.6%
if -1.05e14 < M < -5.2000000000000003e-63Initial program 78.6%
associate-/l*78.6%
+-commutative78.6%
associate-/l*78.6%
associate-/l*78.6%
+-commutative78.6%
exp-diff35.7%
sub-neg35.7%
exp-sum21.4%
associate-/r*21.4%
exp-diff28.6%
Simplified78.6%
Taylor expanded in l around inf 57.7%
mul-1-neg57.7%
Simplified57.7%
Taylor expanded in K around 0 65.3%
cos-neg65.3%
Simplified65.3%
if -5.2000000000000003e-63 < M < 0.0018Initial program 73.1%
associate-/l*73.1%
+-commutative73.1%
associate-/l*73.1%
associate-/l*73.1%
+-commutative73.1%
exp-diff25.6%
sub-neg25.6%
exp-sum13.1%
associate-/r*13.1%
exp-diff13.1%
Simplified73.1%
Taylor expanded in K around 0 94.7%
cos-neg94.7%
associate--r+94.7%
*-commutative94.7%
fma-neg94.7%
exp-diff27.2%
sub-neg27.2%
mul-1-neg27.2%
fma-neg27.2%
*-commutative27.2%
exp-diff94.7%
Simplified94.7%
Taylor expanded in m around inf 60.8%
*-commutative60.8%
Simplified60.8%
unpow260.8%
Applied egg-rr60.8%
Taylor expanded in M around 0 60.8%
Final simplification76.7%
(FPCore (K m n M l)
:precision binary64
(if (<= m -54.0)
(exp (* (* m m) -0.25))
(if (<= m -5.5e-308)
(* (cos M) (exp (- (pow M 2.0))))
(* (cos M) (exp (* -0.25 (pow n 2.0)))))))
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 <= -5.5e-308) {
tmp = cos(M) * exp(-pow(M, 2.0));
} else {
tmp = cos(M) * exp((-0.25 * pow(n, 2.0)));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (m <= (-54.0d0)) then
tmp = exp(((m * m) * (-0.25d0)))
else if (m <= (-5.5d-308)) then
tmp = cos(m_1) * exp(-(m_1 ** 2.0d0))
else
tmp = cos(m_1) * exp(((-0.25d0) * (n ** 2.0d0)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -54.0) {
tmp = Math.exp(((m * m) * -0.25));
} else if (m <= -5.5e-308) {
tmp = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(n, 2.0)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -54.0: tmp = math.exp(((m * m) * -0.25)) elif m <= -5.5e-308: tmp = math.cos(M) * math.exp(-math.pow(M, 2.0)) else: tmp = math.cos(M) * math.exp((-0.25 * math.pow(n, 2.0))) 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 <= -5.5e-308) tmp = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))); else tmp = Float64(cos(M) * exp(Float64(-0.25 * (n ^ 2.0)))); 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 <= -5.5e-308) tmp = cos(M) * exp(-(M ^ 2.0)); else tmp = cos(M) * exp((-0.25 * (n ^ 2.0))); 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, -5.5e-308], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[n, 2.0], $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 -5.5 \cdot 10^{-308}:\\
\;\;\;\;\cos M \cdot e^{-{M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if m < -54Initial program 69.0%
associate-/l*69.0%
+-commutative69.0%
associate-/l*69.0%
associate-/l*69.0%
+-commutative69.0%
exp-diff11.3%
sub-neg11.3%
exp-sum0.0%
associate-/r*0.0%
exp-diff2.8%
Simplified69.0%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
associate--r+100.0%
*-commutative100.0%
fma-neg100.0%
exp-diff12.7%
sub-neg12.7%
mul-1-neg12.7%
fma-neg12.7%
*-commutative12.7%
exp-diff100.0%
Simplified100.0%
Taylor expanded in m around inf 97.2%
*-commutative97.2%
Simplified97.2%
unpow297.2%
Applied egg-rr97.2%
Taylor expanded in M around 0 97.2%
if -54 < m < -5.5e-308Initial program 86.4%
associate-/l*86.4%
+-commutative86.4%
associate-/l*86.4%
associate-/l*86.4%
+-commutative86.4%
exp-diff45.5%
sub-neg45.5%
exp-sum34.9%
associate-/r*34.9%
exp-diff44.0%
Simplified86.4%
Taylor expanded in K around 0 96.1%
cos-neg96.1%
associate--r+96.1%
*-commutative96.1%
fma-neg96.1%
exp-diff47.6%
sub-neg47.6%
mul-1-neg47.6%
fma-neg47.6%
*-commutative47.6%
exp-diff96.1%
Simplified96.1%
Taylor expanded in M around inf 49.0%
mul-1-neg49.0%
Simplified49.0%
if -5.5e-308 < m Initial program 75.4%
associate-/l*76.2%
+-commutative76.2%
associate-/l*75.4%
associate-/l*76.2%
+-commutative76.2%
exp-diff22.4%
sub-neg22.4%
exp-sum15.7%
associate-/r*15.7%
exp-diff20.8%
Simplified76.2%
Taylor expanded in K around 0 96.8%
cos-neg96.8%
associate--r+96.8%
*-commutative96.8%
fma-neg96.8%
exp-diff23.7%
sub-neg23.7%
mul-1-neg23.7%
fma-neg23.7%
*-commutative23.7%
exp-diff96.8%
Simplified96.8%
Taylor expanded in n around inf 57.8%
*-commutative57.8%
Simplified57.8%
Final simplification66.4%
(FPCore (K m n M l) :precision binary64 (if (or (<= m -8.8e-7) (not (<= m 8e-38))) (* (cos M) (exp (* (* m m) -0.25))) (* (cos M) (exp (- l)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((m <= -8.8e-7) || !(m <= 8e-38)) {
tmp = cos(M) * exp(((m * m) * -0.25));
} else {
tmp = cos(M) * exp(-l);
}
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 <= (-8.8d-7)) .or. (.not. (m <= 8d-38))) then
tmp = cos(m_1) * exp(((m * m) * (-0.25d0)))
else
tmp = cos(m_1) * exp(-l)
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if ((m <= -8.8e-7) || !(m <= 8e-38)) {
tmp = Math.cos(M) * Math.exp(((m * m) * -0.25));
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (m <= -8.8e-7) or not (m <= 8e-38): tmp = math.cos(M) * math.exp(((m * m) * -0.25)) else: tmp = math.cos(M) * math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((m <= -8.8e-7) || !(m <= 8e-38)) tmp = Float64(cos(M) * exp(Float64(Float64(m * m) * -0.25))); else tmp = Float64(cos(M) * exp(Float64(-l))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((m <= -8.8e-7) || ~((m <= 8e-38))) tmp = cos(M) * exp(((m * m) * -0.25)); else tmp = cos(M) * exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[m, -8.8e-7], N[Not[LessEqual[m, 8e-38]], $MachinePrecision]], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -8.8 \cdot 10^{-7} \lor \neg \left(m \leq 8 \cdot 10^{-38}\right):\\
\;\;\;\;\cos M \cdot e^{\left(m \cdot m\right) \cdot -0.25}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if m < -8.8000000000000004e-7 or 7.9999999999999997e-38 < m Initial program 71.9%
associate-/l*72.7%
+-commutative72.7%
associate-/l*71.9%
associate-/l*72.7%
+-commutative72.7%
exp-diff11.5%
sub-neg11.5%
exp-sum1.4%
associate-/r*1.4%
exp-diff2.9%
Simplified72.7%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
associate--r+100.0%
*-commutative100.0%
fma-neg100.0%
exp-diff12.2%
sub-neg12.2%
mul-1-neg12.2%
fma-neg12.2%
*-commutative12.2%
exp-diff100.0%
Simplified100.0%
Taylor expanded in m around inf 93.0%
*-commutative93.0%
Simplified93.0%
unpow293.0%
Applied egg-rr93.0%
if -8.8000000000000004e-7 < m < 7.9999999999999997e-38Initial program 81.8%
associate-/l*81.8%
+-commutative81.8%
associate-/l*81.8%
associate-/l*81.8%
+-commutative81.8%
exp-diff41.7%
sub-neg41.7%
exp-sum34.0%
associate-/r*34.0%
exp-diff44.2%
Simplified81.8%
Taylor expanded in l around inf 37.7%
mul-1-neg37.7%
Simplified37.7%
Taylor expanded in K around 0 44.6%
cos-neg44.6%
Simplified44.6%
Final simplification70.9%
(FPCore (K m n M l) :precision binary64 (if (or (<= m -8.8e-7) (not (<= m 8e-38))) (exp (* (* m m) -0.25)) (* (cos M) (exp (- l)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((m <= -8.8e-7) || !(m <= 8e-38)) {
tmp = exp(((m * m) * -0.25));
} else {
tmp = cos(M) * exp(-l);
}
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 <= (-8.8d-7)) .or. (.not. (m <= 8d-38))) then
tmp = exp(((m * m) * (-0.25d0)))
else
tmp = cos(m_1) * exp(-l)
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if ((m <= -8.8e-7) || !(m <= 8e-38)) {
tmp = Math.exp(((m * m) * -0.25));
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (m <= -8.8e-7) or not (m <= 8e-38): tmp = math.exp(((m * m) * -0.25)) else: tmp = math.cos(M) * math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((m <= -8.8e-7) || !(m <= 8e-38)) tmp = exp(Float64(Float64(m * m) * -0.25)); else tmp = Float64(cos(M) * exp(Float64(-l))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((m <= -8.8e-7) || ~((m <= 8e-38))) tmp = exp(((m * m) * -0.25)); else tmp = cos(M) * exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[m, -8.8e-7], N[Not[LessEqual[m, 8e-38]], $MachinePrecision]], N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -8.8 \cdot 10^{-7} \lor \neg \left(m \leq 8 \cdot 10^{-38}\right):\\
\;\;\;\;e^{\left(m \cdot m\right) \cdot -0.25}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if m < -8.8000000000000004e-7 or 7.9999999999999997e-38 < m Initial program 71.9%
associate-/l*72.7%
+-commutative72.7%
associate-/l*71.9%
associate-/l*72.7%
+-commutative72.7%
exp-diff11.5%
sub-neg11.5%
exp-sum1.4%
associate-/r*1.4%
exp-diff2.9%
Simplified72.7%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
associate--r+100.0%
*-commutative100.0%
fma-neg100.0%
exp-diff12.2%
sub-neg12.2%
mul-1-neg12.2%
fma-neg12.2%
*-commutative12.2%
exp-diff100.0%
Simplified100.0%
Taylor expanded in m around inf 93.0%
*-commutative93.0%
Simplified93.0%
unpow293.0%
Applied egg-rr93.0%
Taylor expanded in M around 0 93.0%
if -8.8000000000000004e-7 < m < 7.9999999999999997e-38Initial program 81.8%
associate-/l*81.8%
+-commutative81.8%
associate-/l*81.8%
associate-/l*81.8%
+-commutative81.8%
exp-diff41.7%
sub-neg41.7%
exp-sum34.0%
associate-/r*34.0%
exp-diff44.2%
Simplified81.8%
Taylor expanded in l around inf 37.7%
mul-1-neg37.7%
Simplified37.7%
Taylor expanded in K around 0 44.6%
cos-neg44.6%
Simplified44.6%
Final simplification70.9%
(FPCore (K m n M l) :precision binary64 (* 0.5 (* K (* n (sin M)))))
double code(double K, double m, double n, double M, double l) {
return 0.5 * (K * (n * sin(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 = 0.5d0 * (k * (n * sin(m_1)))
end function
public static double code(double K, double m, double n, double M, double l) {
return 0.5 * (K * (n * Math.sin(M)));
}
def code(K, m, n, M, l): return 0.5 * (K * (n * math.sin(M)))
function code(K, m, n, M, l) return Float64(0.5 * Float64(K * Float64(n * sin(M)))) end
function tmp = code(K, m, n, M, l) tmp = 0.5 * (K * (n * sin(M))); end
code[K_, m_, n_, M_, l_] := N[(0.5 * N[(K * N[(n * N[Sin[M], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \left(K \cdot \left(n \cdot \sin M\right)\right)
\end{array}
Initial program 76.5%
associate-/l*76.9%
+-commutative76.9%
associate-/l*76.5%
associate-/l*76.9%
+-commutative76.9%
exp-diff25.3%
sub-neg25.3%
exp-sum16.3%
associate-/r*16.3%
exp-diff21.8%
Simplified76.9%
Taylor expanded in m around inf 40.5%
*-commutative40.5%
Simplified40.5%
Taylor expanded in m around 0 5.5%
fma-neg5.5%
*-commutative5.5%
fma-neg5.5%
associate-*r*5.5%
Simplified5.5%
Taylor expanded in n around 0 5.5%
cos-neg5.5%
sin-neg5.5%
Simplified5.5%
Taylor expanded in K around inf 21.9%
(FPCore (K m n M l) :precision binary64 (exp (* (* m m) -0.25)))
double code(double K, double m, double n, double M, double l) {
return exp(((m * m) * -0.25));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = exp(((m * m) * (-0.25d0)))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.exp(((m * m) * -0.25));
}
def code(K, m, n, M, l): return math.exp(((m * m) * -0.25))
function code(K, m, n, M, l) return exp(Float64(Float64(m * m) * -0.25)) end
function tmp = code(K, m, n, M, l) tmp = exp(((m * m) * -0.25)); end
code[K_, m_, n_, M_, l_] := N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{\left(m \cdot m\right) \cdot -0.25}
\end{array}
Initial program 76.5%
associate-/l*76.9%
+-commutative76.9%
associate-/l*76.5%
associate-/l*76.9%
+-commutative76.9%
exp-diff25.3%
sub-neg25.3%
exp-sum16.3%
associate-/r*16.3%
exp-diff21.8%
Simplified76.9%
Taylor expanded in K around 0 97.5%
cos-neg97.5%
associate--r+97.5%
*-commutative97.5%
fma-neg97.5%
exp-diff26.8%
sub-neg26.8%
mul-1-neg26.8%
fma-neg26.8%
*-commutative26.8%
exp-diff97.5%
Simplified97.5%
Taylor expanded in m around inf 54.7%
*-commutative54.7%
Simplified54.7%
unpow254.7%
Applied egg-rr54.7%
Taylor expanded in M around 0 54.7%
Final simplification54.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.5%
associate-/l*76.9%
+-commutative76.9%
associate-/l*76.5%
associate-/l*76.9%
+-commutative76.9%
exp-diff25.3%
sub-neg25.3%
exp-sum16.3%
associate-/r*16.3%
exp-diff21.8%
Simplified76.9%
Taylor expanded in K around 0 97.5%
cos-neg97.5%
associate--r+97.5%
*-commutative97.5%
fma-neg97.5%
exp-diff26.8%
sub-neg26.8%
mul-1-neg26.8%
fma-neg26.8%
*-commutative26.8%
exp-diff97.5%
Simplified97.5%
Taylor expanded in m around inf 54.7%
*-commutative54.7%
Simplified54.7%
Taylor expanded in m around 0 5.9%
(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.5%
associate-/l*76.9%
+-commutative76.9%
associate-/l*76.5%
associate-/l*76.9%
+-commutative76.9%
exp-diff25.3%
sub-neg25.3%
exp-sum16.3%
associate-/r*16.3%
exp-diff21.8%
Simplified76.9%
Taylor expanded in K around 0 97.5%
cos-neg97.5%
associate--r+97.5%
*-commutative97.5%
fma-neg97.5%
exp-diff26.8%
sub-neg26.8%
mul-1-neg26.8%
fma-neg26.8%
*-commutative26.8%
exp-diff97.5%
Simplified97.5%
Taylor expanded in m around inf 54.7%
*-commutative54.7%
Simplified54.7%
Taylor expanded in m around 0 5.9%
Taylor expanded in M around 0 5.9%
herbie shell --seed 2024110
(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)))))))