
(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 14 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 (if (<= eps_m 2.2e-23) (/ (* (exp (- x)) (+ 2.0 (* x 2.0))) 2.0) (/ (+ (exp (* x (+ -1.0 eps_m))) (exp (* eps_m (- x)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 2.2e-23) {
tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0;
} else {
tmp = (exp((x * (-1.0 + eps_m))) + 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 <= 2.2d-23) then
tmp = (exp(-x) * (2.0d0 + (x * 2.0d0))) / 2.0d0
else
tmp = (exp((x * ((-1.0d0) + eps_m))) + 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 <= 2.2e-23) {
tmp = (Math.exp(-x) * (2.0 + (x * 2.0))) / 2.0;
} else {
tmp = (Math.exp((x * (-1.0 + eps_m))) + Math.exp((eps_m * -x))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 2.2e-23: tmp = (math.exp(-x) * (2.0 + (x * 2.0))) / 2.0 else: tmp = (math.exp((x * (-1.0 + eps_m))) + math.exp((eps_m * -x))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 2.2e-23) tmp = Float64(Float64(exp(Float64(-x)) * Float64(2.0 + Float64(x * 2.0))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(-1.0 + eps_m))) + exp(Float64(eps_m * Float64(-x)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 2.2e-23) tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0; else tmp = (exp((x * (-1.0 + eps_m))) + 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, 2.2e-23], N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 2.2 \cdot 10^{-23}:\\
\;\;\;\;\frac{e^{-x} \cdot \left(2 + x \cdot 2\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(-1 + eps\_m\right)} + e^{eps\_m \cdot \left(-x\right)}}{2}\\
\end{array}
\end{array}
if eps < 2.1999999999999999e-23Initial program 56.0%
Simplified48.3%
Taylor expanded in eps around 0 26.8%
Simplified70.9%
Taylor expanded in eps around 0 70.9%
if 2.1999999999999999e-23 < eps Initial program 97.6%
Simplified80.8%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
associate-*r*100.0%
mul-1-neg100.0%
Simplified100.0%
Final simplification80.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* x (- -1.0 eps_m))) (exp (* x (+ -1.0 eps_m)))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * (-1.0 - eps_m))) + exp((x * (-1.0 + eps_m)))) / 2.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = (exp((x * ((-1.0d0) - eps_m))) + exp((x * ((-1.0d0) + eps_m)))) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return (Math.exp((x * (-1.0 - eps_m))) + Math.exp((x * (-1.0 + eps_m)))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.exp((x * (-1.0 - eps_m))) + math.exp((x * (-1.0 + eps_m)))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(exp(Float64(x * Float64(-1.0 - eps_m))) + exp(Float64(x * Float64(-1.0 + eps_m)))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((x * (-1.0 - eps_m))) + exp((x * (-1.0 + eps_m)))) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\frac{e^{x \cdot \left(-1 - eps\_m\right)} + e^{x \cdot \left(-1 + eps\_m\right)}}{2}
\end{array}
Initial program 69.0%
Simplified58.5%
Taylor expanded in eps around inf 99.2%
Final simplification99.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1.6e-253)
(/ (+ 1.0 (exp (* eps_m (- x)))) 2.0)
(if (or (<= x 2.7e-13) (not (<= x 5.2e+36)))
(/ (+ 1.0 (exp (* x (+ -1.0 eps_m)))) 2.0)
(/ (* (exp (- x)) (+ 2.0 (* x 2.0))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.6e-253) {
tmp = (1.0 + exp((eps_m * -x))) / 2.0;
} else if ((x <= 2.7e-13) || !(x <= 5.2e+36)) {
tmp = (1.0 + exp((x * (-1.0 + eps_m)))) / 2.0;
} else {
tmp = (exp(-x) * (2.0 + (x * 2.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 <= (-1.6d-253)) then
tmp = (1.0d0 + exp((eps_m * -x))) / 2.0d0
else if ((x <= 2.7d-13) .or. (.not. (x <= 5.2d+36))) then
tmp = (1.0d0 + exp((x * ((-1.0d0) + eps_m)))) / 2.0d0
else
tmp = (exp(-x) * (2.0d0 + (x * 2.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 <= -1.6e-253) {
tmp = (1.0 + Math.exp((eps_m * -x))) / 2.0;
} else if ((x <= 2.7e-13) || !(x <= 5.2e+36)) {
tmp = (1.0 + Math.exp((x * (-1.0 + eps_m)))) / 2.0;
} else {
tmp = (Math.exp(-x) * (2.0 + (x * 2.0))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.6e-253: tmp = (1.0 + math.exp((eps_m * -x))) / 2.0 elif (x <= 2.7e-13) or not (x <= 5.2e+36): tmp = (1.0 + math.exp((x * (-1.0 + eps_m)))) / 2.0 else: tmp = (math.exp(-x) * (2.0 + (x * 2.0))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.6e-253) tmp = Float64(Float64(1.0 + exp(Float64(eps_m * Float64(-x)))) / 2.0); elseif ((x <= 2.7e-13) || !(x <= 5.2e+36)) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 + eps_m)))) / 2.0); else tmp = Float64(Float64(exp(Float64(-x)) * Float64(2.0 + Float64(x * 2.0))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.6e-253) tmp = (1.0 + exp((eps_m * -x))) / 2.0; elseif ((x <= 2.7e-13) || ~((x <= 5.2e+36))) tmp = (1.0 + exp((x * (-1.0 + eps_m)))) / 2.0; else tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.6e-253], N[(N[(1.0 + N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 2.7e-13], N[Not[LessEqual[x, 5.2e+36]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.6 \cdot 10^{-253}:\\
\;\;\;\;\frac{1 + e^{eps\_m \cdot \left(-x\right)}}{2}\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{-13} \lor \neg \left(x \leq 5.2 \cdot 10^{+36}\right):\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 + eps\_m\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{-x} \cdot \left(2 + x \cdot 2\right)}{2}\\
\end{array}
\end{array}
if x < -1.5999999999999999e-253Initial program 68.9%
Simplified68.9%
Taylor expanded in x around 0 44.3%
metadata-eval44.3%
distribute-neg-frac44.3%
metadata-eval44.3%
associate-*l/44.3%
*-commutative44.3%
distribute-lft-neg-in44.3%
cancel-sign-sub-inv44.3%
*-commutative44.3%
associate-*l/44.3%
metadata-eval44.3%
Simplified44.3%
Taylor expanded in eps around inf 74.3%
mul-1-neg74.3%
associate-*r*74.3%
*-lft-identity74.3%
metadata-eval74.3%
cancel-sign-sub-inv74.3%
associate-*r*74.3%
mul-1-neg74.3%
distribute-rgt-neg-in74.3%
sub-neg74.3%
mul-1-neg74.3%
remove-double-neg74.3%
+-commutative74.3%
Simplified74.3%
Taylor expanded in eps around inf 74.3%
associate-*r*74.3%
mul-1-neg74.3%
Simplified74.3%
if -1.5999999999999999e-253 < x < 2.70000000000000011e-13 or 5.2000000000000003e36 < x Initial program 68.2%
Simplified55.2%
Taylor expanded in eps around inf 99.9%
Taylor expanded in x around 0 65.7%
if 2.70000000000000011e-13 < x < 5.2000000000000003e36Initial program 80.6%
Simplified80.5%
Taylor expanded in eps around 0 60.9%
Simplified80.2%
Taylor expanded in eps around 0 80.2%
Final simplification69.9%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (* x (+ -1.0 eps_m)))))
(if (<= x -2e-253)
(/ (+ 1.0 (exp (* eps_m (- x)))) 2.0)
(if (<= x 2.7e-13)
(/ (+ t_0 (- 1.0 (* x eps_m))) 2.0)
(if (<= x 8e+37)
(/ (* (exp (- x)) (+ 2.0 (* x 2.0))) 2.0)
(/ (+ 1.0 t_0) 2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * (-1.0 + eps_m)));
double tmp;
if (x <= -2e-253) {
tmp = (1.0 + exp((eps_m * -x))) / 2.0;
} else if (x <= 2.7e-13) {
tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0;
} else if (x <= 8e+37) {
tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0;
} else {
tmp = (1.0 + t_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) :: t_0
real(8) :: tmp
t_0 = exp((x * ((-1.0d0) + eps_m)))
if (x <= (-2d-253)) then
tmp = (1.0d0 + exp((eps_m * -x))) / 2.0d0
else if (x <= 2.7d-13) then
tmp = (t_0 + (1.0d0 - (x * eps_m))) / 2.0d0
else if (x <= 8d+37) then
tmp = (exp(-x) * (2.0d0 + (x * 2.0d0))) / 2.0d0
else
tmp = (1.0d0 + t_0) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = Math.exp((x * (-1.0 + eps_m)));
double tmp;
if (x <= -2e-253) {
tmp = (1.0 + Math.exp((eps_m * -x))) / 2.0;
} else if (x <= 2.7e-13) {
tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0;
} else if (x <= 8e+37) {
tmp = (Math.exp(-x) * (2.0 + (x * 2.0))) / 2.0;
} else {
tmp = (1.0 + t_0) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * (-1.0 + eps_m))) tmp = 0 if x <= -2e-253: tmp = (1.0 + math.exp((eps_m * -x))) / 2.0 elif x <= 2.7e-13: tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0 elif x <= 8e+37: tmp = (math.exp(-x) * (2.0 + (x * 2.0))) / 2.0 else: tmp = (1.0 + t_0) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * Float64(-1.0 + eps_m))) tmp = 0.0 if (x <= -2e-253) tmp = Float64(Float64(1.0 + exp(Float64(eps_m * Float64(-x)))) / 2.0); elseif (x <= 2.7e-13) tmp = Float64(Float64(t_0 + Float64(1.0 - Float64(x * eps_m))) / 2.0); elseif (x <= 8e+37) tmp = Float64(Float64(exp(Float64(-x)) * Float64(2.0 + Float64(x * 2.0))) / 2.0); else tmp = Float64(Float64(1.0 + t_0) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp((x * (-1.0 + eps_m))); tmp = 0.0; if (x <= -2e-253) tmp = (1.0 + exp((eps_m * -x))) / 2.0; elseif (x <= 2.7e-13) tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0; elseif (x <= 8e+37) tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0; else tmp = (1.0 + t_0) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -2e-253], N[(N[(1.0 + N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.7e-13], N[(N[(t$95$0 + N[(1.0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 8e+37], N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(-1 + eps\_m\right)}\\
\mathbf{if}\;x \leq -2 \cdot 10^{-253}:\\
\;\;\;\;\frac{1 + e^{eps\_m \cdot \left(-x\right)}}{2}\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{-13}:\\
\;\;\;\;\frac{t\_0 + \left(1 - x \cdot eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 8 \cdot 10^{+37}:\\
\;\;\;\;\frac{e^{-x} \cdot \left(2 + x \cdot 2\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + t\_0}{2}\\
\end{array}
\end{array}
if x < -2.0000000000000001e-253Initial program 68.9%
Simplified68.9%
Taylor expanded in x around 0 44.3%
metadata-eval44.3%
distribute-neg-frac44.3%
metadata-eval44.3%
associate-*l/44.3%
*-commutative44.3%
distribute-lft-neg-in44.3%
cancel-sign-sub-inv44.3%
*-commutative44.3%
associate-*l/44.3%
metadata-eval44.3%
Simplified44.3%
Taylor expanded in eps around inf 74.3%
mul-1-neg74.3%
associate-*r*74.3%
*-lft-identity74.3%
metadata-eval74.3%
cancel-sign-sub-inv74.3%
associate-*r*74.3%
mul-1-neg74.3%
distribute-rgt-neg-in74.3%
sub-neg74.3%
mul-1-neg74.3%
remove-double-neg74.3%
+-commutative74.3%
Simplified74.3%
Taylor expanded in eps around inf 74.3%
associate-*r*74.3%
mul-1-neg74.3%
Simplified74.3%
if -2.0000000000000001e-253 < x < 2.70000000000000011e-13Initial program 45.6%
Simplified23.6%
Taylor expanded in eps around inf 99.9%
Taylor expanded in eps around inf 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around 0 88.1%
mul-1-neg88.1%
*-commutative88.1%
unsub-neg88.1%
*-commutative88.1%
Simplified88.1%
if 2.70000000000000011e-13 < x < 7.99999999999999963e37Initial program 80.6%
Simplified80.5%
Taylor expanded in eps around 0 60.9%
Simplified80.2%
Taylor expanded in eps around 0 80.2%
if 7.99999999999999963e37 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 34.9%
Final simplification70.0%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1.02e+103)
(/ (+ 2.0 (* x (+ -1.0 (* x (+ 0.5 (* x -0.16666666666666666)))))) 2.0)
(if (<= x -5e-253)
(/ (+ 2.0 (* x (- -1.0 eps_m))) 2.0)
(/ (+ 1.0 (exp x)) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.02e+103) {
tmp = (2.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) / 2.0;
} else if (x <= -5e-253) {
tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0;
} else {
tmp = (1.0 + exp(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 <= (-1.02d+103)) then
tmp = (2.0d0 + (x * ((-1.0d0) + (x * (0.5d0 + (x * (-0.16666666666666666d0))))))) / 2.0d0
else if (x <= (-5d-253)) then
tmp = (2.0d0 + (x * ((-1.0d0) - eps_m))) / 2.0d0
else
tmp = (1.0d0 + exp(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 <= -1.02e+103) {
tmp = (2.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) / 2.0;
} else if (x <= -5e-253) {
tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0;
} else {
tmp = (1.0 + Math.exp(x)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.02e+103: tmp = (2.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) / 2.0 elif x <= -5e-253: tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0 else: tmp = (1.0 + math.exp(x)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.02e+103) tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(x * Float64(0.5 + Float64(x * -0.16666666666666666)))))) / 2.0); elseif (x <= -5e-253) tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 - eps_m))) / 2.0); else tmp = Float64(Float64(1.0 + exp(x)) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.02e+103) tmp = (2.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) / 2.0; elseif (x <= -5e-253) tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0; else tmp = (1.0 + exp(x)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.02e+103], N[(N[(2.0 + N[(x * N[(-1.0 + N[(x * N[(0.5 + N[(x * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -5e-253], N[(N[(2.0 + N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.02 \cdot 10^{+103}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + x \cdot \left(0.5 + x \cdot -0.16666666666666666\right)\right)}{2}\\
\mathbf{elif}\;x \leq -5 \cdot 10^{-253}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 - eps\_m\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x}}{2}\\
\end{array}
\end{array}
if x < -1.01999999999999991e103Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in eps around 0 100.0%
neg-mul-1100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
if -1.01999999999999991e103 < x < -4.99999999999999971e-253Initial program 58.3%
Simplified58.3%
Taylor expanded in x around 0 41.2%
metadata-eval41.2%
distribute-neg-frac41.2%
metadata-eval41.2%
associate-*l/41.2%
*-commutative41.2%
distribute-lft-neg-in41.2%
cancel-sign-sub-inv41.2%
*-commutative41.2%
associate-*l/41.2%
metadata-eval41.2%
Simplified41.2%
Taylor expanded in eps around inf 81.5%
mul-1-neg81.5%
associate-*r*81.5%
*-lft-identity81.5%
metadata-eval81.5%
cancel-sign-sub-inv81.5%
associate-*r*81.5%
mul-1-neg81.5%
distribute-rgt-neg-in81.5%
sub-neg81.5%
mul-1-neg81.5%
remove-double-neg81.5%
+-commutative81.5%
Simplified81.5%
Taylor expanded in x around 0 60.5%
associate-*r*60.5%
neg-mul-160.5%
Simplified60.5%
if -4.99999999999999971e-253 < x Initial program 69.0%
Simplified56.9%
Taylor expanded in eps around inf 99.3%
Taylor expanded in eps around inf 87.1%
*-commutative87.1%
Simplified87.1%
Taylor expanded in eps around 0 47.6%
neg-mul-147.6%
Simplified47.6%
*-un-lft-identity47.6%
add-sqr-sqrt6.0%
sqrt-unprod69.9%
sqr-neg69.9%
sqrt-unprod63.9%
add-sqr-sqrt69.9%
Applied egg-rr69.9%
*-lft-identity69.9%
Simplified69.9%
Final simplification70.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.55e-253) (/ (+ 1.0 (exp (- x))) 2.0) (/ (+ 1.0 (exp (* x (+ -1.0 eps_m)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.55e-253) {
tmp = (1.0 + exp(-x)) / 2.0;
} else {
tmp = (1.0 + exp((x * (-1.0 + 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 <= (-1.55d-253)) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else
tmp = (1.0d0 + exp((x * ((-1.0d0) + 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 <= -1.55e-253) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else {
tmp = (1.0 + Math.exp((x * (-1.0 + eps_m)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.55e-253: tmp = (1.0 + math.exp(-x)) / 2.0 else: tmp = (1.0 + math.exp((x * (-1.0 + eps_m)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.55e-253) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); else tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 + eps_m)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.55e-253) tmp = (1.0 + exp(-x)) / 2.0; else tmp = (1.0 + exp((x * (-1.0 + eps_m)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.55e-253], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{-253}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 + eps\_m\right)}}{2}\\
\end{array}
\end{array}
if x < -1.54999999999999998e-253Initial program 68.9%
Simplified60.6%
Taylor expanded in eps around inf 99.1%
Taylor expanded in eps around inf 99.1%
*-commutative99.1%
Simplified99.1%
Taylor expanded in eps around 0 78.0%
neg-mul-178.0%
Simplified78.0%
if -1.54999999999999998e-253 < x Initial program 69.0%
Simplified56.9%
Taylor expanded in eps around inf 99.3%
Taylor expanded in x around 0 62.9%
Final simplification69.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -2e-253) (/ (+ 1.0 (exp (* eps_m (- x)))) 2.0) (/ (+ 1.0 (exp (* x (+ -1.0 eps_m)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -2e-253) {
tmp = (1.0 + exp((eps_m * -x))) / 2.0;
} else {
tmp = (1.0 + exp((x * (-1.0 + 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 <= (-2d-253)) then
tmp = (1.0d0 + exp((eps_m * -x))) / 2.0d0
else
tmp = (1.0d0 + exp((x * ((-1.0d0) + 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 <= -2e-253) {
tmp = (1.0 + Math.exp((eps_m * -x))) / 2.0;
} else {
tmp = (1.0 + Math.exp((x * (-1.0 + eps_m)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -2e-253: tmp = (1.0 + math.exp((eps_m * -x))) / 2.0 else: tmp = (1.0 + math.exp((x * (-1.0 + eps_m)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -2e-253) tmp = Float64(Float64(1.0 + exp(Float64(eps_m * Float64(-x)))) / 2.0); else tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 + eps_m)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -2e-253) tmp = (1.0 + exp((eps_m * -x))) / 2.0; else tmp = (1.0 + exp((x * (-1.0 + eps_m)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -2e-253], N[(N[(1.0 + N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-253}:\\
\;\;\;\;\frac{1 + e^{eps\_m \cdot \left(-x\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 + eps\_m\right)}}{2}\\
\end{array}
\end{array}
if x < -2.0000000000000001e-253Initial program 68.9%
Simplified68.9%
Taylor expanded in x around 0 44.3%
metadata-eval44.3%
distribute-neg-frac44.3%
metadata-eval44.3%
associate-*l/44.3%
*-commutative44.3%
distribute-lft-neg-in44.3%
cancel-sign-sub-inv44.3%
*-commutative44.3%
associate-*l/44.3%
metadata-eval44.3%
Simplified44.3%
Taylor expanded in eps around inf 74.3%
mul-1-neg74.3%
associate-*r*74.3%
*-lft-identity74.3%
metadata-eval74.3%
cancel-sign-sub-inv74.3%
associate-*r*74.3%
mul-1-neg74.3%
distribute-rgt-neg-in74.3%
sub-neg74.3%
mul-1-neg74.3%
remove-double-neg74.3%
+-commutative74.3%
Simplified74.3%
Taylor expanded in eps around inf 74.3%
associate-*r*74.3%
mul-1-neg74.3%
Simplified74.3%
if -2.0000000000000001e-253 < x Initial program 69.0%
Simplified56.9%
Taylor expanded in eps around inf 99.3%
Taylor expanded in x around 0 62.9%
Final simplification67.6%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -600.0) (/ (+ 1.0 (exp (- x))) 2.0) (/ (+ 1.0 (exp x)) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -600.0) {
tmp = (1.0 + exp(-x)) / 2.0;
} else {
tmp = (1.0 + exp(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 <= (-600.0d0)) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else
tmp = (1.0d0 + exp(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 <= -600.0) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else {
tmp = (1.0 + Math.exp(x)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -600.0: tmp = (1.0 + math.exp(-x)) / 2.0 else: tmp = (1.0 + math.exp(x)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -600.0) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); else tmp = Float64(Float64(1.0 + exp(x)) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -600.0) tmp = (1.0 + exp(-x)) / 2.0; else tmp = (1.0 + exp(x)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -600.0], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -600:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x}}{2}\\
\end{array}
\end{array}
if x < -600Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in eps around 0 100.0%
neg-mul-1100.0%
Simplified100.0%
if -600 < x Initial program 63.5%
Simplified51.2%
Taylor expanded in eps around inf 99.1%
Taylor expanded in eps around inf 90.6%
*-commutative90.6%
Simplified90.6%
Taylor expanded in eps around 0 53.3%
neg-mul-153.3%
Simplified53.3%
*-un-lft-identity53.3%
add-sqr-sqrt24.6%
sqrt-unprod68.6%
sqr-neg68.6%
sqrt-unprod44.0%
add-sqr-sqrt68.6%
Applied egg-rr68.6%
*-lft-identity68.6%
Simplified68.6%
Final simplification73.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1.02e+103)
(/ (+ 2.0 (* x (+ -1.0 (* x (+ 0.5 (* x -0.16666666666666666)))))) 2.0)
(if (<= x 2.0)
(/ (+ 2.0 (* x (- -1.0 eps_m))) 2.0)
(if (<= x 9e+194) 0.0 (/ (+ 2.0 (* x (+ -1.0 (* x 0.5)))) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.02e+103) {
tmp = (2.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) / 2.0;
} else if (x <= 2.0) {
tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0;
} else if (x <= 9e+194) {
tmp = 0.0;
} else {
tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 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 <= (-1.02d+103)) then
tmp = (2.0d0 + (x * ((-1.0d0) + (x * (0.5d0 + (x * (-0.16666666666666666d0))))))) / 2.0d0
else if (x <= 2.0d0) then
tmp = (2.0d0 + (x * ((-1.0d0) - eps_m))) / 2.0d0
else if (x <= 9d+194) then
tmp = 0.0d0
else
tmp = (2.0d0 + (x * ((-1.0d0) + (x * 0.5d0)))) / 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 <= -1.02e+103) {
tmp = (2.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) / 2.0;
} else if (x <= 2.0) {
tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0;
} else if (x <= 9e+194) {
tmp = 0.0;
} else {
tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.02e+103: tmp = (2.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) / 2.0 elif x <= 2.0: tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0 elif x <= 9e+194: tmp = 0.0 else: tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.02e+103) tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(x * Float64(0.5 + Float64(x * -0.16666666666666666)))))) / 2.0); elseif (x <= 2.0) tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 - eps_m))) / 2.0); elseif (x <= 9e+194) tmp = 0.0; else tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(x * 0.5)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.02e+103) tmp = (2.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) / 2.0; elseif (x <= 2.0) tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0; elseif (x <= 9e+194) tmp = 0.0; else tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.02e+103], N[(N[(2.0 + N[(x * N[(-1.0 + N[(x * N[(0.5 + N[(x * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.0], N[(N[(2.0 + N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 9e+194], 0.0, N[(N[(2.0 + N[(x * N[(-1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.02 \cdot 10^{+103}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + x \cdot \left(0.5 + x \cdot -0.16666666666666666\right)\right)}{2}\\
\mathbf{elif}\;x \leq 2:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 - eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 9 \cdot 10^{+194}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + x \cdot 0.5\right)}{2}\\
\end{array}
\end{array}
if x < -1.01999999999999991e103Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in eps around 0 100.0%
neg-mul-1100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
if -1.01999999999999991e103 < x < 2Initial program 51.2%
Simplified51.2%
Taylor expanded in x around 0 40.2%
metadata-eval40.2%
distribute-neg-frac40.2%
metadata-eval40.2%
associate-*l/40.2%
*-commutative40.2%
distribute-lft-neg-in40.2%
cancel-sign-sub-inv40.2%
*-commutative40.2%
associate-*l/40.2%
metadata-eval40.2%
Simplified40.2%
Taylor expanded in eps around inf 87.8%
mul-1-neg87.8%
associate-*r*87.8%
*-lft-identity87.8%
metadata-eval87.8%
cancel-sign-sub-inv87.8%
associate-*r*87.8%
mul-1-neg87.8%
distribute-rgt-neg-in87.8%
sub-neg87.8%
mul-1-neg87.8%
remove-double-neg87.8%
+-commutative87.8%
Simplified87.8%
Taylor expanded in x around 0 71.7%
associate-*r*71.7%
neg-mul-171.7%
Simplified71.7%
if 2 < x < 8.9999999999999997e194Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 53.1%
mul-1-neg53.1%
mul-1-neg53.1%
rec-exp53.1%
sub-neg53.1%
div-sub53.1%
mul-1-neg53.1%
rec-exp53.1%
+-inverses53.1%
Simplified53.1%
if 8.9999999999999997e194 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 83.7%
*-commutative83.7%
Simplified83.7%
Taylor expanded in eps around 0 3.1%
neg-mul-13.1%
Simplified3.1%
Taylor expanded in x around 0 63.1%
Final simplification70.8%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 2.0) (/ (+ 2.0 (* x (- -1.0 eps_m))) 2.0) (if (<= x 1e+192) 0.0 (/ (+ 2.0 (* x (+ -1.0 (* x 0.5)))) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 2.0) {
tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0;
} else if (x <= 1e+192) {
tmp = 0.0;
} else {
tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 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 * ((-1.0d0) - eps_m))) / 2.0d0
else if (x <= 1d+192) then
tmp = 0.0d0
else
tmp = (2.0d0 + (x * ((-1.0d0) + (x * 0.5d0)))) / 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 * (-1.0 - eps_m))) / 2.0;
} else if (x <= 1e+192) {
tmp = 0.0;
} else {
tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 2.0: tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0 elif x <= 1e+192: tmp = 0.0 else: tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 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 + Float64(x * Float64(-1.0 - eps_m))) / 2.0); elseif (x <= 1e+192) tmp = 0.0; else tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(x * 0.5)))) / 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 * (-1.0 - eps_m))) / 2.0; elseif (x <= 1e+192) tmp = 0.0; else tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 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 + N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1e+192], 0.0, N[(N[(2.0 + N[(x * N[(-1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 - eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 10^{+192}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + x \cdot 0.5\right)}{2}\\
\end{array}
\end{array}
if x < 2Initial program 58.2%
Simplified58.2%
Taylor expanded in x around 0 42.1%
metadata-eval42.1%
distribute-neg-frac42.1%
metadata-eval42.1%
associate-*l/42.1%
*-commutative42.1%
distribute-lft-neg-in42.1%
cancel-sign-sub-inv42.1%
*-commutative42.1%
associate-*l/42.1%
metadata-eval42.1%
Simplified42.1%
Taylor expanded in eps around inf 82.9%
mul-1-neg82.9%
associate-*r*82.9%
*-lft-identity82.9%
metadata-eval82.9%
cancel-sign-sub-inv82.9%
associate-*r*82.9%
mul-1-neg82.9%
distribute-rgt-neg-in82.9%
sub-neg82.9%
mul-1-neg82.9%
remove-double-neg82.9%
+-commutative82.9%
Simplified82.9%
Taylor expanded in x around 0 67.4%
associate-*r*67.4%
neg-mul-167.4%
Simplified67.4%
if 2 < x < 1.00000000000000004e192Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 53.1%
mul-1-neg53.1%
mul-1-neg53.1%
rec-exp53.1%
sub-neg53.1%
div-sub53.1%
mul-1-neg53.1%
rec-exp53.1%
+-inverses53.1%
Simplified53.1%
if 1.00000000000000004e192 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 83.7%
*-commutative83.7%
Simplified83.7%
Taylor expanded in eps around 0 3.1%
neg-mul-13.1%
Simplified3.1%
Taylor expanded in x around 0 63.1%
Final simplification64.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 2.0) (/ (+ 2.0 (* x (- -1.0 eps_m))) 2.0) 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 2.0) {
tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.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 <= 2.0d0) then
tmp = (2.0d0 + (x * ((-1.0d0) - eps_m))) / 2.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 <= 2.0) {
tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 2.0: tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 2.0) tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 - eps_m))) / 2.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 <= 2.0) tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0; else tmp = 0.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 + N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 - eps\_m\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2Initial program 58.2%
Simplified58.2%
Taylor expanded in x around 0 42.1%
metadata-eval42.1%
distribute-neg-frac42.1%
metadata-eval42.1%
associate-*l/42.1%
*-commutative42.1%
distribute-lft-neg-in42.1%
cancel-sign-sub-inv42.1%
*-commutative42.1%
associate-*l/42.1%
metadata-eval42.1%
Simplified42.1%
Taylor expanded in eps around inf 82.9%
mul-1-neg82.9%
associate-*r*82.9%
*-lft-identity82.9%
metadata-eval82.9%
cancel-sign-sub-inv82.9%
associate-*r*82.9%
mul-1-neg82.9%
distribute-rgt-neg-in82.9%
sub-neg82.9%
mul-1-neg82.9%
remove-double-neg82.9%
+-commutative82.9%
Simplified82.9%
Taylor expanded in x around 0 67.4%
associate-*r*67.4%
neg-mul-167.4%
Simplified67.4%
if 2 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 47.8%
mul-1-neg47.8%
mul-1-neg47.8%
rec-exp47.8%
sub-neg47.8%
div-sub47.8%
mul-1-neg47.8%
rec-exp47.8%
+-inverses47.8%
Simplified47.8%
Final simplification62.4%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 2.0) (/ (- 2.0 x) 2.0) 0.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 {
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 <= 2.0d0) then
tmp = (2.0d0 - x) / 2.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 <= 2.0) {
tmp = (2.0 - x) / 2.0;
} else {
tmp = 0.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 else: tmp = 0.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); else tmp = 0.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; else tmp = 0.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], 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2:\\
\;\;\;\;\frac{2 - x}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2Initial program 58.2%
Simplified44.0%
Taylor expanded in eps around inf 99.0%
Taylor expanded in eps around inf 99.0%
*-commutative99.0%
Simplified99.0%
Taylor expanded in x around inf 99.0%
associate-*r*99.0%
mul-1-neg99.0%
Simplified99.0%
Taylor expanded in x around 0 61.2%
distribute-rgt1-in61.2%
metadata-eval61.2%
mul0-lft61.2%
metadata-eval61.2%
*-commutative61.2%
mul-1-neg61.2%
unsub-neg61.2%
Simplified61.2%
if 2 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 47.8%
mul-1-neg47.8%
mul-1-neg47.8%
rec-exp47.8%
sub-neg47.8%
div-sub47.8%
mul-1-neg47.8%
rec-exp47.8%
+-inverses47.8%
Simplified47.8%
Final simplification57.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 460.0) 1.0 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 460.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 <= 460.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 <= 460.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 460.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 460.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 <= 460.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, 460.0], 1.0, 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 460:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 460Initial program 58.2%
Simplified58.2%
Taylor expanded in x around 0 60.8%
if 460 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 47.8%
mul-1-neg47.8%
mul-1-neg47.8%
rec-exp47.8%
sub-neg47.8%
div-sub47.8%
mul-1-neg47.8%
rec-exp47.8%
+-inverses47.8%
Simplified47.8%
Final simplification57.5%
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 69.0%
Simplified58.5%
Taylor expanded in eps around 0 14.0%
mul-1-neg14.0%
mul-1-neg14.0%
rec-exp14.0%
sub-neg14.0%
div-sub14.0%
mul-1-neg14.0%
rec-exp14.0%
+-inverses14.2%
Simplified14.2%
Final simplification14.2%
herbie shell --seed 2024075
(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))