
(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 12 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}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (let* ((t_0 (* 0.5 (+ n m)))) (* (exp (+ (- n m) (- (* (- t_0 M) (- M t_0)) l))) (cos M))))
assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
double t_0 = 0.5 * (n + m);
return exp(((n - m) + (((t_0 - M) * (M - t_0)) - l))) * cos(M);
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: t_0
t_0 = 0.5d0 * (n + m)
code = exp(((n - m) + (((t_0 - m_1) * (m_1 - t_0)) - l))) * cos(m_1)
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
double t_0 = 0.5 * (n + m);
return Math.exp(((n - m) + (((t_0 - M) * (M - t_0)) - l))) * Math.cos(M);
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): t_0 = 0.5 * (n + m) return math.exp(((n - m) + (((t_0 - M) * (M - t_0)) - l))) * math.cos(M)
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) t_0 = Float64(0.5 * Float64(n + m)) return Float64(exp(Float64(Float64(n - m) + Float64(Float64(Float64(t_0 - M) * Float64(M - t_0)) - l))) * cos(M)) end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp = code(K, m, n, M, l)
t_0 = 0.5 * (n + m);
tmp = exp(((n - m) + (((t_0 - M) * (M - t_0)) - l))) * cos(M);
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(0.5 * N[(n + m), $MachinePrecision]), $MachinePrecision]}, N[(N[Exp[N[(N[(n - m), $MachinePrecision] + N[(N[(N[(t$95$0 - M), $MachinePrecision] * N[(M - t$95$0), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[M], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(n + m\right)\\
e^{\left(n - m\right) + \left(\left(t\_0 - M\right) \cdot \left(M - t\_0\right) - \ell\right)} \cdot \cos M
\end{array}
\end{array}
Initial program 78.7%
Taylor expanded in K around 0 97.4%
Simplified97.4%
*-commutative97.4%
fmm-undef97.4%
unpow297.4%
fmm-undef97.4%
*-commutative97.4%
+-commutative97.4%
fmm-undef97.4%
*-commutative97.4%
+-commutative97.4%
Applied egg-rr97.4%
sub-neg97.4%
add-sqr-sqrt47.3%
fabs-sqr47.3%
add-sqr-sqrt97.1%
pow297.1%
fmm-def97.1%
Applied egg-rr97.1%
unsub-neg97.1%
+-commutative97.1%
fmm-def97.1%
Simplified97.1%
*-commutative97.4%
fmm-undef97.4%
unpow297.4%
fmm-undef97.4%
*-commutative97.4%
+-commutative97.4%
fmm-undef97.4%
*-commutative97.4%
+-commutative97.4%
Applied egg-rr97.1%
Final simplification97.1%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (exp (* -0.25 (pow m 2.0)))))
(if (<= m -1.8)
t_0
(if (<= m 6.2e-242)
(* (cos M) (exp (- (* M M))))
(if (<= m 53.0) (exp (* n (+ (* m 0.5) (- -1.0 M)))) t_0)))))assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
double t_0 = exp((-0.25 * pow(m, 2.0)));
double tmp;
if (m <= -1.8) {
tmp = t_0;
} else if (m <= 6.2e-242) {
tmp = cos(M) * exp(-(M * M));
} else if (m <= 53.0) {
tmp = exp((n * ((m * 0.5) + (-1.0 - M))));
} else {
tmp = t_0;
}
return tmp;
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: tmp
t_0 = exp(((-0.25d0) * (m ** 2.0d0)))
if (m <= (-1.8d0)) then
tmp = t_0
else if (m <= 6.2d-242) then
tmp = cos(m_1) * exp(-(m_1 * m_1))
else if (m <= 53.0d0) then
tmp = exp((n * ((m * 0.5d0) + ((-1.0d0) - m_1))))
else
tmp = t_0
end if
code = tmp
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.exp((-0.25 * Math.pow(m, 2.0)));
double tmp;
if (m <= -1.8) {
tmp = t_0;
} else if (m <= 6.2e-242) {
tmp = Math.cos(M) * Math.exp(-(M * M));
} else if (m <= 53.0) {
tmp = Math.exp((n * ((m * 0.5) + (-1.0 - M))));
} else {
tmp = t_0;
}
return tmp;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): t_0 = math.exp((-0.25 * math.pow(m, 2.0))) tmp = 0 if m <= -1.8: tmp = t_0 elif m <= 6.2e-242: tmp = math.cos(M) * math.exp(-(M * M)) elif m <= 53.0: tmp = math.exp((n * ((m * 0.5) + (-1.0 - M)))) else: tmp = t_0 return tmp
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) t_0 = exp(Float64(-0.25 * (m ^ 2.0))) tmp = 0.0 if (m <= -1.8) tmp = t_0; elseif (m <= 6.2e-242) tmp = Float64(cos(M) * exp(Float64(-Float64(M * M)))); elseif (m <= 53.0) tmp = exp(Float64(n * Float64(Float64(m * 0.5) + Float64(-1.0 - M)))); else tmp = t_0; end return tmp end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp_2 = code(K, m, n, M, l)
t_0 = exp((-0.25 * (m ^ 2.0)));
tmp = 0.0;
if (m <= -1.8)
tmp = t_0;
elseif (m <= 6.2e-242)
tmp = cos(M) * exp(-(M * M));
elseif (m <= 53.0)
tmp = exp((n * ((m * 0.5) + (-1.0 - M))));
else
tmp = t_0;
end
tmp_2 = tmp;
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[m, -1.8], t$95$0, If[LessEqual[m, 6.2e-242], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[(M * M), $MachinePrecision])], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 53.0], N[Exp[N[(n * N[(N[(m * 0.5), $MachinePrecision] + N[(-1.0 - M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
t_0 := e^{-0.25 \cdot {m}^{2}}\\
\mathbf{if}\;m \leq -1.8:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq 6.2 \cdot 10^{-242}:\\
\;\;\;\;\cos M \cdot e^{-M \cdot M}\\
\mathbf{elif}\;m \leq 53:\\
\;\;\;\;e^{n \cdot \left(m \cdot 0.5 + \left(-1 - M\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < -1.80000000000000004 or 53 < m Initial program 73.0%
Taylor expanded in K around 0 99.2%
Simplified99.2%
Taylor expanded in m around inf 96.8%
*-commutative96.8%
Simplified96.8%
Taylor expanded in M around 0 96.8%
if -1.80000000000000004 < m < 6.20000000000000031e-242Initial program 85.8%
Taylor expanded in K around 0 95.4%
Simplified95.4%
Taylor expanded in M around inf 65.5%
mul-1-neg65.5%
Simplified65.5%
unpow265.5%
distribute-lft-neg-in65.5%
Applied egg-rr65.5%
if 6.20000000000000031e-242 < m < 53Initial program 81.2%
add-exp-log79.3%
*-commutative79.3%
log-prod52.9%
Applied egg-rr28.2%
Taylor expanded in n around -inf 18.4%
mul-1-neg18.4%
mul-1-neg18.4%
*-commutative18.4%
Simplified18.4%
Taylor expanded in n around 0 37.2%
Final simplification74.5%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (exp (* -0.25 (pow m 2.0)))))
(if (<= m -54.0)
t_0
(if (<= m -8.2e-119)
(* (cos M) (exp (- l)))
(if (<= m 53.0) (exp (* n (+ (* m 0.5) (- -1.0 M)))) t_0)))))assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
double t_0 = exp((-0.25 * pow(m, 2.0)));
double tmp;
if (m <= -54.0) {
tmp = t_0;
} else if (m <= -8.2e-119) {
tmp = cos(M) * exp(-l);
} else if (m <= 53.0) {
tmp = exp((n * ((m * 0.5) + (-1.0 - M))));
} else {
tmp = t_0;
}
return tmp;
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: tmp
t_0 = exp(((-0.25d0) * (m ** 2.0d0)))
if (m <= (-54.0d0)) then
tmp = t_0
else if (m <= (-8.2d-119)) then
tmp = cos(m_1) * exp(-l)
else if (m <= 53.0d0) then
tmp = exp((n * ((m * 0.5d0) + ((-1.0d0) - m_1))))
else
tmp = t_0
end if
code = tmp
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.exp((-0.25 * Math.pow(m, 2.0)));
double tmp;
if (m <= -54.0) {
tmp = t_0;
} else if (m <= -8.2e-119) {
tmp = Math.cos(M) * Math.exp(-l);
} else if (m <= 53.0) {
tmp = Math.exp((n * ((m * 0.5) + (-1.0 - M))));
} else {
tmp = t_0;
}
return tmp;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): t_0 = math.exp((-0.25 * math.pow(m, 2.0))) tmp = 0 if m <= -54.0: tmp = t_0 elif m <= -8.2e-119: tmp = math.cos(M) * math.exp(-l) elif m <= 53.0: tmp = math.exp((n * ((m * 0.5) + (-1.0 - M)))) else: tmp = t_0 return tmp
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) t_0 = exp(Float64(-0.25 * (m ^ 2.0))) tmp = 0.0 if (m <= -54.0) tmp = t_0; elseif (m <= -8.2e-119) tmp = Float64(cos(M) * exp(Float64(-l))); elseif (m <= 53.0) tmp = exp(Float64(n * Float64(Float64(m * 0.5) + Float64(-1.0 - M)))); else tmp = t_0; end return tmp end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp_2 = code(K, m, n, M, l)
t_0 = exp((-0.25 * (m ^ 2.0)));
tmp = 0.0;
if (m <= -54.0)
tmp = t_0;
elseif (m <= -8.2e-119)
tmp = cos(M) * exp(-l);
elseif (m <= 53.0)
tmp = exp((n * ((m * 0.5) + (-1.0 - M))));
else
tmp = t_0;
end
tmp_2 = tmp;
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[m, -54.0], t$95$0, If[LessEqual[m, -8.2e-119], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 53.0], N[Exp[N[(n * N[(N[(m * 0.5), $MachinePrecision] + N[(-1.0 - M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
t_0 := e^{-0.25 \cdot {m}^{2}}\\
\mathbf{if}\;m \leq -54:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq -8.2 \cdot 10^{-119}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\mathbf{elif}\;m \leq 53:\\
\;\;\;\;e^{n \cdot \left(m \cdot 0.5 + \left(-1 - M\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < -54 or 53 < m Initial program 72.7%
Taylor expanded in K around 0 99.2%
Simplified99.2%
Taylor expanded in m around inf 97.6%
*-commutative97.6%
Simplified97.6%
Taylor expanded in M around 0 97.6%
if -54 < m < -8.20000000000000041e-119Initial program 75.1%
Taylor expanded in l around inf 37.1%
mul-1-neg37.1%
Simplified37.1%
Taylor expanded in K around 0 36.7%
cos-neg36.7%
Simplified36.7%
if -8.20000000000000041e-119 < m < 53Initial program 86.0%
add-exp-log84.2%
*-commutative84.2%
log-prod51.1%
Applied egg-rr27.9%
Taylor expanded in n around -inf 26.3%
mul-1-neg26.3%
mul-1-neg26.3%
*-commutative26.3%
Simplified26.3%
Taylor expanded in n around 0 41.5%
Final simplification67.6%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (exp (* -0.25 (pow m 2.0)))))
(if (<= m -54.0)
t_0
(if (<= m -1.1e-118)
(exp (- l))
(if (<= m 54.0) (exp (* n (+ (* m 0.5) (- -1.0 M)))) t_0)))))assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
double t_0 = exp((-0.25 * pow(m, 2.0)));
double tmp;
if (m <= -54.0) {
tmp = t_0;
} else if (m <= -1.1e-118) {
tmp = exp(-l);
} else if (m <= 54.0) {
tmp = exp((n * ((m * 0.5) + (-1.0 - M))));
} else {
tmp = t_0;
}
return tmp;
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: tmp
t_0 = exp(((-0.25d0) * (m ** 2.0d0)))
if (m <= (-54.0d0)) then
tmp = t_0
else if (m <= (-1.1d-118)) then
tmp = exp(-l)
else if (m <= 54.0d0) then
tmp = exp((n * ((m * 0.5d0) + ((-1.0d0) - m_1))))
else
tmp = t_0
end if
code = tmp
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.exp((-0.25 * Math.pow(m, 2.0)));
double tmp;
if (m <= -54.0) {
tmp = t_0;
} else if (m <= -1.1e-118) {
tmp = Math.exp(-l);
} else if (m <= 54.0) {
tmp = Math.exp((n * ((m * 0.5) + (-1.0 - M))));
} else {
tmp = t_0;
}
return tmp;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): t_0 = math.exp((-0.25 * math.pow(m, 2.0))) tmp = 0 if m <= -54.0: tmp = t_0 elif m <= -1.1e-118: tmp = math.exp(-l) elif m <= 54.0: tmp = math.exp((n * ((m * 0.5) + (-1.0 - M)))) else: tmp = t_0 return tmp
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) t_0 = exp(Float64(-0.25 * (m ^ 2.0))) tmp = 0.0 if (m <= -54.0) tmp = t_0; elseif (m <= -1.1e-118) tmp = exp(Float64(-l)); elseif (m <= 54.0) tmp = exp(Float64(n * Float64(Float64(m * 0.5) + Float64(-1.0 - M)))); else tmp = t_0; end return tmp end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp_2 = code(K, m, n, M, l)
t_0 = exp((-0.25 * (m ^ 2.0)));
tmp = 0.0;
if (m <= -54.0)
tmp = t_0;
elseif (m <= -1.1e-118)
tmp = exp(-l);
elseif (m <= 54.0)
tmp = exp((n * ((m * 0.5) + (-1.0 - M))));
else
tmp = t_0;
end
tmp_2 = tmp;
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[m, -54.0], t$95$0, If[LessEqual[m, -1.1e-118], N[Exp[(-l)], $MachinePrecision], If[LessEqual[m, 54.0], N[Exp[N[(n * N[(N[(m * 0.5), $MachinePrecision] + N[(-1.0 - M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
t_0 := e^{-0.25 \cdot {m}^{2}}\\
\mathbf{if}\;m \leq -54:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq -1.1 \cdot 10^{-118}:\\
\;\;\;\;e^{-\ell}\\
\mathbf{elif}\;m \leq 54:\\
\;\;\;\;e^{n \cdot \left(m \cdot 0.5 + \left(-1 - M\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < -54 or 54 < m Initial program 72.7%
Taylor expanded in K around 0 99.2%
Simplified99.2%
Taylor expanded in m around inf 97.6%
*-commutative97.6%
Simplified97.6%
Taylor expanded in M around 0 97.6%
if -54 < m < -1.09999999999999992e-118Initial program 75.1%
add-exp-log73.9%
*-commutative73.9%
log-prod43.5%
Applied egg-rr22.1%
Taylor expanded in l around inf 36.7%
neg-mul-136.7%
Simplified36.7%
if -1.09999999999999992e-118 < m < 54Initial program 86.0%
add-exp-log84.2%
*-commutative84.2%
log-prod51.1%
Applied egg-rr27.9%
Taylor expanded in n around -inf 26.3%
mul-1-neg26.3%
mul-1-neg26.3%
*-commutative26.3%
Simplified26.3%
Taylor expanded in n around 0 41.5%
Final simplification67.6%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
(FPCore (K m n M l)
:precision binary64
(if (<= l -720.0)
(exp l)
(if (<= l -4e-244)
(exp (* n (- M)))
(if (<= l 5.3e-5) (exp (* 0.5 (* n m))) (exp (- l))))))assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= -720.0) {
tmp = exp(l);
} else if (l <= -4e-244) {
tmp = exp((n * -M));
} else if (l <= 5.3e-5) {
tmp = exp((0.5 * (n * m)));
} else {
tmp = exp(-l);
}
return tmp;
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
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 <= (-720.0d0)) then
tmp = exp(l)
else if (l <= (-4d-244)) then
tmp = exp((n * -m_1))
else if (l <= 5.3d-5) then
tmp = exp((0.5d0 * (n * m)))
else
tmp = exp(-l)
end if
code = tmp
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= -720.0) {
tmp = Math.exp(l);
} else if (l <= -4e-244) {
tmp = Math.exp((n * -M));
} else if (l <= 5.3e-5) {
tmp = Math.exp((0.5 * (n * m)));
} else {
tmp = Math.exp(-l);
}
return tmp;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): tmp = 0 if l <= -720.0: tmp = math.exp(l) elif l <= -4e-244: tmp = math.exp((n * -M)) elif l <= 5.3e-5: tmp = math.exp((0.5 * (n * m))) else: tmp = math.exp(-l) return tmp
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) tmp = 0.0 if (l <= -720.0) tmp = exp(l); elseif (l <= -4e-244) tmp = exp(Float64(n * Float64(-M))); elseif (l <= 5.3e-5) tmp = exp(Float64(0.5 * Float64(n * m))); else tmp = exp(Float64(-l)); end return tmp end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp_2 = code(K, m, n, M, l)
tmp = 0.0;
if (l <= -720.0)
tmp = exp(l);
elseif (l <= -4e-244)
tmp = exp((n * -M));
elseif (l <= 5.3e-5)
tmp = exp((0.5 * (n * m)));
else
tmp = exp(-l);
end
tmp_2 = tmp;
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := If[LessEqual[l, -720.0], N[Exp[l], $MachinePrecision], If[LessEqual[l, -4e-244], N[Exp[N[(n * (-M)), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 5.3e-5], N[Exp[N[(0.5 * N[(n * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Exp[(-l)], $MachinePrecision]]]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -720:\\
\;\;\;\;e^{\ell}\\
\mathbf{elif}\;\ell \leq -4 \cdot 10^{-244}:\\
\;\;\;\;e^{n \cdot \left(-M\right)}\\
\mathbf{elif}\;\ell \leq 5.3 \cdot 10^{-5}:\\
\;\;\;\;e^{0.5 \cdot \left(n \cdot m\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{-\ell}\\
\end{array}
\end{array}
if l < -720Initial program 73.8%
add-exp-log70.5%
*-commutative70.5%
log-prod45.9%
Applied egg-rr18.5%
Taylor expanded in l around inf 22.4%
neg-mul-122.4%
Simplified22.4%
add-sqr-sqrt22.4%
sqrt-unprod22.4%
sqr-neg22.4%
sqrt-unprod0.0%
add-sqr-sqrt69.3%
*-un-lft-identity69.3%
Applied egg-rr69.3%
*-lft-identity69.3%
Simplified69.3%
if -720 < l < -3.9999999999999997e-244Initial program 88.9%
add-exp-log88.9%
*-commutative88.9%
log-prod64.8%
Applied egg-rr16.9%
Taylor expanded in n around -inf 36.2%
mul-1-neg36.2%
mul-1-neg36.2%
*-commutative36.2%
Simplified36.2%
Taylor expanded in M around inf 45.9%
associate-*r*45.9%
neg-mul-145.9%
Simplified45.9%
if -3.9999999999999997e-244 < l < 5.3000000000000001e-5Initial program 71.8%
add-exp-log71.4%
*-commutative71.4%
log-prod35.2%
Applied egg-rr9.2%
Taylor expanded in n around -inf 30.1%
mul-1-neg30.1%
mul-1-neg30.1%
*-commutative30.1%
Simplified30.1%
Taylor expanded in m around inf 36.3%
if 5.3000000000000001e-5 < l Initial program 81.9%
add-exp-log81.9%
*-commutative81.9%
log-prod41.7%
Applied egg-rr21.2%
Taylor expanded in l around inf 94.6%
neg-mul-194.6%
Simplified94.6%
Final simplification62.6%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (if (<= l -740.0) (exp l) (if (<= l 0.105) (exp (* n (+ (* m 0.5) (- -1.0 M)))) (exp (- l)))))
assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= -740.0) {
tmp = exp(l);
} else if (l <= 0.105) {
tmp = exp((n * ((m * 0.5) + (-1.0 - M))));
} else {
tmp = exp(-l);
}
return tmp;
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
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 <= (-740.0d0)) then
tmp = exp(l)
else if (l <= 0.105d0) then
tmp = exp((n * ((m * 0.5d0) + ((-1.0d0) - m_1))))
else
tmp = exp(-l)
end if
code = tmp
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= -740.0) {
tmp = Math.exp(l);
} else if (l <= 0.105) {
tmp = Math.exp((n * ((m * 0.5) + (-1.0 - M))));
} else {
tmp = Math.exp(-l);
}
return tmp;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): tmp = 0 if l <= -740.0: tmp = math.exp(l) elif l <= 0.105: tmp = math.exp((n * ((m * 0.5) + (-1.0 - M)))) else: tmp = math.exp(-l) return tmp
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) tmp = 0.0 if (l <= -740.0) tmp = exp(l); elseif (l <= 0.105) tmp = exp(Float64(n * Float64(Float64(m * 0.5) + Float64(-1.0 - M)))); else tmp = exp(Float64(-l)); end return tmp end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp_2 = code(K, m, n, M, l)
tmp = 0.0;
if (l <= -740.0)
tmp = exp(l);
elseif (l <= 0.105)
tmp = exp((n * ((m * 0.5) + (-1.0 - M))));
else
tmp = exp(-l);
end
tmp_2 = tmp;
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := If[LessEqual[l, -740.0], N[Exp[l], $MachinePrecision], If[LessEqual[l, 0.105], N[Exp[N[(n * N[(N[(m * 0.5), $MachinePrecision] + N[(-1.0 - M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Exp[(-l)], $MachinePrecision]]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -740:\\
\;\;\;\;e^{\ell}\\
\mathbf{elif}\;\ell \leq 0.105:\\
\;\;\;\;e^{n \cdot \left(m \cdot 0.5 + \left(-1 - M\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{-\ell}\\
\end{array}
\end{array}
if l < -740Initial program 73.8%
add-exp-log70.5%
*-commutative70.5%
log-prod45.9%
Applied egg-rr18.5%
Taylor expanded in l around inf 22.4%
neg-mul-122.4%
Simplified22.4%
add-sqr-sqrt22.4%
sqrt-unprod22.4%
sqr-neg22.4%
sqrt-unprod0.0%
add-sqr-sqrt69.3%
*-un-lft-identity69.3%
Applied egg-rr69.3%
*-lft-identity69.3%
Simplified69.3%
if -740 < l < 0.104999999999999996Initial program 79.6%
add-exp-log79.4%
*-commutative79.4%
log-prod47.4%
Applied egg-rr12.4%
Taylor expanded in n around -inf 32.3%
mul-1-neg32.3%
mul-1-neg32.3%
*-commutative32.3%
Simplified32.3%
Taylor expanded in n around 0 48.3%
if 0.104999999999999996 < l Initial program 81.4%
add-exp-log81.4%
*-commutative81.4%
log-prod42.9%
Applied egg-rr21.8%
Taylor expanded in l around inf 97.2%
neg-mul-197.2%
Simplified97.2%
Final simplification66.7%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (if (<= l -720.0) (exp l) (if (<= l 0.105) (exp (* n (- M))) (exp (- l)))))
assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= -720.0) {
tmp = exp(l);
} else if (l <= 0.105) {
tmp = exp((n * -M));
} else {
tmp = exp(-l);
}
return tmp;
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
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 <= (-720.0d0)) then
tmp = exp(l)
else if (l <= 0.105d0) then
tmp = exp((n * -m_1))
else
tmp = exp(-l)
end if
code = tmp
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= -720.0) {
tmp = Math.exp(l);
} else if (l <= 0.105) {
tmp = Math.exp((n * -M));
} else {
tmp = Math.exp(-l);
}
return tmp;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): tmp = 0 if l <= -720.0: tmp = math.exp(l) elif l <= 0.105: tmp = math.exp((n * -M)) else: tmp = math.exp(-l) return tmp
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) tmp = 0.0 if (l <= -720.0) tmp = exp(l); elseif (l <= 0.105) tmp = exp(Float64(n * Float64(-M))); else tmp = exp(Float64(-l)); end return tmp end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp_2 = code(K, m, n, M, l)
tmp = 0.0;
if (l <= -720.0)
tmp = exp(l);
elseif (l <= 0.105)
tmp = exp((n * -M));
else
tmp = exp(-l);
end
tmp_2 = tmp;
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := If[LessEqual[l, -720.0], N[Exp[l], $MachinePrecision], If[LessEqual[l, 0.105], N[Exp[N[(n * (-M)), $MachinePrecision]], $MachinePrecision], N[Exp[(-l)], $MachinePrecision]]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -720:\\
\;\;\;\;e^{\ell}\\
\mathbf{elif}\;\ell \leq 0.105:\\
\;\;\;\;e^{n \cdot \left(-M\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{-\ell}\\
\end{array}
\end{array}
if l < -720Initial program 73.8%
add-exp-log70.5%
*-commutative70.5%
log-prod45.9%
Applied egg-rr18.5%
Taylor expanded in l around inf 22.4%
neg-mul-122.4%
Simplified22.4%
add-sqr-sqrt22.4%
sqrt-unprod22.4%
sqr-neg22.4%
sqrt-unprod0.0%
add-sqr-sqrt69.3%
*-un-lft-identity69.3%
Applied egg-rr69.3%
*-lft-identity69.3%
Simplified69.3%
if -720 < l < 0.104999999999999996Initial program 79.6%
add-exp-log79.4%
*-commutative79.4%
log-prod47.4%
Applied egg-rr12.4%
Taylor expanded in n around -inf 32.3%
mul-1-neg32.3%
mul-1-neg32.3%
*-commutative32.3%
Simplified32.3%
Taylor expanded in M around inf 39.2%
associate-*r*39.2%
neg-mul-139.2%
Simplified39.2%
if 0.104999999999999996 < l Initial program 81.4%
add-exp-log81.4%
*-commutative81.4%
log-prod42.9%
Applied egg-rr21.8%
Taylor expanded in l around inf 97.2%
neg-mul-197.2%
Simplified97.2%
Final simplification62.3%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (if (<= l -105.0) (exp l) (exp (- l))))
assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= -105.0) {
tmp = exp(l);
} else {
tmp = exp(-l);
}
return tmp;
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
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 <= (-105.0d0)) then
tmp = exp(l)
else
tmp = exp(-l)
end if
code = tmp
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= -105.0) {
tmp = Math.exp(l);
} else {
tmp = Math.exp(-l);
}
return tmp;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): tmp = 0 if l <= -105.0: tmp = math.exp(l) else: tmp = math.exp(-l) return tmp
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) tmp = 0.0 if (l <= -105.0) tmp = exp(l); else tmp = exp(Float64(-l)); end return tmp end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp_2 = code(K, m, n, M, l)
tmp = 0.0;
if (l <= -105.0)
tmp = exp(l);
else
tmp = exp(-l);
end
tmp_2 = tmp;
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := If[LessEqual[l, -105.0], N[Exp[l], $MachinePrecision], N[Exp[(-l)], $MachinePrecision]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -105:\\
\;\;\;\;e^{\ell}\\
\mathbf{else}:\\
\;\;\;\;e^{-\ell}\\
\end{array}
\end{array}
if l < -105Initial program 72.6%
add-exp-log69.4%
*-commutative69.4%
log-prod45.2%
Applied egg-rr18.2%
Taylor expanded in l around inf 22.1%
neg-mul-122.1%
Simplified22.1%
add-sqr-sqrt22.1%
sqrt-unprod22.1%
sqr-neg22.1%
sqrt-unprod0.0%
add-sqr-sqrt68.3%
*-un-lft-identity68.3%
Applied egg-rr68.3%
*-lft-identity68.3%
Simplified68.3%
if -105 < l Initial program 80.7%
add-exp-log80.6%
*-commutative80.6%
log-prod46.0%
Applied egg-rr15.8%
Taylor expanded in l around inf 44.3%
neg-mul-144.3%
Simplified44.3%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (exp l))
assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
return exp(l);
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
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
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
return Math.exp(l);
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): return math.exp(l)
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) return exp(l) end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp = code(K, m, n, M, l)
tmp = exp(l);
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := N[Exp[l], $MachinePrecision]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
e^{\ell}
\end{array}
Initial program 78.7%
add-exp-log77.8%
*-commutative77.8%
log-prod45.8%
Applied egg-rr16.4%
Taylor expanded in l around inf 38.9%
neg-mul-138.9%
Simplified38.9%
add-sqr-sqrt10.4%
sqrt-unprod12.7%
sqr-neg12.7%
sqrt-unprod2.3%
add-sqr-sqrt23.8%
*-un-lft-identity23.8%
Applied egg-rr23.8%
*-lft-identity23.8%
Simplified23.8%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (+ 1.0 (* l (+ (* l (+ 0.5 (* l -0.16666666666666666))) -1.0))))
assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
return 1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0));
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
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 + (l * ((l * (0.5d0 + (l * (-0.16666666666666666d0)))) + (-1.0d0)))
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
return 1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0));
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): return 1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0))
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) return Float64(1.0 + Float64(l * Float64(Float64(l * Float64(0.5 + Float64(l * -0.16666666666666666))) + -1.0))) end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp = code(K, m, n, M, l)
tmp = 1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0));
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := N[(1.0 + N[(l * N[(N[(l * N[(0.5 + N[(l * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
1 + \ell \cdot \left(\ell \cdot \left(0.5 + \ell \cdot -0.16666666666666666\right) + -1\right)
\end{array}
Initial program 78.7%
add-exp-log77.8%
*-commutative77.8%
log-prod45.8%
Applied egg-rr16.4%
Taylor expanded in l around inf 38.9%
neg-mul-138.9%
Simplified38.9%
Taylor expanded in l around 0 12.5%
Final simplification12.5%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (+ 1.0 (* l (+ (* l 0.5) -1.0))))
assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
return 1.0 + (l * ((l * 0.5) + -1.0));
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
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 + (l * ((l * 0.5d0) + (-1.0d0)))
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
return 1.0 + (l * ((l * 0.5) + -1.0));
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): return 1.0 + (l * ((l * 0.5) + -1.0))
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) return Float64(1.0 + Float64(l * Float64(Float64(l * 0.5) + -1.0))) end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp = code(K, m, n, M, l)
tmp = 1.0 + (l * ((l * 0.5) + -1.0));
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := N[(1.0 + N[(l * N[(N[(l * 0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
1 + \ell \cdot \left(\ell \cdot 0.5 + -1\right)
\end{array}
Initial program 78.7%
add-exp-log77.8%
*-commutative77.8%
log-prod45.8%
Applied egg-rr16.4%
Taylor expanded in l around inf 38.9%
neg-mul-138.9%
Simplified38.9%
Taylor expanded in l around 0 11.4%
Final simplification11.4%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 1.0)
assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
return 1.0;
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
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
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
return 1.0;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): return 1.0
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) return 1.0 end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp = code(K, m, n, M, l)
tmp = 1.0;
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := 1.0
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
1
\end{array}
Initial program 78.7%
add-exp-log77.8%
*-commutative77.8%
log-prod45.8%
Applied egg-rr16.4%
Taylor expanded in M around inf 8.4%
Taylor expanded in M around 0 8.3%
herbie shell --seed 2024151
(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)))))))