
(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 13 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.1e-5) (/ (/ (* eps_m (* (exp (- x)) (+ 2.0 (* x 2.0)))) eps_m) 2.0) (/ (+ (exp (* x eps_m)) (exp (* x (- eps_m)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 2.1e-5) {
tmp = ((eps_m * (exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 2.0;
} else {
tmp = (exp((x * eps_m)) + exp((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 <= 2.1d-5) then
tmp = ((eps_m * (exp(-x) * (2.0d0 + (x * 2.0d0)))) / eps_m) / 2.0d0
else
tmp = (exp((x * eps_m)) + exp((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 <= 2.1e-5) {
tmp = ((eps_m * (Math.exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 2.0;
} else {
tmp = (Math.exp((x * eps_m)) + Math.exp((x * -eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 2.1e-5: tmp = ((eps_m * (math.exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 2.0 else: tmp = (math.exp((x * eps_m)) + math.exp((x * -eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 2.1e-5) tmp = Float64(Float64(Float64(eps_m * Float64(exp(Float64(-x)) * Float64(2.0 + Float64(x * 2.0)))) / eps_m) / 2.0); else tmp = Float64(Float64(exp(Float64(x * eps_m)) + exp(Float64(x * Float64(-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 <= 2.1e-5) tmp = ((eps_m * (exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 2.0; else tmp = (exp((x * eps_m)) + exp((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, 2.1e-5], N[(N[(N[(eps$95$m * N[(N[Exp[(-x)], $MachinePrecision] * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * (-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 2.1 \cdot 10^{-5}:\\
\;\;\;\;\frac{\frac{eps\_m \cdot \left(e^{-x} \cdot \left(2 + x \cdot 2\right)\right)}{eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot eps\_m} + e^{x \cdot \left(-eps\_m\right)}}{2}\\
\end{array}
\end{array}
if eps < 2.09999999999999988e-5Initial program 64.7%
Simplified53.9%
Taylor expanded in eps around 0 33.1%
Simplified69.2%
if 2.09999999999999988e-5 < eps Initial program 100.0%
Simplified95.3%
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%
*-commutative100.0%
fma-neg100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-rgt-identity100.0%
exp-neg100.0%
*-rgt-identity100.0%
remove-double-neg100.0%
mul-1-neg100.0%
fma-neg100.0%
*-commutative100.0%
distribute-rgt-out--100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification76.5%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* x (+ eps_m -1.0))) (/ 1.0 (exp (+ x (* x eps_m))))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * (eps_m + -1.0))) + (1.0 / exp((x + (x * 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 * (eps_m + (-1.0d0)))) + (1.0d0 / exp((x + (x * eps_m))))) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return (Math.exp((x * (eps_m + -1.0))) + (1.0 / Math.exp((x + (x * eps_m))))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.exp((x * (eps_m + -1.0))) + (1.0 / math.exp((x + (x * eps_m))))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + Float64(1.0 / exp(Float64(x + Float64(x * eps_m))))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((x * (eps_m + -1.0))) + (1.0 / exp((x + (x * eps_m))))) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[Exp[N[(x + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\frac{e^{x \cdot \left(eps\_m + -1\right)} + \frac{1}{e^{x + x \cdot eps\_m}}}{2}
\end{array}
Initial program 73.0%
Simplified66.8%
Taylor expanded in eps around inf 99.0%
Final simplification99.0%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (* x (+ eps_m -1.0))) (t_1 (exp (- x))))
(if (<= x -510.0)
(/ (+ 1.0 t_1) 2.0)
(if (<= x -5e-267)
(/ (+ (/ 1.0 (exp (+ x (* x eps_m)))) (+ 1.0 t_0)) 2.0)
(if (<= x 3950000.0)
(/ (+ (exp (* x eps_m)) (- 1.0 (* x (+ eps_m 1.0)))) 2.0)
(if (<= x 2.4e+147)
(/ (/ (* eps_m (* t_1 (+ 2.0 (* x 2.0)))) eps_m) 2.0)
(/ (+ 1.0 (exp t_0)) 2.0)))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = x * (eps_m + -1.0);
double t_1 = exp(-x);
double tmp;
if (x <= -510.0) {
tmp = (1.0 + t_1) / 2.0;
} else if (x <= -5e-267) {
tmp = ((1.0 / exp((x + (x * eps_m)))) + (1.0 + t_0)) / 2.0;
} else if (x <= 3950000.0) {
tmp = (exp((x * eps_m)) + (1.0 - (x * (eps_m + 1.0)))) / 2.0;
} else if (x <= 2.4e+147) {
tmp = ((eps_m * (t_1 * (2.0 + (x * 2.0)))) / eps_m) / 2.0;
} else {
tmp = (1.0 + exp(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) :: t_1
real(8) :: tmp
t_0 = x * (eps_m + (-1.0d0))
t_1 = exp(-x)
if (x <= (-510.0d0)) then
tmp = (1.0d0 + t_1) / 2.0d0
else if (x <= (-5d-267)) then
tmp = ((1.0d0 / exp((x + (x * eps_m)))) + (1.0d0 + t_0)) / 2.0d0
else if (x <= 3950000.0d0) then
tmp = (exp((x * eps_m)) + (1.0d0 - (x * (eps_m + 1.0d0)))) / 2.0d0
else if (x <= 2.4d+147) then
tmp = ((eps_m * (t_1 * (2.0d0 + (x * 2.0d0)))) / eps_m) / 2.0d0
else
tmp = (1.0d0 + exp(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 = x * (eps_m + -1.0);
double t_1 = Math.exp(-x);
double tmp;
if (x <= -510.0) {
tmp = (1.0 + t_1) / 2.0;
} else if (x <= -5e-267) {
tmp = ((1.0 / Math.exp((x + (x * eps_m)))) + (1.0 + t_0)) / 2.0;
} else if (x <= 3950000.0) {
tmp = (Math.exp((x * eps_m)) + (1.0 - (x * (eps_m + 1.0)))) / 2.0;
} else if (x <= 2.4e+147) {
tmp = ((eps_m * (t_1 * (2.0 + (x * 2.0)))) / eps_m) / 2.0;
} else {
tmp = (1.0 + Math.exp(t_0)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = x * (eps_m + -1.0) t_1 = math.exp(-x) tmp = 0 if x <= -510.0: tmp = (1.0 + t_1) / 2.0 elif x <= -5e-267: tmp = ((1.0 / math.exp((x + (x * eps_m)))) + (1.0 + t_0)) / 2.0 elif x <= 3950000.0: tmp = (math.exp((x * eps_m)) + (1.0 - (x * (eps_m + 1.0)))) / 2.0 elif x <= 2.4e+147: tmp = ((eps_m * (t_1 * (2.0 + (x * 2.0)))) / eps_m) / 2.0 else: tmp = (1.0 + math.exp(t_0)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(x * Float64(eps_m + -1.0)) t_1 = exp(Float64(-x)) tmp = 0.0 if (x <= -510.0) tmp = Float64(Float64(1.0 + t_1) / 2.0); elseif (x <= -5e-267) tmp = Float64(Float64(Float64(1.0 / exp(Float64(x + Float64(x * eps_m)))) + Float64(1.0 + t_0)) / 2.0); elseif (x <= 3950000.0) tmp = Float64(Float64(exp(Float64(x * eps_m)) + Float64(1.0 - Float64(x * Float64(eps_m + 1.0)))) / 2.0); elseif (x <= 2.4e+147) tmp = Float64(Float64(Float64(eps_m * Float64(t_1 * Float64(2.0 + Float64(x * 2.0)))) / eps_m) / 2.0); else tmp = Float64(Float64(1.0 + exp(t_0)) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = x * (eps_m + -1.0); t_1 = exp(-x); tmp = 0.0; if (x <= -510.0) tmp = (1.0 + t_1) / 2.0; elseif (x <= -5e-267) tmp = ((1.0 / exp((x + (x * eps_m)))) + (1.0 + t_0)) / 2.0; elseif (x <= 3950000.0) tmp = (exp((x * eps_m)) + (1.0 - (x * (eps_m + 1.0)))) / 2.0; elseif (x <= 2.4e+147) tmp = ((eps_m * (t_1 * (2.0 + (x * 2.0)))) / eps_m) / 2.0; else tmp = (1.0 + exp(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[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Exp[(-x)], $MachinePrecision]}, If[LessEqual[x, -510.0], N[(N[(1.0 + t$95$1), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -5e-267], N[(N[(N[(1.0 / N[Exp[N[(x + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 3950000.0], N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] + N[(1.0 - N[(x * N[(eps$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.4e+147], N[(N[(N[(eps$95$m * N[(t$95$1 * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[t$95$0], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := x \cdot \left(eps\_m + -1\right)\\
t_1 := e^{-x}\\
\mathbf{if}\;x \leq -510:\\
\;\;\;\;\frac{1 + t\_1}{2}\\
\mathbf{elif}\;x \leq -5 \cdot 10^{-267}:\\
\;\;\;\;\frac{\frac{1}{e^{x + x \cdot eps\_m}} + \left(1 + t\_0\right)}{2}\\
\mathbf{elif}\;x \leq 3950000:\\
\;\;\;\;\frac{e^{x \cdot eps\_m} + \left(1 - x \cdot \left(eps\_m + 1\right)\right)}{2}\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{+147}:\\
\;\;\;\;\frac{\frac{eps\_m \cdot \left(t\_1 \cdot \left(2 + x \cdot 2\right)\right)}{eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{t\_0}}{2}\\
\end{array}
\end{array}
if x < -510Initial program 97.2%
Simplified97.2%
Taylor expanded in eps around inf 97.2%
Taylor expanded in x around 0 51.5%
Taylor expanded in eps around 0 97.2%
mul-1-neg97.2%
Simplified97.2%
if -510 < x < -4.9999999999999999e-267Initial program 56.4%
Simplified34.3%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 78.4%
if -4.9999999999999999e-267 < x < 3.95e6Initial program 54.9%
Simplified52.1%
Taylor expanded in eps around inf 98.2%
Taylor expanded in eps around inf 98.2%
*-commutative98.2%
Simplified98.2%
Taylor expanded in x around 0 85.7%
mul-1-neg85.7%
Simplified85.7%
if 3.95e6 < x < 2.40000000000000002e147Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 67.2%
Simplified67.2%
if 2.40000000000000002e147 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 25.9%
Final simplification75.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (- x))))
(if (<= x -520.0)
(/ (+ 1.0 t_0) 2.0)
(if (<= x 310000000.0)
(/ (+ (exp (* x eps_m)) (- 1.0 (* x (+ eps_m 1.0)))) 2.0)
(if (<= x 1.55e+147)
(/ (/ (* eps_m (* t_0 (+ 2.0 (* x 2.0)))) eps_m) 2.0)
(/ (+ 1.0 (exp (* x (+ eps_m -1.0)))) 2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp(-x);
double tmp;
if (x <= -520.0) {
tmp = (1.0 + t_0) / 2.0;
} else if (x <= 310000000.0) {
tmp = (exp((x * eps_m)) + (1.0 - (x * (eps_m + 1.0)))) / 2.0;
} else if (x <= 1.55e+147) {
tmp = ((eps_m * (t_0 * (2.0 + (x * 2.0)))) / eps_m) / 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) :: t_0
real(8) :: tmp
t_0 = exp(-x)
if (x <= (-520.0d0)) then
tmp = (1.0d0 + t_0) / 2.0d0
else if (x <= 310000000.0d0) then
tmp = (exp((x * eps_m)) + (1.0d0 - (x * (eps_m + 1.0d0)))) / 2.0d0
else if (x <= 1.55d+147) then
tmp = ((eps_m * (t_0 * (2.0d0 + (x * 2.0d0)))) / eps_m) / 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 t_0 = Math.exp(-x);
double tmp;
if (x <= -520.0) {
tmp = (1.0 + t_0) / 2.0;
} else if (x <= 310000000.0) {
tmp = (Math.exp((x * eps_m)) + (1.0 - (x * (eps_m + 1.0)))) / 2.0;
} else if (x <= 1.55e+147) {
tmp = ((eps_m * (t_0 * (2.0 + (x * 2.0)))) / eps_m) / 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): t_0 = math.exp(-x) tmp = 0 if x <= -520.0: tmp = (1.0 + t_0) / 2.0 elif x <= 310000000.0: tmp = (math.exp((x * eps_m)) + (1.0 - (x * (eps_m + 1.0)))) / 2.0 elif x <= 1.55e+147: tmp = ((eps_m * (t_0 * (2.0 + (x * 2.0)))) / eps_m) / 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) t_0 = exp(Float64(-x)) tmp = 0.0 if (x <= -520.0) tmp = Float64(Float64(1.0 + t_0) / 2.0); elseif (x <= 310000000.0) tmp = Float64(Float64(exp(Float64(x * eps_m)) + Float64(1.0 - Float64(x * Float64(eps_m + 1.0)))) / 2.0); elseif (x <= 1.55e+147) tmp = Float64(Float64(Float64(eps_m * Float64(t_0 * Float64(2.0 + Float64(x * 2.0)))) / eps_m) / 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) t_0 = exp(-x); tmp = 0.0; if (x <= -520.0) tmp = (1.0 + t_0) / 2.0; elseif (x <= 310000000.0) tmp = (exp((x * eps_m)) + (1.0 - (x * (eps_m + 1.0)))) / 2.0; elseif (x <= 1.55e+147) tmp = ((eps_m * (t_0 * (2.0 + (x * 2.0)))) / eps_m) / 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_] := Block[{t$95$0 = N[Exp[(-x)], $MachinePrecision]}, If[LessEqual[x, -520.0], N[(N[(1.0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 310000000.0], N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] + N[(1.0 - N[(x * N[(eps$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.55e+147], N[(N[(N[(eps$95$m * N[(t$95$0 * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $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}
t_0 := e^{-x}\\
\mathbf{if}\;x \leq -520:\\
\;\;\;\;\frac{1 + t\_0}{2}\\
\mathbf{elif}\;x \leq 310000000:\\
\;\;\;\;\frac{e^{x \cdot eps\_m} + \left(1 - x \cdot \left(eps\_m + 1\right)\right)}{2}\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{+147}:\\
\;\;\;\;\frac{\frac{eps\_m \cdot \left(t\_0 \cdot \left(2 + x \cdot 2\right)\right)}{eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\end{array}
\end{array}
if x < -520Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 52.9%
Taylor expanded in eps around 0 100.0%
mul-1-neg100.0%
Simplified100.0%
if -520 < x < 3.1e8Initial program 55.1%
Simplified44.8%
Taylor expanded in eps around inf 98.3%
Taylor expanded in eps around inf 98.3%
*-commutative98.3%
Simplified98.3%
Taylor expanded in x around 0 84.2%
mul-1-neg84.2%
Simplified84.2%
if 3.1e8 < x < 1.55e147Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 67.2%
Simplified67.2%
if 1.55e147 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 25.9%
Final simplification76.4%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -520.0)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (<= x 250000000.0)
(/ (+ (exp (* x eps_m)) (- 1.0 (* x (+ eps_m 1.0)))) 2.0)
(if (<= x 2.3e+148) 0.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 <= -520.0) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 250000000.0) {
tmp = (exp((x * eps_m)) + (1.0 - (x * (eps_m + 1.0)))) / 2.0;
} else if (x <= 2.3e+148) {
tmp = 0.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 <= (-520.0d0)) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= 250000000.0d0) then
tmp = (exp((x * eps_m)) + (1.0d0 - (x * (eps_m + 1.0d0)))) / 2.0d0
else if (x <= 2.3d+148) then
tmp = 0.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 <= -520.0) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 250000000.0) {
tmp = (Math.exp((x * eps_m)) + (1.0 - (x * (eps_m + 1.0)))) / 2.0;
} else if (x <= 2.3e+148) {
tmp = 0.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 <= -520.0: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 250000000.0: tmp = (math.exp((x * eps_m)) + (1.0 - (x * (eps_m + 1.0)))) / 2.0 elif x <= 2.3e+148: tmp = 0.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 <= -520.0) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 250000000.0) tmp = Float64(Float64(exp(Float64(x * eps_m)) + Float64(1.0 - Float64(x * Float64(eps_m + 1.0)))) / 2.0); elseif (x <= 2.3e+148) tmp = 0.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 <= -520.0) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= 250000000.0) tmp = (exp((x * eps_m)) + (1.0 - (x * (eps_m + 1.0)))) / 2.0; elseif (x <= 2.3e+148) tmp = 0.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, -520.0], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 250000000.0], N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] + N[(1.0 - N[(x * N[(eps$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.3e+148], 0.0, 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 -520:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 250000000:\\
\;\;\;\;\frac{e^{x \cdot eps\_m} + \left(1 - x \cdot \left(eps\_m + 1\right)\right)}{2}\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{+148}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\end{array}
\end{array}
if x < -520Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 52.9%
Taylor expanded in eps around 0 100.0%
mul-1-neg100.0%
Simplified100.0%
if -520 < x < 2.5e8Initial program 55.1%
Simplified44.8%
Taylor expanded in eps around inf 98.3%
Taylor expanded in eps around inf 98.3%
*-commutative98.3%
Simplified98.3%
Taylor expanded in x around 0 84.2%
mul-1-neg84.2%
Simplified84.2%
if 2.5e8 < x < 2.3000000000000001e148Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 67.2%
mul-1-neg67.2%
mul-1-neg67.2%
rec-exp67.2%
sub-neg67.2%
div-sub67.2%
mul-1-neg67.2%
rec-exp67.2%
+-inverses67.2%
Simplified67.2%
if 2.3000000000000001e148 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 25.9%
Final simplification76.4%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -6.9e-273)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (<= x 210000.0)
(/ (+ 1.0 (exp (* x eps_m))) 2.0)
(if (<= x 2.2e+147) 0.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 <= -6.9e-273) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 210000.0) {
tmp = (1.0 + exp((x * eps_m))) / 2.0;
} else if (x <= 2.2e+147) {
tmp = 0.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 <= (-6.9d-273)) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= 210000.0d0) then
tmp = (1.0d0 + exp((x * eps_m))) / 2.0d0
else if (x <= 2.2d+147) then
tmp = 0.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 <= -6.9e-273) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 210000.0) {
tmp = (1.0 + Math.exp((x * eps_m))) / 2.0;
} else if (x <= 2.2e+147) {
tmp = 0.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 <= -6.9e-273: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 210000.0: tmp = (1.0 + math.exp((x * eps_m))) / 2.0 elif x <= 2.2e+147: tmp = 0.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 <= -6.9e-273) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 210000.0) tmp = Float64(Float64(1.0 + exp(Float64(x * eps_m))) / 2.0); elseif (x <= 2.2e+147) tmp = 0.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 <= -6.9e-273) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= 210000.0) tmp = (1.0 + exp((x * eps_m))) / 2.0; elseif (x <= 2.2e+147) tmp = 0.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, -6.9e-273], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 210000.0], N[(N[(1.0 + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.2e+147], 0.0, 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 -6.9 \cdot 10^{-273}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 210000:\\
\;\;\;\;\frac{1 + e^{x \cdot eps\_m}}{2}\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{+147}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\end{array}
\end{array}
if x < -6.89999999999999983e-273Initial program 70.9%
Simplified57.5%
Taylor expanded in eps around inf 99.0%
Taylor expanded in x around 0 72.0%
Taylor expanded in eps around 0 76.2%
mul-1-neg76.2%
Simplified76.2%
if -6.89999999999999983e-273 < x < 2.1e5Initial program 55.0%
Simplified52.4%
Taylor expanded in eps around inf 98.2%
Taylor expanded in eps around inf 98.1%
*-commutative98.1%
Simplified98.1%
Taylor expanded in x around 0 84.6%
if 2.1e5 < x < 2.2000000000000002e147Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 67.2%
mul-1-neg67.2%
mul-1-neg67.2%
rec-exp67.2%
sub-neg67.2%
div-sub67.2%
mul-1-neg67.2%
rec-exp67.2%
+-inverses67.2%
Simplified67.2%
if 2.2000000000000002e147 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 25.9%
Final simplification71.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -7e-273)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (or (<= x 265000000.0) (not (<= x 1.55e+147)))
(/ (+ 1.0 (exp (* x eps_m))) 2.0)
0.0)))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -7e-273) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if ((x <= 265000000.0) || !(x <= 1.55e+147)) {
tmp = (1.0 + exp((x * 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 <= (-7d-273)) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if ((x <= 265000000.0d0) .or. (.not. (x <= 1.55d+147))) then
tmp = (1.0d0 + exp((x * 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 <= -7e-273) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if ((x <= 265000000.0) || !(x <= 1.55e+147)) {
tmp = (1.0 + Math.exp((x * eps_m))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -7e-273: tmp = (1.0 + math.exp(-x)) / 2.0 elif (x <= 265000000.0) or not (x <= 1.55e+147): tmp = (1.0 + math.exp((x * eps_m))) / 2.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -7e-273) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif ((x <= 265000000.0) || !(x <= 1.55e+147)) tmp = Float64(Float64(1.0 + exp(Float64(x * 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 <= -7e-273) tmp = (1.0 + exp(-x)) / 2.0; elseif ((x <= 265000000.0) || ~((x <= 1.55e+147))) tmp = (1.0 + exp((x * 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, -7e-273], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 265000000.0], N[Not[LessEqual[x, 1.55e+147]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(x * 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 -7 \cdot 10^{-273}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 265000000 \lor \neg \left(x \leq 1.55 \cdot 10^{+147}\right):\\
\;\;\;\;\frac{1 + e^{x \cdot eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -6.99999999999999984e-273Initial program 70.9%
Simplified57.5%
Taylor expanded in eps around inf 99.0%
Taylor expanded in x around 0 72.0%
Taylor expanded in eps around 0 76.2%
mul-1-neg76.2%
Simplified76.2%
if -6.99999999999999984e-273 < x < 2.65e8 or 1.55e147 < x Initial program 67.5%
Simplified65.5%
Taylor expanded in eps around inf 98.7%
Taylor expanded in eps around inf 94.7%
*-commutative94.7%
Simplified94.7%
Taylor expanded in x around 0 68.3%
if 2.65e8 < x < 1.55e147Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 67.2%
mul-1-neg67.2%
mul-1-neg67.2%
rec-exp67.2%
sub-neg67.2%
div-sub67.2%
mul-1-neg67.2%
rec-exp67.2%
+-inverses67.2%
Simplified67.2%
Final simplification71.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 3200.0) (/ (+ 1.0 (exp (- x))) 2.0) (if (<= x 1.08e+173) 0.0 (* (* x eps_m) 0.5))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 3200.0) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 1.08e+173) {
tmp = 0.0;
} else {
tmp = (x * eps_m) * 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 <= 3200.0d0) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= 1.08d+173) then
tmp = 0.0d0
else
tmp = (x * eps_m) * 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 <= 3200.0) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 1.08e+173) {
tmp = 0.0;
} else {
tmp = (x * eps_m) * 0.5;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 3200.0: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 1.08e+173: tmp = 0.0 else: tmp = (x * eps_m) * 0.5 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 3200.0) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 1.08e+173) tmp = 0.0; else tmp = Float64(Float64(x * eps_m) * 0.5); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 3200.0) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= 1.08e+173) tmp = 0.0; else tmp = (x * eps_m) * 0.5; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 3200.0], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.08e+173], 0.0, N[(N[(x * eps$95$m), $MachinePrecision] * 0.5), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3200:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 1.08 \cdot 10^{+173}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot eps\_m\right) \cdot 0.5\\
\end{array}
\end{array}
if x < 3200Initial program 63.4%
Simplified55.1%
Taylor expanded in eps around inf 98.6%
Taylor expanded in x around 0 77.9%
Taylor expanded in eps around 0 78.3%
mul-1-neg78.3%
Simplified78.3%
if 3200 < x < 1.08e173Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 63.7%
mul-1-neg63.7%
mul-1-neg63.7%
rec-exp63.7%
sub-neg63.7%
div-sub63.7%
mul-1-neg63.7%
rec-exp63.7%
+-inverses63.7%
Simplified63.7%
if 1.08e173 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 42.0%
Taylor expanded in eps around inf 38.9%
associate-*r*38.9%
mul-1-neg38.9%
Simplified38.9%
div-inv38.9%
*-commutative38.9%
add-sqr-sqrt38.8%
sqrt-unprod83.4%
sqr-neg83.4%
sqrt-unprod21.2%
add-sqr-sqrt22.0%
metadata-eval22.0%
Applied egg-rr22.0%
Final simplification69.8%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -4.9e-26) (* x (* eps_m -0.5)) (if (<= x 3200.0) 1.0 (if (<= x 1.15e+173) 0.0 (* (* x eps_m) 0.5)))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -4.9e-26) {
tmp = x * (eps_m * -0.5);
} else if (x <= 3200.0) {
tmp = 1.0;
} else if (x <= 1.15e+173) {
tmp = 0.0;
} else {
tmp = (x * eps_m) * 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 <= (-4.9d-26)) then
tmp = x * (eps_m * (-0.5d0))
else if (x <= 3200.0d0) then
tmp = 1.0d0
else if (x <= 1.15d+173) then
tmp = 0.0d0
else
tmp = (x * eps_m) * 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 <= -4.9e-26) {
tmp = x * (eps_m * -0.5);
} else if (x <= 3200.0) {
tmp = 1.0;
} else if (x <= 1.15e+173) {
tmp = 0.0;
} else {
tmp = (x * eps_m) * 0.5;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -4.9e-26: tmp = x * (eps_m * -0.5) elif x <= 3200.0: tmp = 1.0 elif x <= 1.15e+173: tmp = 0.0 else: tmp = (x * eps_m) * 0.5 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -4.9e-26) tmp = Float64(x * Float64(eps_m * -0.5)); elseif (x <= 3200.0) tmp = 1.0; elseif (x <= 1.15e+173) tmp = 0.0; else tmp = Float64(Float64(x * eps_m) * 0.5); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -4.9e-26) tmp = x * (eps_m * -0.5); elseif (x <= 3200.0) tmp = 1.0; elseif (x <= 1.15e+173) tmp = 0.0; else tmp = (x * eps_m) * 0.5; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -4.9e-26], N[(x * N[(eps$95$m * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3200.0], 1.0, If[LessEqual[x, 1.15e+173], 0.0, N[(N[(x * eps$95$m), $MachinePrecision] * 0.5), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.9 \cdot 10^{-26}:\\
\;\;\;\;x \cdot \left(eps\_m \cdot -0.5\right)\\
\mathbf{elif}\;x \leq 3200:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{+173}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot eps\_m\right) \cdot 0.5\\
\end{array}
\end{array}
if x < -4.8999999999999999e-26Initial program 97.4%
Simplified97.4%
Taylor expanded in x around 0 40.2%
Taylor expanded in eps around inf 22.2%
associate-*r*22.2%
mul-1-neg22.2%
Simplified22.2%
Taylor expanded in eps around 0 22.2%
associate-*r*22.2%
Simplified22.2%
if -4.8999999999999999e-26 < x < 3200Initial program 54.6%
Simplified54.6%
Taylor expanded in x around 0 75.3%
if 3200 < x < 1.14999999999999997e173Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 63.7%
mul-1-neg63.7%
mul-1-neg63.7%
rec-exp63.7%
sub-neg63.7%
div-sub63.7%
mul-1-neg63.7%
rec-exp63.7%
+-inverses63.7%
Simplified63.7%
if 1.14999999999999997e173 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 42.0%
Taylor expanded in eps around inf 38.9%
associate-*r*38.9%
mul-1-neg38.9%
Simplified38.9%
div-inv38.9%
*-commutative38.9%
add-sqr-sqrt38.8%
sqrt-unprod83.4%
sqr-neg83.4%
sqrt-unprod21.2%
add-sqr-sqrt22.0%
metadata-eval22.0%
Applied egg-rr22.0%
Final simplification59.5%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 205.0) (/ (- 2.0 (* x eps_m)) 2.0) (if (<= x 1.15e+175) 0.0 (* (* x eps_m) 0.5))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 205.0) {
tmp = (2.0 - (x * eps_m)) / 2.0;
} else if (x <= 1.15e+175) {
tmp = 0.0;
} else {
tmp = (x * eps_m) * 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 <= 205.0d0) then
tmp = (2.0d0 - (x * eps_m)) / 2.0d0
else if (x <= 1.15d+175) then
tmp = 0.0d0
else
tmp = (x * eps_m) * 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 <= 205.0) {
tmp = (2.0 - (x * eps_m)) / 2.0;
} else if (x <= 1.15e+175) {
tmp = 0.0;
} else {
tmp = (x * eps_m) * 0.5;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 205.0: tmp = (2.0 - (x * eps_m)) / 2.0 elif x <= 1.15e+175: tmp = 0.0 else: tmp = (x * eps_m) * 0.5 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 205.0) tmp = Float64(Float64(2.0 - Float64(x * eps_m)) / 2.0); elseif (x <= 1.15e+175) tmp = 0.0; else tmp = Float64(Float64(x * eps_m) * 0.5); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 205.0) tmp = (2.0 - (x * eps_m)) / 2.0; elseif (x <= 1.15e+175) tmp = 0.0; else tmp = (x * eps_m) * 0.5; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 205.0], N[(N[(2.0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.15e+175], 0.0, N[(N[(x * eps$95$m), $MachinePrecision] * 0.5), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 205:\\
\;\;\;\;\frac{2 - x \cdot eps\_m}{2}\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{+175}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot eps\_m\right) \cdot 0.5\\
\end{array}
\end{array}
if x < 205Initial program 63.2%
Simplified45.8%
Taylor expanded in x around 0 60.7%
Taylor expanded in eps around 0 64.1%
Taylor expanded in eps around 0 64.1%
mul-1-neg64.1%
Simplified64.1%
if 205 < x < 1.15e175Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 62.1%
mul-1-neg62.1%
mul-1-neg62.1%
rec-exp62.1%
sub-neg62.1%
div-sub62.1%
mul-1-neg62.1%
rec-exp62.1%
+-inverses62.1%
Simplified62.1%
if 1.15e175 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 42.0%
Taylor expanded in eps around inf 38.9%
associate-*r*38.9%
mul-1-neg38.9%
Simplified38.9%
div-inv38.9%
*-commutative38.9%
add-sqr-sqrt38.8%
sqrt-unprod83.4%
sqr-neg83.4%
sqrt-unprod21.2%
add-sqr-sqrt22.0%
metadata-eval22.0%
Applied egg-rr22.0%
Final simplification59.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -4.9e-26) (* x (* eps_m -0.5)) (if (<= x 3200.0) 1.0 0.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -4.9e-26) {
tmp = x * (eps_m * -0.5);
} else if (x <= 3200.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 <= (-4.9d-26)) then
tmp = x * (eps_m * (-0.5d0))
else if (x <= 3200.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 <= -4.9e-26) {
tmp = x * (eps_m * -0.5);
} else if (x <= 3200.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -4.9e-26: tmp = x * (eps_m * -0.5) elif x <= 3200.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -4.9e-26) tmp = Float64(x * Float64(eps_m * -0.5)); elseif (x <= 3200.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 <= -4.9e-26) tmp = x * (eps_m * -0.5); elseif (x <= 3200.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, -4.9e-26], N[(x * N[(eps$95$m * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3200.0], 1.0, 0.0]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.9 \cdot 10^{-26}:\\
\;\;\;\;x \cdot \left(eps\_m \cdot -0.5\right)\\
\mathbf{elif}\;x \leq 3200:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -4.8999999999999999e-26Initial program 97.4%
Simplified97.4%
Taylor expanded in x around 0 40.2%
Taylor expanded in eps around inf 22.2%
associate-*r*22.2%
mul-1-neg22.2%
Simplified22.2%
Taylor expanded in eps around 0 22.2%
associate-*r*22.2%
Simplified22.2%
if -4.8999999999999999e-26 < x < 3200Initial program 54.6%
Simplified54.6%
Taylor expanded in x around 0 75.3%
if 3200 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 53.0%
mul-1-neg53.0%
mul-1-neg53.0%
rec-exp53.0%
sub-neg53.0%
div-sub53.0%
mul-1-neg53.0%
rec-exp53.0%
+-inverses53.0%
Simplified53.0%
Final simplification61.4%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 3200.0) 1.0 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 3200.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 <= 3200.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 <= 3200.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 3200.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 3200.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 <= 3200.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, 3200.0], 1.0, 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3200:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 3200Initial program 63.4%
Simplified63.4%
Taylor expanded in x around 0 60.4%
if 3200 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 53.0%
mul-1-neg53.0%
mul-1-neg53.0%
rec-exp53.0%
sub-neg53.0%
div-sub53.0%
mul-1-neg53.0%
rec-exp53.0%
+-inverses53.0%
Simplified53.0%
Final simplification58.4%
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 73.0%
Simplified60.2%
Taylor expanded in eps around 0 15.5%
mul-1-neg15.5%
mul-1-neg15.5%
rec-exp15.5%
sub-neg15.5%
div-sub15.5%
mul-1-neg15.5%
rec-exp15.5%
+-inverses15.7%
Simplified15.7%
Final simplification15.7%
herbie shell --seed 2024106
(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))