
(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 80.2%
Taylor expanded in K around 0 98.1%
cos-neg98.1%
Simplified98.1%
Final simplification98.1%
(FPCore (K m n M l) :precision binary64 (if (or (<= M -1.4e+31) (not (<= M 2.2e-11))) (* (cos M) (exp (* M (- M)))) (exp (- (fabs (- m n)) (+ l (* 0.25 (pow (+ m n) 2.0)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((M <= -1.4e+31) || !(M <= 2.2e-11)) {
tmp = cos(M) * exp((M * -M));
} else {
tmp = exp((fabs((m - n)) - (l + (0.25 * pow((m + 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_1 <= (-1.4d+31)) .or. (.not. (m_1 <= 2.2d-11))) then
tmp = cos(m_1) * exp((m_1 * -m_1))
else
tmp = exp((abs((m - n)) - (l + (0.25d0 * ((m + 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 <= -1.4e+31) || !(M <= 2.2e-11)) {
tmp = Math.cos(M) * Math.exp((M * -M));
} else {
tmp = Math.exp((Math.abs((m - n)) - (l + (0.25 * Math.pow((m + n), 2.0)))));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (M <= -1.4e+31) or not (M <= 2.2e-11): tmp = math.cos(M) * math.exp((M * -M)) else: tmp = math.exp((math.fabs((m - n)) - (l + (0.25 * math.pow((m + n), 2.0))))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((M <= -1.4e+31) || !(M <= 2.2e-11)) tmp = Float64(cos(M) * exp(Float64(M * Float64(-M)))); else tmp = exp(Float64(abs(Float64(m - n)) - Float64(l + Float64(0.25 * (Float64(m + n) ^ 2.0))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((M <= -1.4e+31) || ~((M <= 2.2e-11))) tmp = cos(M) * exp((M * -M)); else tmp = exp((abs((m - n)) - (l + (0.25 * ((m + n) ^ 2.0))))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[M, -1.4e+31], N[Not[LessEqual[M, 2.2e-11]], $MachinePrecision]], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * (-M)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - N[(l + N[(0.25 * N[Power[N[(m + n), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq -1.4 \cdot 10^{+31} \lor \neg \left(M \leq 2.2 \cdot 10^{-11}\right):\\
\;\;\;\;\cos M \cdot e^{M \cdot \left(-M\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{\left|m - n\right| - \left(\ell + 0.25 \cdot {\left(m + n\right)}^{2}\right)}\\
\end{array}
\end{array}
if M < -1.40000000000000008e31 or 2.2000000000000002e-11 < M Initial program 82.4%
Taylor expanded in K around 0 98.5%
cos-neg98.5%
Simplified98.5%
Taylor expanded in M around inf 97.7%
mul-1-neg97.7%
unpow297.7%
distribute-rgt-neg-in97.7%
Simplified97.7%
if -1.40000000000000008e31 < M < 2.2000000000000002e-11Initial program 78.3%
Taylor expanded in K around 0 97.7%
cos-neg97.7%
Simplified97.7%
Taylor expanded in M around 0 97.7%
Final simplification97.7%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (cos M) (exp (- (* M M))))))
(if (<= n 1.65e-280)
(exp (* m (* m -0.25)))
(if (<= n 3.2e-154)
t_0
(if (<= n 1.02e-109)
(* (cos M) (exp (- l)))
(if (<= n 54.0) t_0 (exp (* (* n n) -0.25))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(M) * exp(-(M * M));
double tmp;
if (n <= 1.65e-280) {
tmp = exp((m * (m * -0.25)));
} else if (n <= 3.2e-154) {
tmp = t_0;
} else if (n <= 1.02e-109) {
tmp = cos(M) * exp(-l);
} else if (n <= 54.0) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = cos(m_1) * exp(-(m_1 * m_1))
if (n <= 1.65d-280) then
tmp = exp((m * (m * (-0.25d0))))
else if (n <= 3.2d-154) then
tmp = t_0
else if (n <= 1.02d-109) then
tmp = cos(m_1) * exp(-l)
else if (n <= 54.0d0) then
tmp = t_0
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 t_0 = Math.cos(M) * Math.exp(-(M * M));
double tmp;
if (n <= 1.65e-280) {
tmp = Math.exp((m * (m * -0.25)));
} else if (n <= 3.2e-154) {
tmp = t_0;
} else if (n <= 1.02e-109) {
tmp = Math.cos(M) * Math.exp(-l);
} else if (n <= 54.0) {
tmp = t_0;
} else {
tmp = Math.exp(((n * n) * -0.25));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(M) * math.exp(-(M * M)) tmp = 0 if n <= 1.65e-280: tmp = math.exp((m * (m * -0.25))) elif n <= 3.2e-154: tmp = t_0 elif n <= 1.02e-109: tmp = math.cos(M) * math.exp(-l) elif n <= 54.0: tmp = t_0 else: tmp = math.exp(((n * n) * -0.25)) return tmp
function code(K, m, n, M, l) t_0 = Float64(cos(M) * exp(Float64(-Float64(M * M)))) tmp = 0.0 if (n <= 1.65e-280) tmp = exp(Float64(m * Float64(m * -0.25))); elseif (n <= 3.2e-154) tmp = t_0; elseif (n <= 1.02e-109) tmp = Float64(cos(M) * exp(Float64(-l))); elseif (n <= 54.0) tmp = t_0; else tmp = exp(Float64(Float64(n * n) * -0.25)); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(M) * exp(-(M * M)); tmp = 0.0; if (n <= 1.65e-280) tmp = exp((m * (m * -0.25))); elseif (n <= 3.2e-154) tmp = t_0; elseif (n <= 1.02e-109) tmp = cos(M) * exp(-l); elseif (n <= 54.0) tmp = t_0; else tmp = exp(((n * n) * -0.25)); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[(M * M), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, 1.65e-280], N[Exp[N[(m * N[(m * -0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[n, 3.2e-154], t$95$0, If[LessEqual[n, 1.02e-109], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 54.0], t$95$0, N[Exp[N[(N[(n * n), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos M \cdot e^{-M \cdot M}\\
\mathbf{if}\;n \leq 1.65 \cdot 10^{-280}:\\
\;\;\;\;e^{m \cdot \left(m \cdot -0.25\right)}\\
\mathbf{elif}\;n \leq 3.2 \cdot 10^{-154}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 1.02 \cdot 10^{-109}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\mathbf{elif}\;n \leq 54:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;e^{\left(n \cdot n\right) \cdot -0.25}\\
\end{array}
\end{array}
if n < 1.64999999999999995e-280Initial program 82.3%
Taylor expanded in K around 0 97.2%
cos-neg97.2%
Simplified97.2%
Taylor expanded in M around 0 90.8%
Taylor expanded in m around inf 60.7%
*-commutative60.7%
unpow260.7%
associate-*l*60.7%
Simplified60.7%
if 1.64999999999999995e-280 < n < 3.20000000000000005e-154 or 1.02e-109 < n < 54Initial program 88.3%
Taylor expanded in K around 0 97.0%
cos-neg97.0%
Simplified97.0%
Taylor expanded in M around inf 68.5%
mul-1-neg68.5%
unpow268.5%
distribute-rgt-neg-in68.5%
Simplified68.5%
if 3.20000000000000005e-154 < n < 1.02e-109Initial program 80.0%
Taylor expanded in l around inf 70.3%
mul-1-neg70.3%
Simplified70.3%
Taylor expanded in K around 0 70.8%
cos-neg70.8%
Simplified70.8%
if 54 < n Initial program 70.8%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in M around 0 100.0%
Taylor expanded in n around inf 100.0%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
Final simplification73.7%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (cos M) (exp (* M (- M))))))
(if (<= n 4.4e-274)
(* (cos M) (exp (* -0.25 (* m m))))
(if (<= n 3.5e-154)
t_0
(if (<= n 1.15e-110)
(* (cos M) (exp (- l)))
(if (<= n 54.0) t_0 (exp (* (* n n) -0.25))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(M) * exp((M * -M));
double tmp;
if (n <= 4.4e-274) {
tmp = cos(M) * exp((-0.25 * (m * m)));
} else if (n <= 3.5e-154) {
tmp = t_0;
} else if (n <= 1.15e-110) {
tmp = cos(M) * exp(-l);
} else if (n <= 54.0) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = cos(m_1) * exp((m_1 * -m_1))
if (n <= 4.4d-274) then
tmp = cos(m_1) * exp(((-0.25d0) * (m * m)))
else if (n <= 3.5d-154) then
tmp = t_0
else if (n <= 1.15d-110) then
tmp = cos(m_1) * exp(-l)
else if (n <= 54.0d0) then
tmp = t_0
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 t_0 = Math.cos(M) * Math.exp((M * -M));
double tmp;
if (n <= 4.4e-274) {
tmp = Math.cos(M) * Math.exp((-0.25 * (m * m)));
} else if (n <= 3.5e-154) {
tmp = t_0;
} else if (n <= 1.15e-110) {
tmp = Math.cos(M) * Math.exp(-l);
} else if (n <= 54.0) {
tmp = t_0;
} else {
tmp = Math.exp(((n * n) * -0.25));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(M) * math.exp((M * -M)) tmp = 0 if n <= 4.4e-274: tmp = math.cos(M) * math.exp((-0.25 * (m * m))) elif n <= 3.5e-154: tmp = t_0 elif n <= 1.15e-110: tmp = math.cos(M) * math.exp(-l) elif n <= 54.0: tmp = t_0 else: tmp = math.exp(((n * n) * -0.25)) return tmp
function code(K, m, n, M, l) t_0 = Float64(cos(M) * exp(Float64(M * Float64(-M)))) tmp = 0.0 if (n <= 4.4e-274) tmp = Float64(cos(M) * exp(Float64(-0.25 * Float64(m * m)))); elseif (n <= 3.5e-154) tmp = t_0; elseif (n <= 1.15e-110) tmp = Float64(cos(M) * exp(Float64(-l))); elseif (n <= 54.0) tmp = t_0; else tmp = exp(Float64(Float64(n * n) * -0.25)); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(M) * exp((M * -M)); tmp = 0.0; if (n <= 4.4e-274) tmp = cos(M) * exp((-0.25 * (m * m))); elseif (n <= 3.5e-154) tmp = t_0; elseif (n <= 1.15e-110) tmp = cos(M) * exp(-l); elseif (n <= 54.0) tmp = t_0; else tmp = exp(((n * n) * -0.25)); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * (-M)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, 4.4e-274], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3.5e-154], t$95$0, If[LessEqual[n, 1.15e-110], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 54.0], t$95$0, N[Exp[N[(N[(n * n), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos M \cdot e^{M \cdot \left(-M\right)}\\
\mathbf{if}\;n \leq 4.4 \cdot 10^{-274}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(m \cdot m\right)}\\
\mathbf{elif}\;n \leq 3.5 \cdot 10^{-154}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 1.15 \cdot 10^{-110}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\mathbf{elif}\;n \leq 54:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;e^{\left(n \cdot n\right) \cdot -0.25}\\
\end{array}
\end{array}
if n < 4.3999999999999999e-274Initial program 81.8%
Taylor expanded in K around 0 96.6%
cos-neg96.6%
Simplified96.6%
Taylor expanded in m around inf 60.0%
*-commutative60.0%
unpow260.0%
Simplified60.0%
if 4.3999999999999999e-274 < n < 3.5000000000000001e-154 or 1.1500000000000001e-110 < n < 54Initial program 89.8%
Taylor expanded in K around 0 98.5%
cos-neg98.5%
Simplified98.5%
Taylor expanded in M around inf 68.8%
mul-1-neg68.8%
unpow268.8%
distribute-rgt-neg-in68.8%
Simplified68.8%
if 3.5000000000000001e-154 < n < 1.1500000000000001e-110Initial program 80.0%
Taylor expanded in l around inf 70.3%
mul-1-neg70.3%
Simplified70.3%
Taylor expanded in K around 0 70.8%
cos-neg70.8%
Simplified70.8%
if 54 < n Initial program 70.8%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in M around 0 100.0%
Taylor expanded in n around inf 100.0%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
Final simplification73.3%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (cos M) (exp (* M (- M))))))
(if (<= n 1.65e-280)
(exp (- (fabs (- m n)) (* m (* m 0.25))))
(if (<= n 3.4e-154)
t_0
(if (<= n 2.35e-110)
(* (cos M) (exp (- l)))
(if (<= n 54.0) t_0 (exp (* (* n n) -0.25))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(M) * exp((M * -M));
double tmp;
if (n <= 1.65e-280) {
tmp = exp((fabs((m - n)) - (m * (m * 0.25))));
} else if (n <= 3.4e-154) {
tmp = t_0;
} else if (n <= 2.35e-110) {
tmp = cos(M) * exp(-l);
} else if (n <= 54.0) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = cos(m_1) * exp((m_1 * -m_1))
if (n <= 1.65d-280) then
tmp = exp((abs((m - n)) - (m * (m * 0.25d0))))
else if (n <= 3.4d-154) then
tmp = t_0
else if (n <= 2.35d-110) then
tmp = cos(m_1) * exp(-l)
else if (n <= 54.0d0) then
tmp = t_0
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 t_0 = Math.cos(M) * Math.exp((M * -M));
double tmp;
if (n <= 1.65e-280) {
tmp = Math.exp((Math.abs((m - n)) - (m * (m * 0.25))));
} else if (n <= 3.4e-154) {
tmp = t_0;
} else if (n <= 2.35e-110) {
tmp = Math.cos(M) * Math.exp(-l);
} else if (n <= 54.0) {
tmp = t_0;
} else {
tmp = Math.exp(((n * n) * -0.25));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(M) * math.exp((M * -M)) tmp = 0 if n <= 1.65e-280: tmp = math.exp((math.fabs((m - n)) - (m * (m * 0.25)))) elif n <= 3.4e-154: tmp = t_0 elif n <= 2.35e-110: tmp = math.cos(M) * math.exp(-l) elif n <= 54.0: tmp = t_0 else: tmp = math.exp(((n * n) * -0.25)) return tmp
function code(K, m, n, M, l) t_0 = Float64(cos(M) * exp(Float64(M * Float64(-M)))) tmp = 0.0 if (n <= 1.65e-280) tmp = exp(Float64(abs(Float64(m - n)) - Float64(m * Float64(m * 0.25)))); elseif (n <= 3.4e-154) tmp = t_0; elseif (n <= 2.35e-110) tmp = Float64(cos(M) * exp(Float64(-l))); elseif (n <= 54.0) tmp = t_0; else tmp = exp(Float64(Float64(n * n) * -0.25)); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(M) * exp((M * -M)); tmp = 0.0; if (n <= 1.65e-280) tmp = exp((abs((m - n)) - (m * (m * 0.25)))); elseif (n <= 3.4e-154) tmp = t_0; elseif (n <= 2.35e-110) tmp = cos(M) * exp(-l); elseif (n <= 54.0) tmp = t_0; else tmp = exp(((n * n) * -0.25)); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * (-M)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, 1.65e-280], N[Exp[N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - N[(m * N[(m * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[n, 3.4e-154], t$95$0, If[LessEqual[n, 2.35e-110], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 54.0], t$95$0, N[Exp[N[(N[(n * n), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos M \cdot e^{M \cdot \left(-M\right)}\\
\mathbf{if}\;n \leq 1.65 \cdot 10^{-280}:\\
\;\;\;\;e^{\left|m - n\right| - m \cdot \left(m \cdot 0.25\right)}\\
\mathbf{elif}\;n \leq 3.4 \cdot 10^{-154}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 2.35 \cdot 10^{-110}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\mathbf{elif}\;n \leq 54:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;e^{\left(n \cdot n\right) \cdot -0.25}\\
\end{array}
\end{array}
if n < 1.64999999999999995e-280Initial program 82.3%
Taylor expanded in K around 0 97.2%
cos-neg97.2%
Simplified97.2%
Taylor expanded in M around 0 90.8%
Taylor expanded in m around inf 52.5%
unpow252.5%
associate-*r*52.5%
Simplified52.5%
if 1.64999999999999995e-280 < n < 3.3999999999999998e-154 or 2.34999999999999996e-110 < n < 54Initial program 88.3%
Taylor expanded in K around 0 97.0%
cos-neg97.0%
Simplified97.0%
Taylor expanded in M around inf 68.5%
mul-1-neg68.5%
unpow268.5%
distribute-rgt-neg-in68.5%
Simplified68.5%
if 3.3999999999999998e-154 < n < 2.34999999999999996e-110Initial program 80.0%
Taylor expanded in l around inf 70.3%
mul-1-neg70.3%
Simplified70.3%
Taylor expanded in K around 0 70.8%
cos-neg70.8%
Simplified70.8%
if 54 < n Initial program 70.8%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in M around 0 100.0%
Taylor expanded in n around inf 100.0%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
Final simplification69.8%
(FPCore (K m n M l) :precision binary64 (if (<= l 4.2) (exp (* m (* m -0.25))) (exp (- l))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= 4.2) {
tmp = exp((m * (m * -0.25)));
} else {
tmp = 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 (l <= 4.2d0) then
tmp = exp((m * (m * (-0.25d0))))
else
tmp = 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 (l <= 4.2) {
tmp = Math.exp((m * (m * -0.25)));
} else {
tmp = Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= 4.2: tmp = math.exp((m * (m * -0.25))) else: tmp = math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= 4.2) tmp = exp(Float64(m * Float64(m * -0.25))); else tmp = exp(Float64(-l)); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (l <= 4.2) tmp = exp((m * (m * -0.25))); else tmp = exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, 4.2], N[Exp[N[(m * N[(m * -0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Exp[(-l)], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 4.2:\\
\;\;\;\;e^{m \cdot \left(m \cdot -0.25\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{-\ell}\\
\end{array}
\end{array}
if l < 4.20000000000000018Initial program 77.9%
Taylor expanded in K around 0 97.2%
cos-neg97.2%
Simplified97.2%
Taylor expanded in M around 0 85.3%
Taylor expanded in m around inf 58.9%
*-commutative58.9%
unpow258.9%
associate-*l*58.9%
Simplified58.9%
if 4.20000000000000018 < l Initial program 85.5%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in M around 0 100.0%
Taylor expanded in l around inf 98.7%
neg-mul-198.7%
Simplified98.7%
Final simplification70.7%
(FPCore (K m n M l) :precision binary64 (if (<= m -3600000.0) (exp (* m (* m -0.25))) (exp (* (* n n) -0.25))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -3600000.0) {
tmp = exp((m * (m * -0.25)));
} 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 <= (-3600000.0d0)) then
tmp = exp((m * (m * (-0.25d0))))
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 <= -3600000.0) {
tmp = Math.exp((m * (m * -0.25)));
} else {
tmp = Math.exp(((n * n) * -0.25));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -3600000.0: tmp = math.exp((m * (m * -0.25))) else: tmp = math.exp(((n * n) * -0.25)) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -3600000.0) tmp = exp(Float64(m * Float64(m * -0.25))); else tmp = exp(Float64(Float64(n * n) * -0.25)); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -3600000.0) tmp = exp((m * (m * -0.25))); else tmp = exp(((n * n) * -0.25)); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -3600000.0], N[Exp[N[(m * N[(m * -0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Exp[N[(N[(n * n), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -3600000:\\
\;\;\;\;e^{m \cdot \left(m \cdot -0.25\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(n \cdot n\right) \cdot -0.25}\\
\end{array}
\end{array}
if m < -3.6e6Initial program 78.5%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in M around 0 100.0%
Taylor expanded in m around inf 98.5%
*-commutative98.5%
unpow298.5%
associate-*l*98.5%
Simplified98.5%
if -3.6e6 < m Initial program 80.8%
Taylor expanded in K around 0 97.4%
cos-neg97.4%
Simplified97.4%
Taylor expanded in M around 0 86.2%
Taylor expanded in n around inf 58.7%
*-commutative58.7%
unpow258.7%
Simplified58.7%
Final simplification68.8%
(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 80.2%
Taylor expanded in K around 0 98.1%
cos-neg98.1%
Simplified98.1%
Taylor expanded in M around 0 89.7%
Taylor expanded in l around inf 37.5%
neg-mul-137.5%
Simplified37.5%
Final simplification37.5%
(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 80.2%
Taylor expanded in n around inf 41.9%
*-commutative41.9%
unpow241.9%
Simplified41.9%
Taylor expanded in n around 0 7.3%
*-commutative7.3%
Simplified7.3%
Taylor expanded in m around 0 7.9%
cos-neg7.9%
Simplified7.9%
Final simplification7.9%
herbie shell --seed 2023264
(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)))))))