
(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 (/ (+ x 1.0) (exp x))))
(if (<= eps_m 3.4e-17)
(/ (+ t_0 t_0) 2.0)
(/
(+
(* (+ 1.0 (/ 1.0 eps_m)) (exp (* x (+ eps_m -1.0))))
(* (exp (* x (- -1.0 eps_m))) (+ 1.0 (/ -1.0 eps_m))))
2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = (x + 1.0) / exp(x);
double tmp;
if (eps_m <= 3.4e-17) {
tmp = (t_0 + t_0) / 2.0;
} else {
tmp = (((1.0 + (1.0 / eps_m)) * exp((x * (eps_m + -1.0)))) + (exp((x * (-1.0 - eps_m))) * (1.0 + (-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) :: t_0
real(8) :: tmp
t_0 = (x + 1.0d0) / exp(x)
if (eps_m <= 3.4d-17) then
tmp = (t_0 + t_0) / 2.0d0
else
tmp = (((1.0d0 + (1.0d0 / eps_m)) * exp((x * (eps_m + (-1.0d0))))) + (exp((x * ((-1.0d0) - eps_m))) * (1.0d0 + ((-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 t_0 = (x + 1.0) / Math.exp(x);
double tmp;
if (eps_m <= 3.4e-17) {
tmp = (t_0 + t_0) / 2.0;
} else {
tmp = (((1.0 + (1.0 / eps_m)) * Math.exp((x * (eps_m + -1.0)))) + (Math.exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = (x + 1.0) / math.exp(x) tmp = 0 if eps_m <= 3.4e-17: tmp = (t_0 + t_0) / 2.0 else: tmp = (((1.0 + (1.0 / eps_m)) * math.exp((x * (eps_m + -1.0)))) + (math.exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(Float64(x + 1.0) / exp(x)) tmp = 0.0 if (eps_m <= 3.4e-17) tmp = Float64(Float64(t_0 + t_0) / 2.0); else tmp = Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) * exp(Float64(x * Float64(eps_m + -1.0)))) + Float64(exp(Float64(x * Float64(-1.0 - eps_m))) * Float64(1.0 + Float64(-1.0 / eps_m)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = (x + 1.0) / exp(x); tmp = 0.0; if (eps_m <= 3.4e-17) tmp = (t_0 + t_0) / 2.0; else tmp = (((1.0 + (1.0 / eps_m)) * exp((x * (eps_m + -1.0)))) + (exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(N[(x + 1.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps$95$m, 3.4e-17], N[(N[(t$95$0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := \frac{x + 1}{e^{x}}\\
\mathbf{if}\;eps\_m \leq 3.4 \cdot 10^{-17}:\\
\;\;\;\;\frac{t\_0 + t\_0}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) \cdot e^{x \cdot \left(eps\_m + -1\right)} + e^{x \cdot \left(-1 - eps\_m\right)} \cdot \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\end{array}
\end{array}
if eps < 3.3999999999999998e-17Initial program 60.5%
Simplified60.5%
Taylor expanded in eps around 0 73.0%
Simplified73.6%
exp-neg73.6%
un-div-inv73.6%
Applied egg-rr73.6%
exp-neg73.6%
un-div-inv73.6%
Applied egg-rr73.6%
if 3.3999999999999998e-17 < eps Initial program 99.9%
Final simplification81.5%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (* x (+ eps_m -1.0)))) (t_1 (* x (- -1.0 eps_m))))
(if (<= x -1e-232)
(/ (+ 1.0 (exp t_1)) 2.0)
(if (<= x 0.64)
(/ (+ t_0 (+ 1.0 t_1)) 2.0)
(if (<= x 5.4e+69)
(/ (+ (/ (+ x 1.0) (exp x)) (* x (exp (- x)))) 2.0)
(/ (+ t_0 (/ 1.0 (+ x 1.0))) 2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * (eps_m + -1.0)));
double t_1 = x * (-1.0 - eps_m);
double tmp;
if (x <= -1e-232) {
tmp = (1.0 + exp(t_1)) / 2.0;
} else if (x <= 0.64) {
tmp = (t_0 + (1.0 + t_1)) / 2.0;
} else if (x <= 5.4e+69) {
tmp = (((x + 1.0) / exp(x)) + (x * exp(-x))) / 2.0;
} else {
tmp = (t_0 + (1.0 / (x + 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) :: t_1
real(8) :: tmp
t_0 = exp((x * (eps_m + (-1.0d0))))
t_1 = x * ((-1.0d0) - eps_m)
if (x <= (-1d-232)) then
tmp = (1.0d0 + exp(t_1)) / 2.0d0
else if (x <= 0.64d0) then
tmp = (t_0 + (1.0d0 + t_1)) / 2.0d0
else if (x <= 5.4d+69) then
tmp = (((x + 1.0d0) / exp(x)) + (x * exp(-x))) / 2.0d0
else
tmp = (t_0 + (1.0d0 / (x + 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 * (eps_m + -1.0)));
double t_1 = x * (-1.0 - eps_m);
double tmp;
if (x <= -1e-232) {
tmp = (1.0 + Math.exp(t_1)) / 2.0;
} else if (x <= 0.64) {
tmp = (t_0 + (1.0 + t_1)) / 2.0;
} else if (x <= 5.4e+69) {
tmp = (((x + 1.0) / Math.exp(x)) + (x * Math.exp(-x))) / 2.0;
} else {
tmp = (t_0 + (1.0 / (x + 1.0))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * (eps_m + -1.0))) t_1 = x * (-1.0 - eps_m) tmp = 0 if x <= -1e-232: tmp = (1.0 + math.exp(t_1)) / 2.0 elif x <= 0.64: tmp = (t_0 + (1.0 + t_1)) / 2.0 elif x <= 5.4e+69: tmp = (((x + 1.0) / math.exp(x)) + (x * math.exp(-x))) / 2.0 else: tmp = (t_0 + (1.0 / (x + 1.0))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * Float64(eps_m + -1.0))) t_1 = Float64(x * Float64(-1.0 - eps_m)) tmp = 0.0 if (x <= -1e-232) tmp = Float64(Float64(1.0 + exp(t_1)) / 2.0); elseif (x <= 0.64) tmp = Float64(Float64(t_0 + Float64(1.0 + t_1)) / 2.0); elseif (x <= 5.4e+69) tmp = Float64(Float64(Float64(Float64(x + 1.0) / exp(x)) + Float64(x * exp(Float64(-x)))) / 2.0); else tmp = Float64(Float64(t_0 + Float64(1.0 / Float64(x + 1.0))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp((x * (eps_m + -1.0))); t_1 = x * (-1.0 - eps_m); tmp = 0.0; if (x <= -1e-232) tmp = (1.0 + exp(t_1)) / 2.0; elseif (x <= 0.64) tmp = (t_0 + (1.0 + t_1)) / 2.0; elseif (x <= 5.4e+69) tmp = (((x + 1.0) / exp(x)) + (x * exp(-x))) / 2.0; else tmp = (t_0 + (1.0 / (x + 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[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1e-232], N[(N[(1.0 + N[Exp[t$95$1], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 0.64], N[(N[(t$95$0 + N[(1.0 + t$95$1), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5.4e+69], N[(N[(N[(N[(x + 1.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision] + N[(x * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(t$95$0 + N[(1.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(eps\_m + -1\right)}\\
t_1 := x \cdot \left(-1 - eps\_m\right)\\
\mathbf{if}\;x \leq -1 \cdot 10^{-232}:\\
\;\;\;\;\frac{1 + e^{t\_1}}{2}\\
\mathbf{elif}\;x \leq 0.64:\\
\;\;\;\;\frac{t\_0 + \left(1 + t\_1\right)}{2}\\
\mathbf{elif}\;x \leq 5.4 \cdot 10^{+69}:\\
\;\;\;\;\frac{\frac{x + 1}{e^{x}} + x \cdot e^{-x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 + \frac{1}{x + 1}}{2}\\
\end{array}
\end{array}
if x < -1.00000000000000002e-232Initial program 74.1%
Simplified74.1%
Taylor expanded in x around 0 46.3%
Taylor expanded in eps around inf 69.6%
cancel-sign-sub-inv69.6%
metadata-eval69.6%
*-lft-identity69.6%
associate-*r*69.6%
exp-prod60.5%
remove-double-neg60.5%
mul-1-neg60.5%
sub-neg60.5%
exp-prod69.6%
associate-*r*69.6%
remove-double-neg69.6%
mul-1-neg69.6%
sub-neg69.6%
mul-1-neg69.6%
associate-*r*69.6%
exp-prod60.5%
Simplified69.6%
if -1.00000000000000002e-232 < x < 0.640000000000000013Initial program 52.6%
Simplified44.1%
Taylor expanded in eps around inf 99.7%
Taylor expanded in x around 0 93.4%
associate-*r*93.4%
neg-mul-193.4%
Simplified93.4%
if 0.640000000000000013 < x < 5.3999999999999996e69Initial program 82.9%
Simplified82.9%
Taylor expanded in eps around 0 82.5%
Simplified82.4%
exp-neg82.4%
un-div-inv82.4%
Applied egg-rr82.4%
Taylor expanded in x around inf 68.9%
if 5.3999999999999996e69 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 30.2%
Taylor expanded in eps around 0 30.3%
+-commutative30.3%
Simplified30.3%
Final simplification70.0%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (/ (+ x 1.0) (exp x))))
(if (<= eps_m 2e-37)
(/ (+ t_0 t_0) 2.0)
(/ (+ (exp (* x (+ eps_m -1.0))) (/ 1.0 (exp (+ x (* eps_m x))))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = (x + 1.0) / exp(x);
double tmp;
if (eps_m <= 2e-37) {
tmp = (t_0 + t_0) / 2.0;
} else {
tmp = (exp((x * (eps_m + -1.0))) + (1.0 / exp((x + (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) :: t_0
real(8) :: tmp
t_0 = (x + 1.0d0) / exp(x)
if (eps_m <= 2d-37) then
tmp = (t_0 + t_0) / 2.0d0
else
tmp = (exp((x * (eps_m + (-1.0d0)))) + (1.0d0 / exp((x + (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 t_0 = (x + 1.0) / Math.exp(x);
double tmp;
if (eps_m <= 2e-37) {
tmp = (t_0 + t_0) / 2.0;
} else {
tmp = (Math.exp((x * (eps_m + -1.0))) + (1.0 / Math.exp((x + (eps_m * x))))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = (x + 1.0) / math.exp(x) tmp = 0 if eps_m <= 2e-37: tmp = (t_0 + t_0) / 2.0 else: tmp = (math.exp((x * (eps_m + -1.0))) + (1.0 / math.exp((x + (eps_m * x))))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(Float64(x + 1.0) / exp(x)) tmp = 0.0 if (eps_m <= 2e-37) tmp = Float64(Float64(t_0 + t_0) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + Float64(1.0 / exp(Float64(x + Float64(eps_m * x))))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = (x + 1.0) / exp(x); tmp = 0.0; if (eps_m <= 2e-37) tmp = (t_0 + t_0) / 2.0; else tmp = (exp((x * (eps_m + -1.0))) + (1.0 / exp((x + (eps_m * x))))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(N[(x + 1.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps$95$m, 2e-37], N[(N[(t$95$0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[Exp[N[(x + N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := \frac{x + 1}{e^{x}}\\
\mathbf{if}\;eps\_m \leq 2 \cdot 10^{-37}:\\
\;\;\;\;\frac{t\_0 + t\_0}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(eps\_m + -1\right)} + \frac{1}{e^{x + eps\_m \cdot x}}}{2}\\
\end{array}
\end{array}
if eps < 2.00000000000000013e-37Initial program 62.1%
Simplified62.1%
Taylor expanded in eps around 0 72.3%
Simplified72.8%
exp-neg72.8%
un-div-inv72.8%
Applied egg-rr72.8%
exp-neg72.8%
un-div-inv72.8%
Applied egg-rr72.8%
if 2.00000000000000013e-37 < eps Initial program 94.0%
Simplified84.4%
Taylor expanded in eps around inf 99.9%
Final simplification81.5%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* x (+ eps_m -1.0))) (/ 1.0 (exp (+ x (* eps_m x))))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * (eps_m + -1.0))) + (1.0 / exp((x + (eps_m * x))))) / 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 + (eps_m * x))))) / 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 + (eps_m * x))))) / 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 + (eps_m * x))))) / 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(eps_m * x))))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((x * (eps_m + -1.0))) + (1.0 / exp((x + (eps_m * x))))) / 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[(eps$95$m * x), $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 + eps\_m \cdot x}}}{2}
\end{array}
Initial program 72.3%
Simplified64.7%
Taylor expanded in eps around inf 98.4%
Final simplification98.4%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -3900000.0)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (<= x 1150.0)
(/
(+ 2.0 (* x (+ -1.0 (* 0.5 (* x (+ 1.0 (* eps_m (+ eps_m 2.0))))))))
2.0)
(if (or (<= x 1.8e+87) (not (<= x 2.1e+242)))
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0)
(/ (+ 2.0 (* 0.5 (pow (* eps_m x) 2.0))) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -3900000.0) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 1150.0) {
tmp = (2.0 + (x * (-1.0 + (0.5 * (x * (1.0 + (eps_m * (eps_m + 2.0)))))))) / 2.0;
} else if ((x <= 1.8e+87) || !(x <= 2.1e+242)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (2.0 + (0.5 * pow((eps_m * 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 <= (-3900000.0d0)) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= 1150.0d0) then
tmp = (2.0d0 + (x * ((-1.0d0) + (0.5d0 * (x * (1.0d0 + (eps_m * (eps_m + 2.0d0)))))))) / 2.0d0
else if ((x <= 1.8d+87) .or. (.not. (x <= 2.1d+242))) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 + ((-1.0d0) / eps_m))) / 2.0d0
else
tmp = (2.0d0 + (0.5d0 * ((eps_m * 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 <= -3900000.0) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 1150.0) {
tmp = (2.0 + (x * (-1.0 + (0.5 * (x * (1.0 + (eps_m * (eps_m + 2.0)))))))) / 2.0;
} else if ((x <= 1.8e+87) || !(x <= 2.1e+242)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (2.0 + (0.5 * Math.pow((eps_m * x), 2.0))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -3900000.0: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 1150.0: tmp = (2.0 + (x * (-1.0 + (0.5 * (x * (1.0 + (eps_m * (eps_m + 2.0)))))))) / 2.0 elif (x <= 1.8e+87) or not (x <= 2.1e+242): tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 else: tmp = (2.0 + (0.5 * math.pow((eps_m * x), 2.0))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -3900000.0) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 1150.0) tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(0.5 * Float64(x * Float64(1.0 + Float64(eps_m * Float64(eps_m + 2.0)))))))) / 2.0); elseif ((x <= 1.8e+87) || !(x <= 2.1e+242)) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(2.0 + Float64(0.5 * (Float64(eps_m * 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 <= -3900000.0) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= 1150.0) tmp = (2.0 + (x * (-1.0 + (0.5 * (x * (1.0 + (eps_m * (eps_m + 2.0)))))))) / 2.0; elseif ((x <= 1.8e+87) || ~((x <= 2.1e+242))) tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0; else tmp = (2.0 + (0.5 * ((eps_m * x) ^ 2.0))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -3900000.0], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1150.0], N[(N[(2.0 + N[(x * N[(-1.0 + N[(0.5 * N[(x * N[(1.0 + N[(eps$95$m * N[(eps$95$m + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 1.8e+87], N[Not[LessEqual[x, 2.1e+242]], $MachinePrecision]], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(0.5 * N[Power[N[(eps$95$m * x), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3900000:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 1150:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + 0.5 \cdot \left(x \cdot \left(1 + eps\_m \cdot \left(eps\_m + 2\right)\right)\right)\right)}{2}\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{+87} \lor \neg \left(x \leq 2.1 \cdot 10^{+242}\right):\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + 0.5 \cdot {\left(eps\_m \cdot x\right)}^{2}}{2}\\
\end{array}
\end{array}
if x < -3.9e6Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 41.7%
Taylor expanded in eps around inf 70.3%
Taylor expanded in eps around 0 100.0%
sub-neg100.0%
distribute-rgt1-in100.0%
metadata-eval100.0%
mul0-lft100.0%
metadata-eval100.0%
mul-1-neg100.0%
remove-double-neg100.0%
neg-mul-1100.0%
Simplified100.0%
if -3.9e6 < x < 1150Initial program 54.0%
Simplified54.0%
Taylor expanded in x around 0 41.6%
Taylor expanded in eps around inf 84.1%
Taylor expanded in x around 0 88.6%
Taylor expanded in eps around 0 88.6%
if 1150 < x < 1.79999999999999997e87 or 2.0999999999999999e242 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 15.2%
Taylor expanded in x around 0 66.9%
if 1.79999999999999997e87 < x < 2.0999999999999999e242Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 26.0%
Taylor expanded in eps around inf 46.8%
Taylor expanded in x around 0 62.7%
Taylor expanded in eps around inf 62.8%
*-commutative62.8%
unpow262.8%
unpow262.8%
swap-sqr63.1%
unpow263.1%
Simplified63.1%
Final simplification84.1%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 3e-256)
(/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) 2.0)
(if (<= x 2000.0)
(/
(+ 2.0 (* x (+ -1.0 (* 0.5 (* x (+ 1.0 (* eps_m (+ eps_m 2.0))))))))
2.0)
(if (or (<= x 1.3e+87) (not (<= x 1e+242)))
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0)
(/ (+ 2.0 (* 0.5 (pow (* eps_m x) 2.0))) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 3e-256) {
tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 2000.0) {
tmp = (2.0 + (x * (-1.0 + (0.5 * (x * (1.0 + (eps_m * (eps_m + 2.0)))))))) / 2.0;
} else if ((x <= 1.3e+87) || !(x <= 1e+242)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (2.0 + (0.5 * pow((eps_m * 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 <= 3d-256) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
else if (x <= 2000.0d0) then
tmp = (2.0d0 + (x * ((-1.0d0) + (0.5d0 * (x * (1.0d0 + (eps_m * (eps_m + 2.0d0)))))))) / 2.0d0
else if ((x <= 1.3d+87) .or. (.not. (x <= 1d+242))) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 + ((-1.0d0) / eps_m))) / 2.0d0
else
tmp = (2.0d0 + (0.5d0 * ((eps_m * 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 <= 3e-256) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 2000.0) {
tmp = (2.0 + (x * (-1.0 + (0.5 * (x * (1.0 + (eps_m * (eps_m + 2.0)))))))) / 2.0;
} else if ((x <= 1.3e+87) || !(x <= 1e+242)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (2.0 + (0.5 * Math.pow((eps_m * x), 2.0))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 3e-256: tmp = (1.0 + math.exp((x * (-1.0 - eps_m)))) / 2.0 elif x <= 2000.0: tmp = (2.0 + (x * (-1.0 + (0.5 * (x * (1.0 + (eps_m * (eps_m + 2.0)))))))) / 2.0 elif (x <= 1.3e+87) or not (x <= 1e+242): tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 else: tmp = (2.0 + (0.5 * math.pow((eps_m * x), 2.0))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 3e-256) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); elseif (x <= 2000.0) tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(0.5 * Float64(x * Float64(1.0 + Float64(eps_m * Float64(eps_m + 2.0)))))))) / 2.0); elseif ((x <= 1.3e+87) || !(x <= 1e+242)) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(2.0 + Float64(0.5 * (Float64(eps_m * 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 <= 3e-256) tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0; elseif (x <= 2000.0) tmp = (2.0 + (x * (-1.0 + (0.5 * (x * (1.0 + (eps_m * (eps_m + 2.0)))))))) / 2.0; elseif ((x <= 1.3e+87) || ~((x <= 1e+242))) tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0; else tmp = (2.0 + (0.5 * ((eps_m * x) ^ 2.0))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 3e-256], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2000.0], N[(N[(2.0 + N[(x * N[(-1.0 + N[(0.5 * N[(x * N[(1.0 + N[(eps$95$m * N[(eps$95$m + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 1.3e+87], N[Not[LessEqual[x, 1e+242]], $MachinePrecision]], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(0.5 * N[Power[N[(eps$95$m * x), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3 \cdot 10^{-256}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\mathbf{elif}\;x \leq 2000:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + 0.5 \cdot \left(x \cdot \left(1 + eps\_m \cdot \left(eps\_m + 2\right)\right)\right)\right)}{2}\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{+87} \lor \neg \left(x \leq 10^{+242}\right):\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + 0.5 \cdot {\left(eps\_m \cdot x\right)}^{2}}{2}\\
\end{array}
\end{array}
if x < 2.9999999999999998e-256Initial program 67.1%
Simplified67.1%
Taylor expanded in x around 0 46.4%
Taylor expanded in eps around inf 77.4%
cancel-sign-sub-inv77.4%
metadata-eval77.4%
*-lft-identity77.4%
associate-*r*77.4%
exp-prod70.8%
remove-double-neg70.8%
mul-1-neg70.8%
sub-neg70.8%
exp-prod77.4%
associate-*r*77.4%
remove-double-neg77.4%
mul-1-neg77.4%
sub-neg77.4%
mul-1-neg77.4%
associate-*r*77.4%
exp-prod70.8%
Simplified77.4%
if 2.9999999999999998e-256 < x < 2e3Initial program 53.1%
Simplified53.1%
Taylor expanded in x around 0 39.2%
Taylor expanded in eps around inf 81.5%
Taylor expanded in x around 0 89.4%
Taylor expanded in eps around 0 89.4%
if 2e3 < x < 1.29999999999999999e87 or 1.00000000000000005e242 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 15.2%
Taylor expanded in x around 0 66.9%
if 1.29999999999999999e87 < x < 1.00000000000000005e242Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 26.0%
Taylor expanded in eps around inf 46.8%
Taylor expanded in x around 0 62.7%
Taylor expanded in eps around inf 62.8%
*-commutative62.8%
unpow262.8%
unpow262.8%
swap-sqr63.1%
unpow263.1%
Simplified63.1%
Final simplification77.1%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1e-234)
(/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) 2.0)
(if (<= x 4.2)
(/ (+ (exp (* x (+ eps_m -1.0))) (- 1.0 x)) 2.0)
(if (or (<= x 6.8e+87) (not (<= x 2.4e+242)))
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0)
(/ (+ 2.0 (* 0.5 (pow (* eps_m x) 2.0))) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1e-234) {
tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 4.2) {
tmp = (exp((x * (eps_m + -1.0))) + (1.0 - x)) / 2.0;
} else if ((x <= 6.8e+87) || !(x <= 2.4e+242)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (2.0 + (0.5 * pow((eps_m * 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 <= (-1d-234)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
else if (x <= 4.2d0) then
tmp = (exp((x * (eps_m + (-1.0d0)))) + (1.0d0 - x)) / 2.0d0
else if ((x <= 6.8d+87) .or. (.not. (x <= 2.4d+242))) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 + ((-1.0d0) / eps_m))) / 2.0d0
else
tmp = (2.0d0 + (0.5d0 * ((eps_m * 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 <= -1e-234) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 4.2) {
tmp = (Math.exp((x * (eps_m + -1.0))) + (1.0 - x)) / 2.0;
} else if ((x <= 6.8e+87) || !(x <= 2.4e+242)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (2.0 + (0.5 * Math.pow((eps_m * x), 2.0))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1e-234: tmp = (1.0 + math.exp((x * (-1.0 - eps_m)))) / 2.0 elif x <= 4.2: tmp = (math.exp((x * (eps_m + -1.0))) + (1.0 - x)) / 2.0 elif (x <= 6.8e+87) or not (x <= 2.4e+242): tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 else: tmp = (2.0 + (0.5 * math.pow((eps_m * x), 2.0))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1e-234) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); elseif (x <= 4.2) tmp = Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + Float64(1.0 - x)) / 2.0); elseif ((x <= 6.8e+87) || !(x <= 2.4e+242)) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(2.0 + Float64(0.5 * (Float64(eps_m * 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 <= -1e-234) tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0; elseif (x <= 4.2) tmp = (exp((x * (eps_m + -1.0))) + (1.0 - x)) / 2.0; elseif ((x <= 6.8e+87) || ~((x <= 2.4e+242))) tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0; else tmp = (2.0 + (0.5 * ((eps_m * x) ^ 2.0))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1e-234], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 4.2], N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 - x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 6.8e+87], N[Not[LessEqual[x, 2.4e+242]], $MachinePrecision]], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(0.5 * N[Power[N[(eps$95$m * x), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-234}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\mathbf{elif}\;x \leq 4.2:\\
\;\;\;\;\frac{e^{x \cdot \left(eps\_m + -1\right)} + \left(1 - x\right)}{2}\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{+87} \lor \neg \left(x \leq 2.4 \cdot 10^{+242}\right):\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + 0.5 \cdot {\left(eps\_m \cdot x\right)}^{2}}{2}\\
\end{array}
\end{array}
if x < -9.9999999999999996e-235Initial program 74.1%
Simplified74.1%
Taylor expanded in x around 0 46.3%
Taylor expanded in eps around inf 69.6%
cancel-sign-sub-inv69.6%
metadata-eval69.6%
*-lft-identity69.6%
associate-*r*69.6%
exp-prod60.5%
remove-double-neg60.5%
mul-1-neg60.5%
sub-neg60.5%
exp-prod69.6%
associate-*r*69.6%
remove-double-neg69.6%
mul-1-neg69.6%
sub-neg69.6%
mul-1-neg69.6%
associate-*r*69.6%
exp-prod60.5%
Simplified69.6%
if -9.9999999999999996e-235 < x < 4.20000000000000018Initial program 52.1%
Simplified43.7%
Taylor expanded in eps around inf 98.8%
Taylor expanded in x around 0 92.6%
associate-*r*92.6%
neg-mul-192.6%
Simplified92.6%
Taylor expanded in eps around 0 92.4%
neg-mul-192.4%
Simplified92.4%
if 4.20000000000000018 < x < 6.8000000000000004e87 or 2.40000000000000012e242 < x Initial program 95.2%
Simplified95.2%
Taylor expanded in x around 0 14.7%
Taylor expanded in x around 0 63.7%
if 6.8000000000000004e87 < x < 2.40000000000000012e242Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 26.0%
Taylor expanded in eps around inf 46.8%
Taylor expanded in x around 0 62.7%
Taylor expanded in eps around inf 62.8%
*-commutative62.8%
unpow262.8%
unpow262.8%
swap-sqr63.1%
unpow263.1%
Simplified63.1%
Final simplification76.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -3.5e-236)
(/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) 2.0)
(if (or (<= x 8100000000000.0) (not (<= x 2.05e+71)))
(/ (+ (exp (* x (+ eps_m -1.0))) (/ 1.0 (+ x 1.0))) 2.0)
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -3.5e-236) {
tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0;
} else if ((x <= 8100000000000.0) || !(x <= 2.05e+71)) {
tmp = (exp((x * (eps_m + -1.0))) + (1.0 / (x + 1.0))) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-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 <= (-3.5d-236)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
else if ((x <= 8100000000000.0d0) .or. (.not. (x <= 2.05d+71))) then
tmp = (exp((x * (eps_m + (-1.0d0)))) + (1.0d0 / (x + 1.0d0))) / 2.0d0
else
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 + ((-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 <= -3.5e-236) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
} else if ((x <= 8100000000000.0) || !(x <= 2.05e+71)) {
tmp = (Math.exp((x * (eps_m + -1.0))) + (1.0 / (x + 1.0))) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -3.5e-236: tmp = (1.0 + math.exp((x * (-1.0 - eps_m)))) / 2.0 elif (x <= 8100000000000.0) or not (x <= 2.05e+71): tmp = (math.exp((x * (eps_m + -1.0))) + (1.0 / (x + 1.0))) / 2.0 else: tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -3.5e-236) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); elseif ((x <= 8100000000000.0) || !(x <= 2.05e+71)) tmp = Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + Float64(1.0 / Float64(x + 1.0))) / 2.0); else tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + 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 <= -3.5e-236) tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0; elseif ((x <= 8100000000000.0) || ~((x <= 2.05e+71))) tmp = (exp((x * (eps_m + -1.0))) + (1.0 / (x + 1.0))) / 2.0; else tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-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, -3.5e-236], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 8100000000000.0], N[Not[LessEqual[x, 2.05e+71]], $MachinePrecision]], N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.5 \cdot 10^{-236}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\mathbf{elif}\;x \leq 8100000000000 \lor \neg \left(x \leq 2.05 \cdot 10^{+71}\right):\\
\;\;\;\;\frac{e^{x \cdot \left(eps\_m + -1\right)} + \frac{1}{x + 1}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\end{array}
\end{array}
if x < -3.49999999999999994e-236Initial program 74.1%
Simplified74.1%
Taylor expanded in x around 0 46.3%
Taylor expanded in eps around inf 69.6%
cancel-sign-sub-inv69.6%
metadata-eval69.6%
*-lft-identity69.6%
associate-*r*69.6%
exp-prod60.5%
remove-double-neg60.5%
mul-1-neg60.5%
sub-neg60.5%
exp-prod69.6%
associate-*r*69.6%
remove-double-neg69.6%
mul-1-neg69.6%
sub-neg69.6%
mul-1-neg69.6%
associate-*r*69.6%
exp-prod60.5%
Simplified69.6%
if -3.49999999999999994e-236 < x < 8.1e12 or 2.0500000000000001e71 < x Initial program 68.6%
Simplified63.3%
Taylor expanded in eps around inf 98.1%
Taylor expanded in x around 0 69.1%
Taylor expanded in eps around 0 69.2%
+-commutative69.2%
Simplified69.2%
if 8.1e12 < x < 2.0500000000000001e71Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 2.4%
Taylor expanded in x around 0 79.2%
Final simplification69.9%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (* x (+ eps_m -1.0)))) (t_1 (* x (- -1.0 eps_m))))
(if (<= x -2e-235)
(/ (+ 1.0 (exp t_1)) 2.0)
(if (<= x 800000000000.0)
(/ (+ t_0 (/ 1.0 (- 1.0 t_1))) 2.0)
(if (<= x 5.5e+72)
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0)
(/ (+ t_0 (/ 1.0 (+ x 1.0))) 2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * (eps_m + -1.0)));
double t_1 = x * (-1.0 - eps_m);
double tmp;
if (x <= -2e-235) {
tmp = (1.0 + exp(t_1)) / 2.0;
} else if (x <= 800000000000.0) {
tmp = (t_0 + (1.0 / (1.0 - t_1))) / 2.0;
} else if (x <= 5.5e+72) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (t_0 + (1.0 / (x + 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) :: t_1
real(8) :: tmp
t_0 = exp((x * (eps_m + (-1.0d0))))
t_1 = x * ((-1.0d0) - eps_m)
if (x <= (-2d-235)) then
tmp = (1.0d0 + exp(t_1)) / 2.0d0
else if (x <= 800000000000.0d0) then
tmp = (t_0 + (1.0d0 / (1.0d0 - t_1))) / 2.0d0
else if (x <= 5.5d+72) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 + ((-1.0d0) / eps_m))) / 2.0d0
else
tmp = (t_0 + (1.0d0 / (x + 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 * (eps_m + -1.0)));
double t_1 = x * (-1.0 - eps_m);
double tmp;
if (x <= -2e-235) {
tmp = (1.0 + Math.exp(t_1)) / 2.0;
} else if (x <= 800000000000.0) {
tmp = (t_0 + (1.0 / (1.0 - t_1))) / 2.0;
} else if (x <= 5.5e+72) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (t_0 + (1.0 / (x + 1.0))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * (eps_m + -1.0))) t_1 = x * (-1.0 - eps_m) tmp = 0 if x <= -2e-235: tmp = (1.0 + math.exp(t_1)) / 2.0 elif x <= 800000000000.0: tmp = (t_0 + (1.0 / (1.0 - t_1))) / 2.0 elif x <= 5.5e+72: tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 else: tmp = (t_0 + (1.0 / (x + 1.0))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * Float64(eps_m + -1.0))) t_1 = Float64(x * Float64(-1.0 - eps_m)) tmp = 0.0 if (x <= -2e-235) tmp = Float64(Float64(1.0 + exp(t_1)) / 2.0); elseif (x <= 800000000000.0) tmp = Float64(Float64(t_0 + Float64(1.0 / Float64(1.0 - t_1))) / 2.0); elseif (x <= 5.5e+72) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(t_0 + Float64(1.0 / Float64(x + 1.0))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp((x * (eps_m + -1.0))); t_1 = x * (-1.0 - eps_m); tmp = 0.0; if (x <= -2e-235) tmp = (1.0 + exp(t_1)) / 2.0; elseif (x <= 800000000000.0) tmp = (t_0 + (1.0 / (1.0 - t_1))) / 2.0; elseif (x <= 5.5e+72) tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0; else tmp = (t_0 + (1.0 / (x + 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[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2e-235], N[(N[(1.0 + N[Exp[t$95$1], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 800000000000.0], N[(N[(t$95$0 + N[(1.0 / N[(1.0 - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5.5e+72], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(t$95$0 + N[(1.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(eps\_m + -1\right)}\\
t_1 := x \cdot \left(-1 - eps\_m\right)\\
\mathbf{if}\;x \leq -2 \cdot 10^{-235}:\\
\;\;\;\;\frac{1 + e^{t\_1}}{2}\\
\mathbf{elif}\;x \leq 800000000000:\\
\;\;\;\;\frac{t\_0 + \frac{1}{1 - t\_1}}{2}\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{+72}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 + \frac{1}{x + 1}}{2}\\
\end{array}
\end{array}
if x < -1.9999999999999999e-235Initial program 74.1%
Simplified74.1%
Taylor expanded in x around 0 46.3%
Taylor expanded in eps around inf 69.6%
cancel-sign-sub-inv69.6%
metadata-eval69.6%
*-lft-identity69.6%
associate-*r*69.6%
exp-prod60.5%
remove-double-neg60.5%
mul-1-neg60.5%
sub-neg60.5%
exp-prod69.6%
associate-*r*69.6%
remove-double-neg69.6%
mul-1-neg69.6%
sub-neg69.6%
mul-1-neg69.6%
associate-*r*69.6%
exp-prod60.5%
Simplified69.6%
if -1.9999999999999999e-235 < x < 8e11Initial program 51.1%
Simplified42.9%
Taylor expanded in eps around inf 97.1%
Taylor expanded in x around 0 90.9%
if 8e11 < x < 5.5e72Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 2.4%
Taylor expanded in x around 0 79.2%
if 5.5e72 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 30.2%
Taylor expanded in eps around 0 30.3%
+-commutative30.3%
Simplified30.3%
Final simplification69.9%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -3900000.0)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (or (<= x 88000000000.0) (and (not (<= x 1.7e+101)) (<= x 2.6e+242)))
(/
(+ 2.0 (* x (+ -1.0 (* 0.5 (* x (+ 1.0 (* eps_m (+ eps_m 2.0))))))))
2.0)
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -3900000.0) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if ((x <= 88000000000.0) || (!(x <= 1.7e+101) && (x <= 2.6e+242))) {
tmp = (2.0 + (x * (-1.0 + (0.5 * (x * (1.0 + (eps_m * (eps_m + 2.0)))))))) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-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 <= (-3900000.0d0)) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if ((x <= 88000000000.0d0) .or. (.not. (x <= 1.7d+101)) .and. (x <= 2.6d+242)) then
tmp = (2.0d0 + (x * ((-1.0d0) + (0.5d0 * (x * (1.0d0 + (eps_m * (eps_m + 2.0d0)))))))) / 2.0d0
else
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 + ((-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 <= -3900000.0) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if ((x <= 88000000000.0) || (!(x <= 1.7e+101) && (x <= 2.6e+242))) {
tmp = (2.0 + (x * (-1.0 + (0.5 * (x * (1.0 + (eps_m * (eps_m + 2.0)))))))) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -3900000.0: tmp = (1.0 + math.exp(-x)) / 2.0 elif (x <= 88000000000.0) or (not (x <= 1.7e+101) and (x <= 2.6e+242)): tmp = (2.0 + (x * (-1.0 + (0.5 * (x * (1.0 + (eps_m * (eps_m + 2.0)))))))) / 2.0 else: tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -3900000.0) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif ((x <= 88000000000.0) || (!(x <= 1.7e+101) && (x <= 2.6e+242))) tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(0.5 * Float64(x * Float64(1.0 + Float64(eps_m * Float64(eps_m + 2.0)))))))) / 2.0); else tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + 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 <= -3900000.0) tmp = (1.0 + exp(-x)) / 2.0; elseif ((x <= 88000000000.0) || (~((x <= 1.7e+101)) && (x <= 2.6e+242))) tmp = (2.0 + (x * (-1.0 + (0.5 * (x * (1.0 + (eps_m * (eps_m + 2.0)))))))) / 2.0; else tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-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, -3900000.0], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 88000000000.0], And[N[Not[LessEqual[x, 1.7e+101]], $MachinePrecision], LessEqual[x, 2.6e+242]]], N[(N[(2.0 + N[(x * N[(-1.0 + N[(0.5 * N[(x * N[(1.0 + N[(eps$95$m * N[(eps$95$m + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3900000:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 88000000000 \lor \neg \left(x \leq 1.7 \cdot 10^{+101}\right) \land x \leq 2.6 \cdot 10^{+242}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + 0.5 \cdot \left(x \cdot \left(1 + eps\_m \cdot \left(eps\_m + 2\right)\right)\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\end{array}
\end{array}
if x < -3.9e6Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 41.7%
Taylor expanded in eps around inf 70.3%
Taylor expanded in eps around 0 100.0%
sub-neg100.0%
distribute-rgt1-in100.0%
metadata-eval100.0%
mul0-lft100.0%
metadata-eval100.0%
mul-1-neg100.0%
remove-double-neg100.0%
neg-mul-1100.0%
Simplified100.0%
if -3.9e6 < x < 8.8e10 or 1.70000000000000009e101 < x < 2.5999999999999998e242Initial program 60.0%
Simplified60.0%
Taylor expanded in x around 0 39.8%
Taylor expanded in eps around inf 79.6%
Taylor expanded in x around 0 85.7%
Taylor expanded in eps around 0 85.7%
if 8.8e10 < x < 1.70000000000000009e101 or 2.5999999999999998e242 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 17.9%
Taylor expanded in x around 0 64.8%
Final simplification84.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (or (<= x 820.0) (and (not (<= x 9.2e+108)) (<= x 7.4e+241))) (/ (+ 2.0 (* x (+ -1.0 (* 0.5 (* x (+ 1.0 (* eps_m (+ eps_m 2.0)))))))) 2.0) (/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if ((x <= 820.0) || (!(x <= 9.2e+108) && (x <= 7.4e+241))) {
tmp = (2.0 + (x * (-1.0 + (0.5 * (x * (1.0 + (eps_m * (eps_m + 2.0)))))))) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-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 <= 820.0d0) .or. (.not. (x <= 9.2d+108)) .and. (x <= 7.4d+241)) then
tmp = (2.0d0 + (x * ((-1.0d0) + (0.5d0 * (x * (1.0d0 + (eps_m * (eps_m + 2.0d0)))))))) / 2.0d0
else
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 + ((-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 <= 820.0) || (!(x <= 9.2e+108) && (x <= 7.4e+241))) {
tmp = (2.0 + (x * (-1.0 + (0.5 * (x * (1.0 + (eps_m * (eps_m + 2.0)))))))) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if (x <= 820.0) or (not (x <= 9.2e+108) and (x <= 7.4e+241)): tmp = (2.0 + (x * (-1.0 + (0.5 * (x * (1.0 + (eps_m * (eps_m + 2.0)))))))) / 2.0 else: tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if ((x <= 820.0) || (!(x <= 9.2e+108) && (x <= 7.4e+241))) tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(0.5 * Float64(x * Float64(1.0 + Float64(eps_m * Float64(eps_m + 2.0)))))))) / 2.0); else tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + 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 <= 820.0) || (~((x <= 9.2e+108)) && (x <= 7.4e+241))) tmp = (2.0 + (x * (-1.0 + (0.5 * (x * (1.0 + (eps_m * (eps_m + 2.0)))))))) / 2.0; else tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[Or[LessEqual[x, 820.0], And[N[Not[LessEqual[x, 9.2e+108]], $MachinePrecision], LessEqual[x, 7.4e+241]]], N[(N[(2.0 + N[(x * N[(-1.0 + N[(0.5 * N[(x * N[(1.0 + N[(eps$95$m * N[(eps$95$m + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 820 \lor \neg \left(x \leq 9.2 \cdot 10^{+108}\right) \land x \leq 7.4 \cdot 10^{+241}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + 0.5 \cdot \left(x \cdot \left(1 + eps\_m \cdot \left(eps\_m + 2\right)\right)\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\end{array}
\end{array}
if x < 820 or 9.1999999999999996e108 < x < 7.3999999999999995e241Initial program 66.6%
Simplified66.6%
Taylor expanded in x around 0 40.1%
Taylor expanded in eps around inf 78.1%
Taylor expanded in x around 0 84.5%
Taylor expanded in eps around 0 84.5%
if 820 < x < 9.1999999999999996e108 or 7.3999999999999995e241 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 17.9%
Taylor expanded in x around 0 64.8%
Final simplification81.1%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (or (<= x 510.0) (and (not (<= x 1.6e+106)) (<= x 1.6e+242))) (/ (+ 2.0 (* x (+ -1.0 (* x (+ eps_m 0.5))))) 2.0) (/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if ((x <= 510.0) || (!(x <= 1.6e+106) && (x <= 1.6e+242))) {
tmp = (2.0 + (x * (-1.0 + (x * (eps_m + 0.5))))) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-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 <= 510.0d0) .or. (.not. (x <= 1.6d+106)) .and. (x <= 1.6d+242)) then
tmp = (2.0d0 + (x * ((-1.0d0) + (x * (eps_m + 0.5d0))))) / 2.0d0
else
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 + ((-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 <= 510.0) || (!(x <= 1.6e+106) && (x <= 1.6e+242))) {
tmp = (2.0 + (x * (-1.0 + (x * (eps_m + 0.5))))) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if (x <= 510.0) or (not (x <= 1.6e+106) and (x <= 1.6e+242)): tmp = (2.0 + (x * (-1.0 + (x * (eps_m + 0.5))))) / 2.0 else: tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if ((x <= 510.0) || (!(x <= 1.6e+106) && (x <= 1.6e+242))) tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(x * Float64(eps_m + 0.5))))) / 2.0); else tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + 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 <= 510.0) || (~((x <= 1.6e+106)) && (x <= 1.6e+242))) tmp = (2.0 + (x * (-1.0 + (x * (eps_m + 0.5))))) / 2.0; else tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[Or[LessEqual[x, 510.0], And[N[Not[LessEqual[x, 1.6e+106]], $MachinePrecision], LessEqual[x, 1.6e+242]]], N[(N[(2.0 + N[(x * N[(-1.0 + N[(x * N[(eps$95$m + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 510 \lor \neg \left(x \leq 1.6 \cdot 10^{+106}\right) \land x \leq 1.6 \cdot 10^{+242}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + x \cdot \left(eps\_m + 0.5\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\end{array}
\end{array}
if x < 510 or 1.5999999999999999e106 < x < 1.6000000000000001e242Initial program 66.6%
Simplified66.6%
Taylor expanded in x around 0 40.1%
Taylor expanded in eps around inf 78.1%
Taylor expanded in x around 0 84.5%
Taylor expanded in eps around 0 63.5%
sub-neg63.5%
distribute-rgt-out63.5%
metadata-eval63.5%
Simplified63.5%
if 510 < x < 1.5999999999999999e106 or 1.6000000000000001e242 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 17.9%
Taylor expanded in x around 0 64.8%
Final simplification63.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -0.0055) (/ (* eps_m x) (- 2.0)) (if (<= x 31.0) 1.0 (/ (* eps_m x) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -0.0055) {
tmp = (eps_m * x) / -2.0;
} else if (x <= 31.0) {
tmp = 1.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 <= (-0.0055d0)) then
tmp = (eps_m * x) / -2.0d0
else if (x <= 31.0d0) then
tmp = 1.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 <= -0.0055) {
tmp = (eps_m * x) / -2.0;
} else if (x <= 31.0) {
tmp = 1.0;
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -0.0055: tmp = (eps_m * x) / -2.0 elif x <= 31.0: tmp = 1.0 else: tmp = (eps_m * x) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -0.0055) tmp = Float64(Float64(eps_m * x) / Float64(-2.0)); elseif (x <= 31.0) tmp = 1.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 <= -0.0055) tmp = (eps_m * x) / -2.0; elseif (x <= 31.0) tmp = 1.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, -0.0055], N[(N[(eps$95$m * x), $MachinePrecision] / (-2.0)), $MachinePrecision], If[LessEqual[x, 31.0], 1.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 -0.0055:\\
\;\;\;\;\frac{eps\_m \cdot x}{-2}\\
\mathbf{elif}\;x \leq 31:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{eps\_m \cdot x}{2}\\
\end{array}
\end{array}
if x < -0.0054999999999999997Initial program 97.3%
Simplified97.3%
Taylor expanded in x around 0 58.1%
Taylor expanded in x around 0 29.0%
Taylor expanded in eps around inf 28.9%
mul-1-neg28.9%
distribute-rgt-neg-out28.9%
Simplified28.9%
if -0.0054999999999999997 < x < 31Initial program 54.0%
Simplified54.0%
Taylor expanded in x around 0 74.2%
if 31 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 18.3%
Taylor expanded in x around inf 13.8%
mul-1-neg13.8%
distribute-rgt-neg-in13.8%
*-commutative13.8%
distribute-rgt-neg-in13.8%
neg-mul-113.8%
distribute-rgt-in13.8%
metadata-eval13.8%
associate-*l/13.8%
metadata-eval13.8%
Simplified13.8%
Taylor expanded in eps around inf 14.6%
Final simplification52.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ 2.0 (* x (+ -1.0 (* x (+ eps_m 0.5))))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (2.0 + (x * (-1.0 + (x * (eps_m + 0.5))))) / 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 = (2.0d0 + (x * ((-1.0d0) + (x * (eps_m + 0.5d0))))) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return (2.0 + (x * (-1.0 + (x * (eps_m + 0.5))))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (2.0 + (x * (-1.0 + (x * (eps_m + 0.5))))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(x * Float64(eps_m + 0.5))))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (2.0 + (x * (-1.0 + (x * (eps_m + 0.5))))) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(2.0 + N[(x * N[(-1.0 + N[(x * N[(eps$95$m + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\frac{2 + x \cdot \left(-1 + x \cdot \left(eps\_m + 0.5\right)\right)}{2}
\end{array}
Initial program 72.3%
Simplified72.3%
Taylor expanded in x around 0 35.5%
Taylor expanded in eps around inf 69.3%
Taylor expanded in x around 0 76.1%
Taylor expanded in eps around 0 55.2%
sub-neg55.2%
distribute-rgt-out55.2%
metadata-eval55.2%
Simplified55.2%
Final simplification55.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 11.2) (/ (- 2.0 (* eps_m x)) 2.0) (/ (* eps_m x) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 11.2) {
tmp = (2.0 - (eps_m * x)) / 2.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 <= 11.2d0) then
tmp = (2.0d0 - (eps_m * x)) / 2.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 <= 11.2) {
tmp = (2.0 - (eps_m * x)) / 2.0;
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 11.2: tmp = (2.0 - (eps_m * x)) / 2.0 else: tmp = (eps_m * x) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 11.2) tmp = Float64(Float64(2.0 - Float64(eps_m * x)) / 2.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 <= 11.2) tmp = (2.0 - (eps_m * x)) / 2.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, 11.2], N[(N[(2.0 - N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 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 11.2:\\
\;\;\;\;\frac{2 - eps\_m \cdot x}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{eps\_m \cdot x}{2}\\
\end{array}
\end{array}
if x < 11.199999999999999Initial program 62.5%
Simplified62.5%
Taylor expanded in x around 0 44.0%
Taylor expanded in x around 0 29.5%
Taylor expanded in eps around -inf 64.9%
associate-*r*64.9%
distribute-lft-out--64.9%
associate-*r*64.9%
mul-1-neg64.9%
distribute-lft-neg-in64.9%
*-commutative64.9%
mul-1-neg64.9%
remove-double-neg64.9%
Simplified64.9%
Taylor expanded in eps around 0 65.0%
mul-1-neg65.0%
unsub-neg65.0%
*-commutative65.0%
Simplified65.0%
if 11.199999999999999 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 18.3%
Taylor expanded in x around inf 13.8%
mul-1-neg13.8%
distribute-rgt-neg-in13.8%
*-commutative13.8%
distribute-rgt-neg-in13.8%
neg-mul-113.8%
distribute-rgt-in13.8%
metadata-eval13.8%
associate-*l/13.8%
metadata-eval13.8%
Simplified13.8%
Taylor expanded in eps around inf 14.6%
Final simplification51.8%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ 2.0 (* x (+ -1.0 (* x 0.5)))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (2.0 + (x * (-1.0 + (x * 0.5)))) / 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 = (2.0d0 + (x * ((-1.0d0) + (x * 0.5d0)))) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(x * 0.5)))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := 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|
\\
\frac{2 + x \cdot \left(-1 + x \cdot 0.5\right)}{2}
\end{array}
Initial program 72.3%
Simplified72.3%
Taylor expanded in x around 0 35.5%
Taylor expanded in eps around inf 69.3%
Taylor expanded in x around 0 76.1%
Taylor expanded in eps around 0 58.1%
Final simplification58.1%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 24.5) 1.0 (/ (* eps_m x) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 24.5) {
tmp = 1.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 <= 24.5d0) then
tmp = 1.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 <= 24.5) {
tmp = 1.0;
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 24.5: tmp = 1.0 else: tmp = (eps_m * x) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 24.5) tmp = 1.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 <= 24.5) tmp = 1.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, 24.5], 1.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 24.5:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{eps\_m \cdot x}{2}\\
\end{array}
\end{array}
if x < 24.5Initial program 62.5%
Simplified62.5%
Taylor expanded in x around 0 60.2%
if 24.5 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 18.3%
Taylor expanded in x around inf 13.8%
mul-1-neg13.8%
distribute-rgt-neg-in13.8%
*-commutative13.8%
distribute-rgt-neg-in13.8%
neg-mul-113.8%
distribute-rgt-in13.8%
metadata-eval13.8%
associate-*l/13.8%
metadata-eval13.8%
Simplified13.8%
Taylor expanded in eps around inf 14.6%
Final simplification48.3%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 1.0)
eps_m = fabs(eps);
double code(double x, double eps_m) {
return 1.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = 1.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return 1.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return 1.0
eps_m = abs(eps) function code(x, eps_m) return 1.0 end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = 1.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := 1.0
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
1
\end{array}
Initial program 72.3%
Simplified72.3%
Taylor expanded in x around 0 45.3%
Final simplification45.3%
herbie shell --seed 2024079
(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))