
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (cbrt (fma x eps_m x))))
(if (<= eps_m 1.05e-47)
(/ (+ x 1.0) (exp x))
(/
(+
(exp (* x (+ eps_m -1.0)))
(/ 1.0 (pow (pow (exp (cbrt (pow t_0 4.0))) (pow (cbrt t_0) 2.0)) t_0)))
2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = cbrt(fma(x, eps_m, x));
double tmp;
if (eps_m <= 1.05e-47) {
tmp = (x + 1.0) / exp(x);
} else {
tmp = (exp((x * (eps_m + -1.0))) + (1.0 / pow(pow(exp(cbrt(pow(t_0, 4.0))), pow(cbrt(t_0), 2.0)), t_0))) / 2.0;
}
return tmp;
}
eps_m = abs(eps) function code(x, eps_m) t_0 = cbrt(fma(x, eps_m, x)) tmp = 0.0 if (eps_m <= 1.05e-47) tmp = Float64(Float64(x + 1.0) / exp(x)); else tmp = Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + Float64(1.0 / ((exp(cbrt((t_0 ^ 4.0))) ^ (cbrt(t_0) ^ 2.0)) ^ t_0))) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Power[N[(x * eps$95$m + x), $MachinePrecision], 1/3], $MachinePrecision]}, If[LessEqual[eps$95$m, 1.05e-47], N[(N[(x + 1.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[Power[N[Power[N[Exp[N[Power[N[Power[t$95$0, 4.0], $MachinePrecision], 1/3], $MachinePrecision]], $MachinePrecision], N[Power[N[Power[t$95$0, 1/3], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := \sqrt[3]{\mathsf{fma}\left(x, eps\_m, x\right)}\\
\mathbf{if}\;eps\_m \leq 1.05 \cdot 10^{-47}:\\
\;\;\;\;\frac{x + 1}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(eps\_m + -1\right)} + \frac{1}{{\left({\left(e^{\sqrt[3]{{t\_0}^{4}}}\right)}^{\left({\left(\sqrt[3]{t\_0}\right)}^{2}\right)}\right)}^{t\_0}}}{2}\\
\end{array}
\end{array}
if eps < 1.05e-47Initial program 69.4%
Simplified61.6%
Taylor expanded in eps around 0 31.5%
associate-+r+62.0%
mul-1-neg62.0%
sub-neg62.0%
+-inverses62.0%
distribute-lft-out62.0%
distribute-rgt1-in62.6%
mul-1-neg62.6%
Simplified62.6%
Taylor expanded in eps around 0 62.6%
+-commutative62.6%
Simplified62.6%
*-commutative62.6%
exp-neg62.6%
un-div-inv62.6%
Applied egg-rr62.6%
if 1.05e-47 < eps Initial program 90.5%
Simplified78.6%
Taylor expanded in eps around inf 99.9%
add-cube-cbrt99.9%
exp-prod99.9%
pow299.9%
+-commutative99.9%
*-commutative99.9%
fma-define99.9%
+-commutative99.9%
*-commutative99.9%
fma-define99.9%
Applied egg-rr99.9%
add-cube-cbrt99.9%
exp-prod99.9%
cbrt-unprod100.0%
pow-prod-up100.0%
metadata-eval100.0%
unpow2100.0%
cbrt-prod100.0%
pow2100.0%
Applied egg-rr100.0%
Final simplification74.6%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (cbrt (fma x eps_m x))))
(if (<= eps_m 2e-48)
(/ (+ x 1.0) (exp x))
(/
(+ (exp (* x (+ eps_m -1.0))) (/ 1.0 (pow (pow (exp t_0) t_0) t_0)))
2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = cbrt(fma(x, eps_m, x));
double tmp;
if (eps_m <= 2e-48) {
tmp = (x + 1.0) / exp(x);
} else {
tmp = (exp((x * (eps_m + -1.0))) + (1.0 / pow(pow(exp(t_0), t_0), t_0))) / 2.0;
}
return tmp;
}
eps_m = abs(eps) function code(x, eps_m) t_0 = cbrt(fma(x, eps_m, x)) tmp = 0.0 if (eps_m <= 2e-48) tmp = Float64(Float64(x + 1.0) / exp(x)); else tmp = Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + Float64(1.0 / ((exp(t_0) ^ t_0) ^ t_0))) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Power[N[(x * eps$95$m + x), $MachinePrecision], 1/3], $MachinePrecision]}, If[LessEqual[eps$95$m, 2e-48], N[(N[(x + 1.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[Power[N[Power[N[Exp[t$95$0], $MachinePrecision], t$95$0], $MachinePrecision], t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := \sqrt[3]{\mathsf{fma}\left(x, eps\_m, x\right)}\\
\mathbf{if}\;eps\_m \leq 2 \cdot 10^{-48}:\\
\;\;\;\;\frac{x + 1}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(eps\_m + -1\right)} + \frac{1}{{\left({\left(e^{t\_0}\right)}^{t\_0}\right)}^{t\_0}}}{2}\\
\end{array}
\end{array}
if eps < 1.9999999999999999e-48Initial program 69.4%
Simplified61.6%
Taylor expanded in eps around 0 31.5%
associate-+r+62.0%
mul-1-neg62.0%
sub-neg62.0%
+-inverses62.0%
distribute-lft-out62.0%
distribute-rgt1-in62.6%
mul-1-neg62.6%
Simplified62.6%
Taylor expanded in eps around 0 62.6%
+-commutative62.6%
Simplified62.6%
*-commutative62.6%
exp-neg62.6%
un-div-inv62.6%
Applied egg-rr62.6%
if 1.9999999999999999e-48 < eps Initial program 90.5%
Simplified78.6%
Taylor expanded in eps around inf 99.9%
add-cube-cbrt99.9%
exp-prod99.9%
pow299.9%
+-commutative99.9%
*-commutative99.9%
fma-define99.9%
+-commutative99.9%
*-commutative99.9%
fma-define99.9%
Applied egg-rr99.9%
unpow299.9%
exp-prod100.0%
Applied egg-rr100.0%
Final simplification74.6%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (cbrt (* eps_m x))))
(if (<= eps_m 5e-46)
(/ (+ x 1.0) (exp x))
(/
(+ (exp (* x (+ eps_m -1.0))) (/ 1.0 (pow (exp (pow t_0 2.0)) t_0)))
2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = cbrt((eps_m * x));
double tmp;
if (eps_m <= 5e-46) {
tmp = (x + 1.0) / exp(x);
} else {
tmp = (exp((x * (eps_m + -1.0))) + (1.0 / pow(exp(pow(t_0, 2.0)), t_0))) / 2.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = Math.cbrt((eps_m * x));
double tmp;
if (eps_m <= 5e-46) {
tmp = (x + 1.0) / Math.exp(x);
} else {
tmp = (Math.exp((x * (eps_m + -1.0))) + (1.0 / Math.pow(Math.exp(Math.pow(t_0, 2.0)), t_0))) / 2.0;
}
return tmp;
}
eps_m = abs(eps) function code(x, eps_m) t_0 = cbrt(Float64(eps_m * x)) tmp = 0.0 if (eps_m <= 5e-46) tmp = Float64(Float64(x + 1.0) / exp(x)); else tmp = Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + Float64(1.0 / (exp((t_0 ^ 2.0)) ^ t_0))) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Power[N[(eps$95$m * x), $MachinePrecision], 1/3], $MachinePrecision]}, If[LessEqual[eps$95$m, 5e-46], N[(N[(x + 1.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[Power[N[Exp[N[Power[t$95$0, 2.0], $MachinePrecision]], $MachinePrecision], t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := \sqrt[3]{eps\_m \cdot x}\\
\mathbf{if}\;eps\_m \leq 5 \cdot 10^{-46}:\\
\;\;\;\;\frac{x + 1}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(eps\_m + -1\right)} + \frac{1}{{\left(e^{{t\_0}^{2}}\right)}^{t\_0}}}{2}\\
\end{array}
\end{array}
if eps < 4.99999999999999992e-46Initial program 69.4%
Simplified61.6%
Taylor expanded in eps around 0 31.5%
associate-+r+62.0%
mul-1-neg62.0%
sub-neg62.0%
+-inverses62.0%
distribute-lft-out62.0%
distribute-rgt1-in62.6%
mul-1-neg62.6%
Simplified62.6%
Taylor expanded in eps around 0 62.6%
+-commutative62.6%
Simplified62.6%
*-commutative62.6%
exp-neg62.6%
un-div-inv62.6%
Applied egg-rr62.6%
if 4.99999999999999992e-46 < eps Initial program 90.5%
Simplified78.6%
Taylor expanded in eps around inf 99.9%
add-cube-cbrt99.9%
exp-prod99.9%
pow299.9%
+-commutative99.9%
*-commutative99.9%
fma-define99.9%
+-commutative99.9%
*-commutative99.9%
fma-define99.9%
Applied egg-rr99.9%
Taylor expanded in eps around inf 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in eps around inf 99.9%
*-commutative99.9%
Simplified99.9%
Final simplification74.6%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= eps_m 1e-47)
(/ (+ x 1.0) (exp x))
(/
(+
(exp (* x (+ eps_m -1.0)))
(/ 1.0 (pow (sqrt (exp (fma x eps_m x))) 2.0)))
2.0)))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 1e-47) {
tmp = (x + 1.0) / exp(x);
} else {
tmp = (exp((x * (eps_m + -1.0))) + (1.0 / pow(sqrt(exp(fma(x, eps_m, x))), 2.0))) / 2.0;
}
return tmp;
}
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 1e-47) tmp = Float64(Float64(x + 1.0) / exp(x)); else tmp = Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + Float64(1.0 / (sqrt(exp(fma(x, eps_m, x))) ^ 2.0))) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 1e-47], N[(N[(x + 1.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[Power[N[Sqrt[N[Exp[N[(x * eps$95$m + x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 10^{-47}:\\
\;\;\;\;\frac{x + 1}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(eps\_m + -1\right)} + \frac{1}{{\left(\sqrt{e^{\mathsf{fma}\left(x, eps\_m, x\right)}}\right)}^{2}}}{2}\\
\end{array}
\end{array}
if eps < 9.9999999999999997e-48Initial program 69.4%
Simplified61.6%
Taylor expanded in eps around 0 31.5%
associate-+r+62.0%
mul-1-neg62.0%
sub-neg62.0%
+-inverses62.0%
distribute-lft-out62.0%
distribute-rgt1-in62.6%
mul-1-neg62.6%
Simplified62.6%
Taylor expanded in eps around 0 62.6%
+-commutative62.6%
Simplified62.6%
*-commutative62.6%
exp-neg62.6%
un-div-inv62.6%
Applied egg-rr62.6%
if 9.9999999999999997e-48 < eps Initial program 90.5%
Simplified78.6%
Taylor expanded in eps around inf 99.9%
add-sqr-sqrt99.9%
pow299.9%
+-commutative99.9%
*-commutative99.9%
fma-define99.9%
Applied egg-rr99.9%
Final simplification74.6%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 5e-46) (/ (+ x 1.0) (exp x)) (/ (+ (exp (* x (+ eps_m -1.0))) (/ 1.0 (exp (* eps_m x)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 5e-46) {
tmp = (x + 1.0) / exp(x);
} else {
tmp = (exp((x * (eps_m + -1.0))) + (1.0 / exp((eps_m * x)))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (eps_m <= 5d-46) then
tmp = (x + 1.0d0) / exp(x)
else
tmp = (exp((x * (eps_m + (-1.0d0)))) + (1.0d0 / exp((eps_m * x)))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (eps_m <= 5e-46) {
tmp = (x + 1.0) / Math.exp(x);
} else {
tmp = (Math.exp((x * (eps_m + -1.0))) + (1.0 / Math.exp((eps_m * x)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 5e-46: tmp = (x + 1.0) / math.exp(x) else: tmp = (math.exp((x * (eps_m + -1.0))) + (1.0 / math.exp((eps_m * x)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 5e-46) tmp = Float64(Float64(x + 1.0) / exp(x)); else tmp = Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + Float64(1.0 / exp(Float64(eps_m * x)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 5e-46) tmp = (x + 1.0) / exp(x); else tmp = (exp((x * (eps_m + -1.0))) + (1.0 / exp((eps_m * x)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 5e-46], N[(N[(x + 1.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[Exp[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 5 \cdot 10^{-46}:\\
\;\;\;\;\frac{x + 1}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(eps\_m + -1\right)} + \frac{1}{e^{eps\_m \cdot x}}}{2}\\
\end{array}
\end{array}
if eps < 4.99999999999999992e-46Initial program 69.4%
Simplified61.6%
Taylor expanded in eps around 0 31.5%
associate-+r+62.0%
mul-1-neg62.0%
sub-neg62.0%
+-inverses62.0%
distribute-lft-out62.0%
distribute-rgt1-in62.6%
mul-1-neg62.6%
Simplified62.6%
Taylor expanded in eps around 0 62.6%
+-commutative62.6%
Simplified62.6%
*-commutative62.6%
exp-neg62.6%
un-div-inv62.6%
Applied egg-rr62.6%
if 4.99999999999999992e-46 < eps Initial program 90.5%
Simplified78.6%
Taylor expanded in eps around inf 99.9%
Taylor expanded in eps around inf 99.9%
*-commutative99.9%
Simplified99.9%
Final simplification74.6%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 5.5) (/ (+ x 1.0) (exp x)) (/ (* eps_m (+ x (/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) eps_m))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 5.5) {
tmp = (x + 1.0) / exp(x);
} else {
tmp = (eps_m * (x + ((1.0 + exp((x * (-1.0 - eps_m)))) / eps_m))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (eps_m <= 5.5d0) then
tmp = (x + 1.0d0) / exp(x)
else
tmp = (eps_m * (x + ((1.0d0 + exp((x * ((-1.0d0) - eps_m)))) / eps_m))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (eps_m <= 5.5) {
tmp = (x + 1.0) / Math.exp(x);
} else {
tmp = (eps_m * (x + ((1.0 + Math.exp((x * (-1.0 - eps_m)))) / eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 5.5: tmp = (x + 1.0) / math.exp(x) else: tmp = (eps_m * (x + ((1.0 + math.exp((x * (-1.0 - eps_m)))) / eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 5.5) tmp = Float64(Float64(x + 1.0) / exp(x)); else tmp = Float64(Float64(eps_m * Float64(x + Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / eps_m))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 5.5) tmp = (x + 1.0) / exp(x); else tmp = (eps_m * (x + ((1.0 + exp((x * (-1.0 - eps_m)))) / eps_m))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 5.5], N[(N[(x + 1.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[(N[(eps$95$m * N[(x + N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 5.5:\\
\;\;\;\;\frac{x + 1}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{eps\_m \cdot \left(x + \frac{1 + e^{x \cdot \left(-1 - eps\_m\right)}}{eps\_m}\right)}{2}\\
\end{array}
\end{array}
if eps < 5.5Initial program 67.2%
Simplified59.9%
Taylor expanded in eps around 0 31.8%
associate-+r+64.4%
mul-1-neg64.4%
sub-neg64.4%
+-inverses64.4%
distribute-lft-out64.4%
distribute-rgt1-in65.0%
mul-1-neg65.0%
Simplified65.0%
Taylor expanded in eps around 0 65.0%
+-commutative65.0%
Simplified65.0%
*-commutative65.0%
exp-neg65.0%
un-div-inv65.0%
Applied egg-rr65.0%
if 5.5 < eps Initial program 99.9%
Simplified99.9%
Taylor expanded in x around 0 51.1%
associate-+r+51.1%
mul-1-neg51.1%
associate-*r*51.1%
distribute-rgt-neg-in51.1%
remove-double-neg51.1%
sub-neg51.1%
mul-1-neg51.1%
associate-*r/51.1%
metadata-eval51.1%
sub-neg51.1%
distribute-neg-in51.1%
metadata-eval51.1%
remove-double-neg51.1%
Simplified51.1%
Taylor expanded in eps around inf 76.8%
Simplified76.8%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1e-288) (/ (+ 1.0 (/ 1.0 (exp (+ x (* eps_m x))))) 2.0) (/ (+ 1.0 (exp (* x (+ eps_m -1.0)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1e-288) {
tmp = (1.0 + (1.0 / exp((x + (eps_m * x))))) / 2.0;
} else {
tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-1d-288)) then
tmp = (1.0d0 + (1.0d0 / exp((x + (eps_m * x))))) / 2.0d0
else
tmp = (1.0d0 + exp((x * (eps_m + (-1.0d0))))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1e-288) {
tmp = (1.0 + (1.0 / Math.exp((x + (eps_m * x))))) / 2.0;
} else {
tmp = (1.0 + Math.exp((x * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1e-288: tmp = (1.0 + (1.0 / math.exp((x + (eps_m * x))))) / 2.0 else: tmp = (1.0 + math.exp((x * (eps_m + -1.0)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1e-288) tmp = Float64(Float64(1.0 + Float64(1.0 / exp(Float64(x + Float64(eps_m * x))))) / 2.0); else tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps_m + -1.0)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1e-288) tmp = (1.0 + (1.0 / exp((x + (eps_m * x))))) / 2.0; else tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1e-288], N[(N[(1.0 + N[(1.0 / N[Exp[N[(x + N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-288}:\\
\;\;\;\;\frac{1 + \frac{1}{e^{x + eps\_m \cdot x}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\end{array}
\end{array}
if x < -1.00000000000000006e-288Initial program 69.3%
Simplified60.9%
Taylor expanded in eps around inf 96.1%
Taylor expanded in x around 0 68.0%
if -1.00000000000000006e-288 < x Initial program 80.4%
Simplified80.4%
Taylor expanded in x around 0 32.3%
Taylor expanded in eps around inf 50.8%
associate-*r*50.8%
neg-mul-150.8%
*-commutative50.8%
Simplified50.8%
Final simplification57.4%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= eps_m 0.011)
(/ (+ x 1.0) (exp x))
(if (<= eps_m 4.7e+198)
(* (+ x 1.0) (exp x))
(/ (/ (* (* x 2.0) (+ eps_m (/ eps_m x))) eps_m) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 0.011) {
tmp = (x + 1.0) / exp(x);
} else if (eps_m <= 4.7e+198) {
tmp = (x + 1.0) * exp(x);
} else {
tmp = (((x * 2.0) * (eps_m + (eps_m / x))) / eps_m) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (eps_m <= 0.011d0) then
tmp = (x + 1.0d0) / exp(x)
else if (eps_m <= 4.7d+198) then
tmp = (x + 1.0d0) * exp(x)
else
tmp = (((x * 2.0d0) * (eps_m + (eps_m / x))) / eps_m) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (eps_m <= 0.011) {
tmp = (x + 1.0) / Math.exp(x);
} else if (eps_m <= 4.7e+198) {
tmp = (x + 1.0) * Math.exp(x);
} else {
tmp = (((x * 2.0) * (eps_m + (eps_m / x))) / eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 0.011: tmp = (x + 1.0) / math.exp(x) elif eps_m <= 4.7e+198: tmp = (x + 1.0) * math.exp(x) else: tmp = (((x * 2.0) * (eps_m + (eps_m / x))) / eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 0.011) tmp = Float64(Float64(x + 1.0) / exp(x)); elseif (eps_m <= 4.7e+198) tmp = Float64(Float64(x + 1.0) * exp(x)); else tmp = Float64(Float64(Float64(Float64(x * 2.0) * Float64(eps_m + Float64(eps_m / x))) / eps_m) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 0.011) tmp = (x + 1.0) / exp(x); elseif (eps_m <= 4.7e+198) tmp = (x + 1.0) * exp(x); else tmp = (((x * 2.0) * (eps_m + (eps_m / x))) / eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 0.011], N[(N[(x + 1.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps$95$m, 4.7e+198], N[(N[(x + 1.0), $MachinePrecision] * N[Exp[x], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(x * 2.0), $MachinePrecision] * N[(eps$95$m + N[(eps$95$m / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 0.011:\\
\;\;\;\;\frac{x + 1}{e^{x}}\\
\mathbf{elif}\;eps\_m \leq 4.7 \cdot 10^{+198}:\\
\;\;\;\;\left(x + 1\right) \cdot e^{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left(x \cdot 2\right) \cdot \left(eps\_m + \frac{eps\_m}{x}\right)}{eps\_m}}{2}\\
\end{array}
\end{array}
if eps < 0.010999999999999999Initial program 67.0%
Simplified59.7%
Taylor expanded in eps around 0 31.4%
associate-+r+64.3%
mul-1-neg64.3%
sub-neg64.3%
+-inverses64.3%
distribute-lft-out64.3%
distribute-rgt1-in64.8%
mul-1-neg64.8%
Simplified64.8%
Taylor expanded in eps around 0 64.8%
+-commutative64.8%
Simplified64.8%
*-commutative64.8%
exp-neg64.8%
un-div-inv64.8%
Applied egg-rr64.8%
if 0.010999999999999999 < eps < 4.7000000000000002e198Initial program 99.9%
Simplified75.9%
Taylor expanded in eps around 0 28.6%
associate-+r+28.6%
mul-1-neg28.6%
sub-neg28.6%
+-inverses28.6%
distribute-lft-out28.6%
distribute-rgt1-in28.6%
mul-1-neg28.6%
Simplified28.6%
Taylor expanded in eps around 0 28.6%
+-commutative28.6%
Simplified28.6%
distribute-lft-in28.6%
add-sqr-sqrt9.6%
sqrt-unprod51.5%
sqr-neg51.5%
sqrt-unprod41.9%
add-sqr-sqrt93.4%
*-rgt-identity93.4%
add-sqr-sqrt51.5%
sqrt-unprod93.4%
sqr-neg93.4%
sqrt-unprod41.9%
add-sqr-sqrt52.2%
Applied egg-rr52.2%
*-commutative52.2%
distribute-lft1-in52.2%
Simplified52.2%
if 4.7000000000000002e198 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 1.7%
associate-+r+1.7%
mul-1-neg1.7%
sub-neg1.7%
+-inverses1.7%
distribute-lft-out1.7%
distribute-rgt1-in1.7%
mul-1-neg1.7%
Simplified1.7%
Taylor expanded in x around 0 37.0%
Taylor expanded in x around inf 71.6%
distribute-lft-out71.6%
associate-*r*71.6%
Simplified71.6%
Final simplification63.4%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 1.45e-207)
(/ (- 2.0 (* eps_m x)) 2.0)
(if (<= x 3.8e+22)
(/ (/ (* (* x 2.0) (+ eps_m (/ eps_m x))) eps_m) 2.0)
(* (+ x 1.0) (exp x)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1.45e-207) {
tmp = (2.0 - (eps_m * x)) / 2.0;
} else if (x <= 3.8e+22) {
tmp = (((x * 2.0) * (eps_m + (eps_m / x))) / eps_m) / 2.0;
} else {
tmp = (x + 1.0) * exp(x);
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 1.45d-207) then
tmp = (2.0d0 - (eps_m * x)) / 2.0d0
else if (x <= 3.8d+22) then
tmp = (((x * 2.0d0) * (eps_m + (eps_m / x))) / eps_m) / 2.0d0
else
tmp = (x + 1.0d0) * exp(x)
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 1.45e-207) {
tmp = (2.0 - (eps_m * x)) / 2.0;
} else if (x <= 3.8e+22) {
tmp = (((x * 2.0) * (eps_m + (eps_m / x))) / eps_m) / 2.0;
} else {
tmp = (x + 1.0) * Math.exp(x);
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1.45e-207: tmp = (2.0 - (eps_m * x)) / 2.0 elif x <= 3.8e+22: tmp = (((x * 2.0) * (eps_m + (eps_m / x))) / eps_m) / 2.0 else: tmp = (x + 1.0) * math.exp(x) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1.45e-207) tmp = Float64(Float64(2.0 - Float64(eps_m * x)) / 2.0); elseif (x <= 3.8e+22) tmp = Float64(Float64(Float64(Float64(x * 2.0) * Float64(eps_m + Float64(eps_m / x))) / eps_m) / 2.0); else tmp = Float64(Float64(x + 1.0) * exp(x)); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 1.45e-207) tmp = (2.0 - (eps_m * x)) / 2.0; elseif (x <= 3.8e+22) tmp = (((x * 2.0) * (eps_m + (eps_m / x))) / eps_m) / 2.0; else tmp = (x + 1.0) * exp(x); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 1.45e-207], N[(N[(2.0 - N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 3.8e+22], N[(N[(N[(N[(x * 2.0), $MachinePrecision] * N[(eps$95$m + N[(eps$95$m / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x + 1.0), $MachinePrecision] * N[Exp[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.45 \cdot 10^{-207}:\\
\;\;\;\;\frac{2 - eps\_m \cdot x}{2}\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{+22}:\\
\;\;\;\;\frac{\frac{\left(x \cdot 2\right) \cdot \left(eps\_m + \frac{eps\_m}{x}\right)}{eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) \cdot e^{x}\\
\end{array}
\end{array}
if x < 1.45000000000000006e-207Initial program 64.9%
Simplified57.2%
Taylor expanded in x around 0 49.6%
Taylor expanded in eps around 0 63.5%
Taylor expanded in eps around inf 63.5%
associate-*r*63.5%
neg-mul-163.5%
Simplified63.5%
if 1.45000000000000006e-207 < x < 3.8000000000000004e22Initial program 63.4%
Simplified46.8%
Taylor expanded in eps around 0 23.2%
associate-+r+59.7%
mul-1-neg59.7%
sub-neg59.7%
+-inverses59.7%
distribute-lft-out59.7%
distribute-rgt1-in59.7%
mul-1-neg59.7%
Simplified59.7%
Taylor expanded in x around 0 53.9%
Taylor expanded in x around inf 70.3%
distribute-lft-out70.3%
associate-*r*70.3%
Simplified70.3%
if 3.8000000000000004e22 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 47.3%
associate-+r+47.3%
mul-1-neg47.3%
sub-neg47.3%
+-inverses47.3%
distribute-lft-out47.3%
distribute-rgt1-in47.3%
mul-1-neg47.3%
Simplified47.3%
Taylor expanded in eps around 0 47.3%
+-commutative47.3%
Simplified47.3%
distribute-lft-in47.3%
add-sqr-sqrt0.0%
sqrt-unprod54.3%
sqr-neg54.3%
sqrt-unprod54.3%
add-sqr-sqrt54.3%
*-rgt-identity54.3%
add-sqr-sqrt0.0%
sqrt-unprod54.3%
sqr-neg54.3%
sqrt-unprod54.3%
add-sqr-sqrt54.3%
Applied egg-rr54.3%
*-commutative54.3%
distribute-lft1-in54.3%
Simplified54.3%
Final simplification61.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 0.011) (/ (+ x 1.0) (exp x)) (/ (+ 1.0 (exp (* x (+ eps_m -1.0)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 0.011) {
tmp = (x + 1.0) / exp(x);
} else {
tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (eps_m <= 0.011d0) then
tmp = (x + 1.0d0) / exp(x)
else
tmp = (1.0d0 + exp((x * (eps_m + (-1.0d0))))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (eps_m <= 0.011) {
tmp = (x + 1.0) / Math.exp(x);
} else {
tmp = (1.0 + Math.exp((x * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 0.011: tmp = (x + 1.0) / math.exp(x) else: tmp = (1.0 + math.exp((x * (eps_m + -1.0)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 0.011) tmp = Float64(Float64(x + 1.0) / exp(x)); else tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps_m + -1.0)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 0.011) tmp = (x + 1.0) / exp(x); else tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 0.011], N[(N[(x + 1.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 0.011:\\
\;\;\;\;\frac{x + 1}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\end{array}
\end{array}
if eps < 0.010999999999999999Initial program 67.0%
Simplified59.7%
Taylor expanded in eps around 0 31.4%
associate-+r+64.3%
mul-1-neg64.3%
sub-neg64.3%
+-inverses64.3%
distribute-lft-out64.3%
distribute-rgt1-in64.8%
mul-1-neg64.8%
Simplified64.8%
Taylor expanded in eps around 0 64.8%
+-commutative64.8%
Simplified64.8%
*-commutative64.8%
exp-neg64.8%
un-div-inv64.8%
Applied egg-rr64.8%
if 0.010999999999999999 < eps Initial program 99.9%
Simplified99.9%
Taylor expanded in x around 0 61.8%
Taylor expanded in eps around inf 61.8%
associate-*r*61.8%
neg-mul-161.8%
*-commutative61.8%
Simplified61.8%
Final simplification64.0%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 7e-207)
(/ (- 2.0 (* eps_m x)) 2.0)
(if (<= x 465.0)
(/ (/ (* (* x 2.0) (+ eps_m (/ eps_m x))) eps_m) 2.0)
(if (<= x 5e+192)
0.0
(/
(/
(+
(- 1.0 x)
(- -1.0 (* x (+ -1.0 (* x (+ 0.5 (* x -0.16666666666666666)))))))
eps_m)
2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 7e-207) {
tmp = (2.0 - (eps_m * x)) / 2.0;
} else if (x <= 465.0) {
tmp = (((x * 2.0) * (eps_m + (eps_m / x))) / eps_m) / 2.0;
} else if (x <= 5e+192) {
tmp = 0.0;
} else {
tmp = (((1.0 - x) + (-1.0 - (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666))))))) / eps_m) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 7d-207) then
tmp = (2.0d0 - (eps_m * x)) / 2.0d0
else if (x <= 465.0d0) then
tmp = (((x * 2.0d0) * (eps_m + (eps_m / x))) / eps_m) / 2.0d0
else if (x <= 5d+192) then
tmp = 0.0d0
else
tmp = (((1.0d0 - x) + ((-1.0d0) - (x * ((-1.0d0) + (x * (0.5d0 + (x * (-0.16666666666666666d0)))))))) / eps_m) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 7e-207) {
tmp = (2.0 - (eps_m * x)) / 2.0;
} else if (x <= 465.0) {
tmp = (((x * 2.0) * (eps_m + (eps_m / x))) / eps_m) / 2.0;
} else if (x <= 5e+192) {
tmp = 0.0;
} else {
tmp = (((1.0 - x) + (-1.0 - (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666))))))) / eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 7e-207: tmp = (2.0 - (eps_m * x)) / 2.0 elif x <= 465.0: tmp = (((x * 2.0) * (eps_m + (eps_m / x))) / eps_m) / 2.0 elif x <= 5e+192: tmp = 0.0 else: tmp = (((1.0 - x) + (-1.0 - (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666))))))) / eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 7e-207) tmp = Float64(Float64(2.0 - Float64(eps_m * x)) / 2.0); elseif (x <= 465.0) tmp = Float64(Float64(Float64(Float64(x * 2.0) * Float64(eps_m + Float64(eps_m / x))) / eps_m) / 2.0); elseif (x <= 5e+192) tmp = 0.0; else tmp = Float64(Float64(Float64(Float64(1.0 - x) + Float64(-1.0 - Float64(x * Float64(-1.0 + Float64(x * Float64(0.5 + Float64(x * -0.16666666666666666))))))) / eps_m) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 7e-207) tmp = (2.0 - (eps_m * x)) / 2.0; elseif (x <= 465.0) tmp = (((x * 2.0) * (eps_m + (eps_m / x))) / eps_m) / 2.0; elseif (x <= 5e+192) tmp = 0.0; else tmp = (((1.0 - x) + (-1.0 - (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666))))))) / eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 7e-207], N[(N[(2.0 - N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 465.0], N[(N[(N[(N[(x * 2.0), $MachinePrecision] * N[(eps$95$m + N[(eps$95$m / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5e+192], 0.0, N[(N[(N[(N[(1.0 - x), $MachinePrecision] + N[(-1.0 - N[(x * N[(-1.0 + N[(x * N[(0.5 + N[(x * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7 \cdot 10^{-207}:\\
\;\;\;\;\frac{2 - eps\_m \cdot x}{2}\\
\mathbf{elif}\;x \leq 465:\\
\;\;\;\;\frac{\frac{\left(x \cdot 2\right) \cdot \left(eps\_m + \frac{eps\_m}{x}\right)}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+192}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left(1 - x\right) + \left(-1 - x \cdot \left(-1 + x \cdot \left(0.5 + x \cdot -0.16666666666666666\right)\right)\right)}{eps\_m}}{2}\\
\end{array}
\end{array}
if x < 7.0000000000000003e-207Initial program 64.9%
Simplified57.2%
Taylor expanded in x around 0 49.6%
Taylor expanded in eps around 0 63.5%
Taylor expanded in eps around inf 63.5%
associate-*r*63.5%
neg-mul-163.5%
Simplified63.5%
if 7.0000000000000003e-207 < x < 465Initial program 62.7%
Simplified45.8%
Taylor expanded in eps around 0 21.8%
associate-+r+59.0%
mul-1-neg59.0%
sub-neg59.0%
+-inverses59.0%
distribute-lft-out59.0%
distribute-rgt1-in58.9%
mul-1-neg58.9%
Simplified58.9%
Taylor expanded in x around 0 54.9%
Taylor expanded in x around inf 71.6%
distribute-lft-out71.6%
associate-*r*71.6%
Simplified71.6%
if 465 < x < 5.00000000000000033e192Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 54.9%
mul-1-neg54.9%
mul-1-neg54.9%
rec-exp54.9%
sub-neg54.9%
div-sub54.9%
mul-1-neg54.9%
rec-exp54.9%
+-inverses54.9%
Simplified54.9%
if 5.00000000000000033e192 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 38.4%
associate-+r+38.4%
mul-1-neg38.4%
associate-*r*38.4%
distribute-rgt-neg-in38.4%
remove-double-neg38.4%
sub-neg38.4%
mul-1-neg38.4%
associate-*r/38.4%
metadata-eval38.4%
sub-neg38.4%
distribute-neg-in38.4%
metadata-eval38.4%
remove-double-neg38.4%
Simplified38.4%
Taylor expanded in eps around 0 1.8%
neg-mul-11.8%
unsub-neg1.8%
neg-mul-11.8%
Simplified1.8%
Taylor expanded in x around 0 35.7%
Final simplification59.5%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 5.6e-205)
(/ (- 2.0 (* eps_m x)) 2.0)
(if (<= x 600.0)
(/ (/ (* (* x 2.0) (+ eps_m (/ eps_m x))) eps_m) 2.0)
(if (<= x 1.85e+193)
0.0
(* (+ x 1.0) (+ 1.0 (* x (+ -1.0 (* x 0.5)))))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 5.6e-205) {
tmp = (2.0 - (eps_m * x)) / 2.0;
} else if (x <= 600.0) {
tmp = (((x * 2.0) * (eps_m + (eps_m / x))) / eps_m) / 2.0;
} else if (x <= 1.85e+193) {
tmp = 0.0;
} else {
tmp = (x + 1.0) * (1.0 + (x * (-1.0 + (x * 0.5))));
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 5.6d-205) then
tmp = (2.0d0 - (eps_m * x)) / 2.0d0
else if (x <= 600.0d0) then
tmp = (((x * 2.0d0) * (eps_m + (eps_m / x))) / eps_m) / 2.0d0
else if (x <= 1.85d+193) then
tmp = 0.0d0
else
tmp = (x + 1.0d0) * (1.0d0 + (x * ((-1.0d0) + (x * 0.5d0))))
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 5.6e-205) {
tmp = (2.0 - (eps_m * x)) / 2.0;
} else if (x <= 600.0) {
tmp = (((x * 2.0) * (eps_m + (eps_m / x))) / eps_m) / 2.0;
} else if (x <= 1.85e+193) {
tmp = 0.0;
} else {
tmp = (x + 1.0) * (1.0 + (x * (-1.0 + (x * 0.5))));
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 5.6e-205: tmp = (2.0 - (eps_m * x)) / 2.0 elif x <= 600.0: tmp = (((x * 2.0) * (eps_m + (eps_m / x))) / eps_m) / 2.0 elif x <= 1.85e+193: tmp = 0.0 else: tmp = (x + 1.0) * (1.0 + (x * (-1.0 + (x * 0.5)))) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 5.6e-205) tmp = Float64(Float64(2.0 - Float64(eps_m * x)) / 2.0); elseif (x <= 600.0) tmp = Float64(Float64(Float64(Float64(x * 2.0) * Float64(eps_m + Float64(eps_m / x))) / eps_m) / 2.0); elseif (x <= 1.85e+193) tmp = 0.0; else tmp = Float64(Float64(x + 1.0) * Float64(1.0 + Float64(x * Float64(-1.0 + Float64(x * 0.5))))); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 5.6e-205) tmp = (2.0 - (eps_m * x)) / 2.0; elseif (x <= 600.0) tmp = (((x * 2.0) * (eps_m + (eps_m / x))) / eps_m) / 2.0; elseif (x <= 1.85e+193) tmp = 0.0; else tmp = (x + 1.0) * (1.0 + (x * (-1.0 + (x * 0.5)))); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 5.6e-205], N[(N[(2.0 - N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 600.0], N[(N[(N[(N[(x * 2.0), $MachinePrecision] * N[(eps$95$m + N[(eps$95$m / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.85e+193], 0.0, N[(N[(x + 1.0), $MachinePrecision] * N[(1.0 + N[(x * N[(-1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.6 \cdot 10^{-205}:\\
\;\;\;\;\frac{2 - eps\_m \cdot x}{2}\\
\mathbf{elif}\;x \leq 600:\\
\;\;\;\;\frac{\frac{\left(x \cdot 2\right) \cdot \left(eps\_m + \frac{eps\_m}{x}\right)}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{+193}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) \cdot \left(1 + x \cdot \left(-1 + x \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if x < 5.59999999999999983e-205Initial program 64.9%
Simplified57.2%
Taylor expanded in x around 0 49.6%
Taylor expanded in eps around 0 63.5%
Taylor expanded in eps around inf 63.5%
associate-*r*63.5%
neg-mul-163.5%
Simplified63.5%
if 5.59999999999999983e-205 < x < 600Initial program 62.7%
Simplified45.8%
Taylor expanded in eps around 0 21.8%
associate-+r+59.0%
mul-1-neg59.0%
sub-neg59.0%
+-inverses59.0%
distribute-lft-out59.0%
distribute-rgt1-in58.9%
mul-1-neg58.9%
Simplified58.9%
Taylor expanded in x around 0 54.9%
Taylor expanded in x around inf 71.6%
distribute-lft-out71.6%
associate-*r*71.6%
Simplified71.6%
if 600 < x < 1.8500000000000001e193Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 54.9%
mul-1-neg54.9%
mul-1-neg54.9%
rec-exp54.9%
sub-neg54.9%
div-sub54.9%
mul-1-neg54.9%
rec-exp54.9%
+-inverses54.9%
Simplified54.9%
if 1.8500000000000001e193 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 38.8%
associate-+r+38.8%
mul-1-neg38.8%
sub-neg38.8%
+-inverses38.8%
distribute-lft-out38.8%
distribute-rgt1-in38.8%
mul-1-neg38.8%
Simplified38.8%
Taylor expanded in eps around 0 38.8%
+-commutative38.8%
Simplified38.8%
Taylor expanded in x around 0 62.8%
Final simplification63.4%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 210.0) (/ (- 2.0 (* eps_m x)) 2.0) (if (<= x 1e+192) 0.0 (* (+ x 1.0) (+ 1.0 (* x (+ -1.0 (* x 0.5))))))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 210.0) {
tmp = (2.0 - (eps_m * x)) / 2.0;
} else if (x <= 1e+192) {
tmp = 0.0;
} else {
tmp = (x + 1.0) * (1.0 + (x * (-1.0 + (x * 0.5))));
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 210.0d0) then
tmp = (2.0d0 - (eps_m * x)) / 2.0d0
else if (x <= 1d+192) then
tmp = 0.0d0
else
tmp = (x + 1.0d0) * (1.0d0 + (x * ((-1.0d0) + (x * 0.5d0))))
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 210.0) {
tmp = (2.0 - (eps_m * x)) / 2.0;
} else if (x <= 1e+192) {
tmp = 0.0;
} else {
tmp = (x + 1.0) * (1.0 + (x * (-1.0 + (x * 0.5))));
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 210.0: tmp = (2.0 - (eps_m * x)) / 2.0 elif x <= 1e+192: tmp = 0.0 else: tmp = (x + 1.0) * (1.0 + (x * (-1.0 + (x * 0.5)))) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 210.0) tmp = Float64(Float64(2.0 - Float64(eps_m * x)) / 2.0); elseif (x <= 1e+192) tmp = 0.0; else tmp = Float64(Float64(x + 1.0) * Float64(1.0 + Float64(x * Float64(-1.0 + Float64(x * 0.5))))); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 210.0) tmp = (2.0 - (eps_m * x)) / 2.0; elseif (x <= 1e+192) tmp = 0.0; else tmp = (x + 1.0) * (1.0 + (x * (-1.0 + (x * 0.5)))); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 210.0], N[(N[(2.0 - N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1e+192], 0.0, N[(N[(x + 1.0), $MachinePrecision] * N[(1.0 + N[(x * N[(-1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 210:\\
\;\;\;\;\frac{2 - eps\_m \cdot x}{2}\\
\mathbf{elif}\;x \leq 10^{+192}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) \cdot \left(1 + x \cdot \left(-1 + x \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if x < 210Initial program 64.3%
Simplified53.7%
Taylor expanded in x around 0 51.5%
Taylor expanded in eps around 0 61.1%
Taylor expanded in eps around inf 61.1%
associate-*r*61.1%
neg-mul-161.1%
Simplified61.1%
if 210 < x < 1.00000000000000004e192Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 54.9%
mul-1-neg54.9%
mul-1-neg54.9%
rec-exp54.9%
sub-neg54.9%
div-sub54.9%
mul-1-neg54.9%
rec-exp54.9%
+-inverses54.9%
Simplified54.9%
if 1.00000000000000004e192 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 38.8%
associate-+r+38.8%
mul-1-neg38.8%
sub-neg38.8%
+-inverses38.8%
distribute-lft-out38.8%
distribute-rgt1-in38.8%
mul-1-neg38.8%
Simplified38.8%
Taylor expanded in eps around 0 38.8%
+-commutative38.8%
Simplified38.8%
Taylor expanded in x around 0 62.8%
Final simplification60.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 180.0) (/ (- 2.0 (* eps_m x)) 2.0) (if (<= x 1.7e+193) 0.0 (/ (* eps_m x) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 180.0) {
tmp = (2.0 - (eps_m * x)) / 2.0;
} else if (x <= 1.7e+193) {
tmp = 0.0;
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 180.0d0) then
tmp = (2.0d0 - (eps_m * x)) / 2.0d0
else if (x <= 1.7d+193) then
tmp = 0.0d0
else
tmp = (eps_m * x) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 180.0) {
tmp = (2.0 - (eps_m * x)) / 2.0;
} else if (x <= 1.7e+193) {
tmp = 0.0;
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 180.0: tmp = (2.0 - (eps_m * x)) / 2.0 elif x <= 1.7e+193: tmp = 0.0 else: tmp = (eps_m * x) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 180.0) tmp = Float64(Float64(2.0 - Float64(eps_m * x)) / 2.0); elseif (x <= 1.7e+193) tmp = 0.0; else tmp = Float64(Float64(eps_m * x) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 180.0) tmp = (2.0 - (eps_m * x)) / 2.0; elseif (x <= 1.7e+193) tmp = 0.0; else tmp = (eps_m * x) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 180.0], N[(N[(2.0 - N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.7e+193], 0.0, N[(N[(eps$95$m * x), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 180:\\
\;\;\;\;\frac{2 - eps\_m \cdot x}{2}\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{+193}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{eps\_m \cdot x}{2}\\
\end{array}
\end{array}
if x < 180Initial program 64.3%
Simplified53.7%
Taylor expanded in x around 0 51.5%
Taylor expanded in eps around 0 61.1%
Taylor expanded in eps around inf 61.1%
associate-*r*61.1%
neg-mul-161.1%
Simplified61.1%
if 180 < x < 1.69999999999999993e193Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 54.9%
mul-1-neg54.9%
mul-1-neg54.9%
rec-exp54.9%
sub-neg54.9%
div-sub54.9%
mul-1-neg54.9%
rec-exp54.9%
+-inverses54.9%
Simplified54.9%
if 1.69999999999999993e193 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 38.5%
Taylor expanded in eps around inf 36.2%
Final simplification56.3%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 2.0) (/ (- 2.0 x) 2.0) (if (<= x 5.5e+193) 0.0 (/ (* eps_m x) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 2.0) {
tmp = (2.0 - x) / 2.0;
} else if (x <= 5.5e+193) {
tmp = 0.0;
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 2.0d0) then
tmp = (2.0d0 - x) / 2.0d0
else if (x <= 5.5d+193) then
tmp = 0.0d0
else
tmp = (eps_m * x) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 2.0) {
tmp = (2.0 - x) / 2.0;
} else if (x <= 5.5e+193) {
tmp = 0.0;
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 2.0: tmp = (2.0 - x) / 2.0 elif x <= 5.5e+193: tmp = 0.0 else: tmp = (eps_m * x) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 2.0) tmp = Float64(Float64(2.0 - x) / 2.0); elseif (x <= 5.5e+193) tmp = 0.0; else tmp = Float64(Float64(eps_m * x) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 2.0) tmp = (2.0 - x) / 2.0; elseif (x <= 5.5e+193) tmp = 0.0; else tmp = (eps_m * x) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 2.0], N[(N[(2.0 - x), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5.5e+193], 0.0, N[(N[(eps$95$m * x), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2:\\
\;\;\;\;\frac{2 - x}{2}\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{+193}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{eps\_m \cdot x}{2}\\
\end{array}
\end{array}
if x < 2Initial program 64.3%
Simplified53.7%
Taylor expanded in x around 0 51.5%
Taylor expanded in eps around 0 61.1%
Taylor expanded in eps around 0 51.8%
neg-mul-151.8%
Simplified51.8%
if 2 < x < 5.5000000000000003e193Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 54.9%
mul-1-neg54.9%
mul-1-neg54.9%
rec-exp54.9%
sub-neg54.9%
div-sub54.9%
mul-1-neg54.9%
rec-exp54.9%
+-inverses54.9%
Simplified54.9%
if 5.5000000000000003e193 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 38.5%
Taylor expanded in eps around inf 36.2%
Final simplification50.1%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 620.0) 1.0 (if (<= x 1.18e+194) 0.0 (/ (* eps_m x) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 620.0) {
tmp = 1.0;
} else if (x <= 1.18e+194) {
tmp = 0.0;
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 620.0d0) then
tmp = 1.0d0
else if (x <= 1.18d+194) then
tmp = 0.0d0
else
tmp = (eps_m * x) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 620.0) {
tmp = 1.0;
} else if (x <= 1.18e+194) {
tmp = 0.0;
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 620.0: tmp = 1.0 elif x <= 1.18e+194: tmp = 0.0 else: tmp = (eps_m * x) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 620.0) tmp = 1.0; elseif (x <= 1.18e+194) tmp = 0.0; else tmp = Float64(Float64(eps_m * x) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 620.0) tmp = 1.0; elseif (x <= 1.18e+194) tmp = 0.0; else tmp = (eps_m * x) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 620.0], 1.0, If[LessEqual[x, 1.18e+194], 0.0, N[(N[(eps$95$m * x), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 620:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.18 \cdot 10^{+194}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{eps\_m \cdot x}{2}\\
\end{array}
\end{array}
if x < 620Initial program 64.3%
Simplified64.3%
Taylor expanded in x around 0 51.5%
if 620 < x < 1.1799999999999999e194Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 54.9%
mul-1-neg54.9%
mul-1-neg54.9%
rec-exp54.9%
sub-neg54.9%
div-sub54.9%
mul-1-neg54.9%
rec-exp54.9%
+-inverses54.9%
Simplified54.9%
if 1.1799999999999999e194 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 38.5%
Taylor expanded in eps around inf 36.2%
Final simplification49.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 580.0) 1.0 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 580.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 580.0d0) then
tmp = 1.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 580.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 580.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 580.0) tmp = 1.0; else tmp = 0.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 580.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 580.0], 1.0, 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 580:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 580Initial program 64.3%
Simplified64.3%
Taylor expanded in x around 0 51.5%
if 580 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 47.9%
mul-1-neg47.9%
mul-1-neg47.9%
rec-exp47.9%
sub-neg47.9%
div-sub47.9%
mul-1-neg47.9%
rec-exp47.9%
+-inverses47.9%
Simplified47.9%
Final simplification50.3%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 0.0)
eps_m = fabs(eps);
double code(double x, double eps_m) {
return 0.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = 0.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return 0.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return 0.0
eps_m = abs(eps) function code(x, eps_m) return 0.0 end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = 0.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := 0.0
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
0
\end{array}
Initial program 76.1%
Simplified66.8%
Taylor expanded in eps around 0 17.2%
mul-1-neg17.2%
mul-1-neg17.2%
rec-exp17.2%
sub-neg17.2%
div-sub17.2%
mul-1-neg17.2%
rec-exp17.2%
+-inverses17.5%
Simplified17.5%
Final simplification17.5%
herbie shell --seed 2024113
(FPCore (x eps)
:name "NMSE Section 6.1 mentioned, A"
:precision binary64
(/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))