
(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 15 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 5e-12) (/ (* (exp (- x)) (+ 2.0 (* x 2.0))) 2.0) (/ (+ (exp (* x (+ -1.0 eps_m))) (exp (* eps_m (- x)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 5e-12) {
tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0;
} else {
tmp = (exp((x * (-1.0 + eps_m))) + exp((eps_m * -x))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (eps_m <= 5d-12) then
tmp = (exp(-x) * (2.0d0 + (x * 2.0d0))) / 2.0d0
else
tmp = (exp((x * ((-1.0d0) + eps_m))) + exp((eps_m * -x))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (eps_m <= 5e-12) {
tmp = (Math.exp(-x) * (2.0 + (x * 2.0))) / 2.0;
} else {
tmp = (Math.exp((x * (-1.0 + eps_m))) + Math.exp((eps_m * -x))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 5e-12: tmp = (math.exp(-x) * (2.0 + (x * 2.0))) / 2.0 else: tmp = (math.exp((x * (-1.0 + eps_m))) + math.exp((eps_m * -x))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 5e-12) tmp = Float64(Float64(exp(Float64(-x)) * Float64(2.0 + Float64(x * 2.0))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(-1.0 + eps_m))) + exp(Float64(eps_m * Float64(-x)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 5e-12) tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0; else tmp = (exp((x * (-1.0 + eps_m))) + exp((eps_m * -x))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 5e-12], N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 5 \cdot 10^{-12}:\\
\;\;\;\;\frac{e^{-x} \cdot \left(2 + x \cdot 2\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(-1 + eps\_m\right)} + e^{eps\_m \cdot \left(-x\right)}}{2}\\
\end{array}
\end{array}
if eps < 4.9999999999999997e-12Initial program 64.3%
Simplified56.4%
Taylor expanded in eps around 0 30.8%
Simplified67.4%
Taylor expanded in eps around 0 67.4%
if 4.9999999999999997e-12 < eps Initial program 100.0%
Simplified80.1%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
associate-*r*100.0%
neg-mul-1100.0%
Simplified100.0%
Final simplification76.8%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* x (- -1.0 eps_m))) (exp (* x (+ -1.0 eps_m)))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * (-1.0 - eps_m))) + exp((x * (-1.0 + eps_m)))) / 2.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = (exp((x * ((-1.0d0) - eps_m))) + exp((x * ((-1.0d0) + eps_m)))) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return (Math.exp((x * (-1.0 - eps_m))) + Math.exp((x * (-1.0 + eps_m)))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.exp((x * (-1.0 - eps_m))) + math.exp((x * (-1.0 + eps_m)))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(exp(Float64(x * Float64(-1.0 - eps_m))) + exp(Float64(x * Float64(-1.0 + eps_m)))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((x * (-1.0 - eps_m))) + exp((x * (-1.0 + eps_m)))) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\frac{e^{x \cdot \left(-1 - eps\_m\right)} + e^{x \cdot \left(-1 + eps\_m\right)}}{2}
\end{array}
Initial program 74.6%
Simplified63.2%
Taylor expanded in eps around inf 98.7%
Final simplification98.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1.4e-209)
(/ (+ 1.0 (exp (* eps_m (- x)))) 2.0)
(if (or (<= x 9.8e+60) (not (<= x 5.8e+175)))
(/ (+ 1.0 (exp (* x (+ -1.0 eps_m)))) 2.0)
(/ (* (exp (- x)) (+ 2.0 (* x 2.0))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.4e-209) {
tmp = (1.0 + exp((eps_m * -x))) / 2.0;
} else if ((x <= 9.8e+60) || !(x <= 5.8e+175)) {
tmp = (1.0 + exp((x * (-1.0 + eps_m)))) / 2.0;
} else {
tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-1.4d-209)) then
tmp = (1.0d0 + exp((eps_m * -x))) / 2.0d0
else if ((x <= 9.8d+60) .or. (.not. (x <= 5.8d+175))) then
tmp = (1.0d0 + exp((x * ((-1.0d0) + eps_m)))) / 2.0d0
else
tmp = (exp(-x) * (2.0d0 + (x * 2.0d0))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1.4e-209) {
tmp = (1.0 + Math.exp((eps_m * -x))) / 2.0;
} else if ((x <= 9.8e+60) || !(x <= 5.8e+175)) {
tmp = (1.0 + Math.exp((x * (-1.0 + eps_m)))) / 2.0;
} else {
tmp = (Math.exp(-x) * (2.0 + (x * 2.0))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.4e-209: tmp = (1.0 + math.exp((eps_m * -x))) / 2.0 elif (x <= 9.8e+60) or not (x <= 5.8e+175): tmp = (1.0 + math.exp((x * (-1.0 + eps_m)))) / 2.0 else: tmp = (math.exp(-x) * (2.0 + (x * 2.0))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.4e-209) tmp = Float64(Float64(1.0 + exp(Float64(eps_m * Float64(-x)))) / 2.0); elseif ((x <= 9.8e+60) || !(x <= 5.8e+175)) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 + eps_m)))) / 2.0); else tmp = Float64(Float64(exp(Float64(-x)) * Float64(2.0 + Float64(x * 2.0))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.4e-209) tmp = (1.0 + exp((eps_m * -x))) / 2.0; elseif ((x <= 9.8e+60) || ~((x <= 5.8e+175))) tmp = (1.0 + exp((x * (-1.0 + eps_m)))) / 2.0; else tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.4e-209], N[(N[(1.0 + N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 9.8e+60], N[Not[LessEqual[x, 5.8e+175]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{-209}:\\
\;\;\;\;\frac{1 + e^{eps\_m \cdot \left(-x\right)}}{2}\\
\mathbf{elif}\;x \leq 9.8 \cdot 10^{+60} \lor \neg \left(x \leq 5.8 \cdot 10^{+175}\right):\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 + eps\_m\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{-x} \cdot \left(2 + x \cdot 2\right)}{2}\\
\end{array}
\end{array}
if x < -1.40000000000000006e-209Initial program 77.7%
Simplified77.7%
Taylor expanded in x around 0 43.8%
Taylor expanded in eps around inf 65.7%
mul-1-neg65.7%
associate-*r*65.7%
remove-double-neg65.7%
mul-1-neg65.7%
sub-neg65.7%
associate-*r*65.7%
mul-1-neg65.7%
distribute-rgt-neg-in65.7%
cancel-sign-sub-inv65.7%
metadata-eval65.7%
*-lft-identity65.7%
+-commutative65.7%
Simplified65.7%
Taylor expanded in eps around inf 66.0%
associate-*r*66.0%
neg-mul-166.0%
Simplified66.0%
if -1.40000000000000006e-209 < x < 9.8000000000000005e60 or 5.8e175 < x Initial program 64.9%
Simplified49.3%
Taylor expanded in eps around inf 98.1%
Taylor expanded in x around 0 75.3%
if 9.8000000000000005e60 < x < 5.8e175Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 64.2%
Simplified64.2%
Taylor expanded in eps around 0 64.2%
Final simplification70.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (* x (+ -1.0 eps_m)))))
(if (<= x -1.4e-209)
(/ (+ 1.0 (exp (* eps_m (- x)))) 2.0)
(if (<= x 8.2e+60)
(/ (+ t_0 (- 1.0 (* x eps_m))) 2.0)
(if (<= x 1.22e+176)
(/ (* (exp (- x)) (+ 2.0 (* x 2.0))) 2.0)
(/ (+ 1.0 t_0) 2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * (-1.0 + eps_m)));
double tmp;
if (x <= -1.4e-209) {
tmp = (1.0 + exp((eps_m * -x))) / 2.0;
} else if (x <= 8.2e+60) {
tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0;
} else if (x <= 1.22e+176) {
tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0;
} else {
tmp = (1.0 + t_0) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: tmp
t_0 = exp((x * ((-1.0d0) + eps_m)))
if (x <= (-1.4d-209)) then
tmp = (1.0d0 + exp((eps_m * -x))) / 2.0d0
else if (x <= 8.2d+60) then
tmp = (t_0 + (1.0d0 - (x * eps_m))) / 2.0d0
else if (x <= 1.22d+176) then
tmp = (exp(-x) * (2.0d0 + (x * 2.0d0))) / 2.0d0
else
tmp = (1.0d0 + t_0) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = Math.exp((x * (-1.0 + eps_m)));
double tmp;
if (x <= -1.4e-209) {
tmp = (1.0 + Math.exp((eps_m * -x))) / 2.0;
} else if (x <= 8.2e+60) {
tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0;
} else if (x <= 1.22e+176) {
tmp = (Math.exp(-x) * (2.0 + (x * 2.0))) / 2.0;
} else {
tmp = (1.0 + t_0) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * (-1.0 + eps_m))) tmp = 0 if x <= -1.4e-209: tmp = (1.0 + math.exp((eps_m * -x))) / 2.0 elif x <= 8.2e+60: tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0 elif x <= 1.22e+176: tmp = (math.exp(-x) * (2.0 + (x * 2.0))) / 2.0 else: tmp = (1.0 + t_0) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * Float64(-1.0 + eps_m))) tmp = 0.0 if (x <= -1.4e-209) tmp = Float64(Float64(1.0 + exp(Float64(eps_m * Float64(-x)))) / 2.0); elseif (x <= 8.2e+60) tmp = Float64(Float64(t_0 + Float64(1.0 - Float64(x * eps_m))) / 2.0); elseif (x <= 1.22e+176) tmp = Float64(Float64(exp(Float64(-x)) * Float64(2.0 + Float64(x * 2.0))) / 2.0); else tmp = Float64(Float64(1.0 + t_0) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp((x * (-1.0 + eps_m))); tmp = 0.0; if (x <= -1.4e-209) tmp = (1.0 + exp((eps_m * -x))) / 2.0; elseif (x <= 8.2e+60) tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0; elseif (x <= 1.22e+176) tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0; else tmp = (1.0 + t_0) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -1.4e-209], N[(N[(1.0 + N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 8.2e+60], N[(N[(t$95$0 + N[(1.0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.22e+176], N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(-1 + eps\_m\right)}\\
\mathbf{if}\;x \leq -1.4 \cdot 10^{-209}:\\
\;\;\;\;\frac{1 + e^{eps\_m \cdot \left(-x\right)}}{2}\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{+60}:\\
\;\;\;\;\frac{t\_0 + \left(1 - x \cdot eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 1.22 \cdot 10^{+176}:\\
\;\;\;\;\frac{e^{-x} \cdot \left(2 + x \cdot 2\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + t\_0}{2}\\
\end{array}
\end{array}
if x < -1.40000000000000006e-209Initial program 77.7%
Simplified77.7%
Taylor expanded in x around 0 43.8%
Taylor expanded in eps around inf 65.7%
mul-1-neg65.7%
associate-*r*65.7%
remove-double-neg65.7%
mul-1-neg65.7%
sub-neg65.7%
associate-*r*65.7%
mul-1-neg65.7%
distribute-rgt-neg-in65.7%
cancel-sign-sub-inv65.7%
metadata-eval65.7%
*-lft-identity65.7%
+-commutative65.7%
Simplified65.7%
Taylor expanded in eps around inf 66.0%
associate-*r*66.0%
neg-mul-166.0%
Simplified66.0%
if -1.40000000000000006e-209 < x < 8.2e60Initial program 56.4%
Simplified37.0%
Taylor expanded in eps around inf 97.7%
Taylor expanded in eps around inf 96.0%
*-commutative96.0%
Simplified96.0%
Taylor expanded in x around 0 84.6%
mul-1-neg84.6%
*-commutative84.6%
unsub-neg84.6%
*-commutative84.6%
Simplified84.6%
if 8.2e60 < x < 1.2199999999999999e176Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 64.2%
Simplified64.2%
Taylor expanded in eps around 0 64.2%
if 1.2199999999999999e176 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 39.0%
Final simplification70.9%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1.4e-209)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (or (<= x 1.35e+59) (not (<= x 5e+175)))
(/ (+ 1.0 (exp (* x (+ -1.0 eps_m)))) 2.0)
0.0)))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.4e-209) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if ((x <= 1.35e+59) || !(x <= 5e+175)) {
tmp = (1.0 + exp((x * (-1.0 + eps_m)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-1.4d-209)) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if ((x <= 1.35d+59) .or. (.not. (x <= 5d+175))) then
tmp = (1.0d0 + exp((x * ((-1.0d0) + eps_m)))) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1.4e-209) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if ((x <= 1.35e+59) || !(x <= 5e+175)) {
tmp = (1.0 + Math.exp((x * (-1.0 + eps_m)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.4e-209: tmp = (1.0 + math.exp(-x)) / 2.0 elif (x <= 1.35e+59) or not (x <= 5e+175): tmp = (1.0 + math.exp((x * (-1.0 + eps_m)))) / 2.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.4e-209) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif ((x <= 1.35e+59) || !(x <= 5e+175)) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 + eps_m)))) / 2.0); else tmp = 0.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.4e-209) tmp = (1.0 + exp(-x)) / 2.0; elseif ((x <= 1.35e+59) || ~((x <= 5e+175))) tmp = (1.0 + exp((x * (-1.0 + eps_m)))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.4e-209], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 1.35e+59], N[Not[LessEqual[x, 5e+175]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{-209}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{+59} \lor \neg \left(x \leq 5 \cdot 10^{+175}\right):\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 + eps\_m\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -1.40000000000000006e-209Initial program 77.7%
Simplified67.3%
Taylor expanded in eps around inf 99.0%
Taylor expanded in eps around inf 99.1%
*-commutative99.1%
Simplified99.1%
Taylor expanded in eps around 0 72.4%
neg-mul-172.4%
Simplified72.4%
if -1.40000000000000006e-209 < x < 1.3500000000000001e59 or 5e175 < x Initial program 64.9%
Simplified49.3%
Taylor expanded in eps around inf 98.1%
Taylor expanded in x around 0 75.3%
if 1.3500000000000001e59 < x < 5e175Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 64.2%
mul-1-neg64.2%
mul-1-neg64.2%
rec-exp64.2%
sub-neg64.2%
div-sub64.2%
mul-1-neg64.2%
rec-exp64.2%
+-inverses64.2%
Simplified64.2%
Final simplification72.5%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1.4e-209)
(/ (+ 1.0 (exp (* eps_m (- x)))) 2.0)
(if (or (<= x 4e+60) (not (<= x 3.6e+175)))
(/ (+ 1.0 (exp (* x (+ -1.0 eps_m)))) 2.0)
0.0)))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.4e-209) {
tmp = (1.0 + exp((eps_m * -x))) / 2.0;
} else if ((x <= 4e+60) || !(x <= 3.6e+175)) {
tmp = (1.0 + exp((x * (-1.0 + eps_m)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-1.4d-209)) then
tmp = (1.0d0 + exp((eps_m * -x))) / 2.0d0
else if ((x <= 4d+60) .or. (.not. (x <= 3.6d+175))) then
tmp = (1.0d0 + exp((x * ((-1.0d0) + eps_m)))) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1.4e-209) {
tmp = (1.0 + Math.exp((eps_m * -x))) / 2.0;
} else if ((x <= 4e+60) || !(x <= 3.6e+175)) {
tmp = (1.0 + Math.exp((x * (-1.0 + eps_m)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.4e-209: tmp = (1.0 + math.exp((eps_m * -x))) / 2.0 elif (x <= 4e+60) or not (x <= 3.6e+175): tmp = (1.0 + math.exp((x * (-1.0 + eps_m)))) / 2.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.4e-209) tmp = Float64(Float64(1.0 + exp(Float64(eps_m * Float64(-x)))) / 2.0); elseif ((x <= 4e+60) || !(x <= 3.6e+175)) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 + eps_m)))) / 2.0); else tmp = 0.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.4e-209) tmp = (1.0 + exp((eps_m * -x))) / 2.0; elseif ((x <= 4e+60) || ~((x <= 3.6e+175))) tmp = (1.0 + exp((x * (-1.0 + eps_m)))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.4e-209], N[(N[(1.0 + N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 4e+60], N[Not[LessEqual[x, 3.6e+175]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{-209}:\\
\;\;\;\;\frac{1 + e^{eps\_m \cdot \left(-x\right)}}{2}\\
\mathbf{elif}\;x \leq 4 \cdot 10^{+60} \lor \neg \left(x \leq 3.6 \cdot 10^{+175}\right):\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 + eps\_m\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -1.40000000000000006e-209Initial program 77.7%
Simplified77.7%
Taylor expanded in x around 0 43.8%
Taylor expanded in eps around inf 65.7%
mul-1-neg65.7%
associate-*r*65.7%
remove-double-neg65.7%
mul-1-neg65.7%
sub-neg65.7%
associate-*r*65.7%
mul-1-neg65.7%
distribute-rgt-neg-in65.7%
cancel-sign-sub-inv65.7%
metadata-eval65.7%
*-lft-identity65.7%
+-commutative65.7%
Simplified65.7%
Taylor expanded in eps around inf 66.0%
associate-*r*66.0%
neg-mul-166.0%
Simplified66.0%
if -1.40000000000000006e-209 < x < 3.9999999999999998e60 or 3.60000000000000034e175 < x Initial program 64.9%
Simplified49.3%
Taylor expanded in eps around inf 98.1%
Taylor expanded in x around 0 75.3%
if 3.9999999999999998e60 < x < 3.60000000000000034e175Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 64.2%
mul-1-neg64.2%
mul-1-neg64.2%
rec-exp64.2%
sub-neg64.2%
div-sub64.2%
mul-1-neg64.2%
rec-exp64.2%
+-inverses64.2%
Simplified64.2%
Final simplification70.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 125.0)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (<= x 5e+59)
(/ (* (* x 2.0) (exp x)) 2.0)
(if (<= x 1e+176) 0.0 (/ (* x (+ 2.0 (* x (- x 2.0)))) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 125.0) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 5e+59) {
tmp = ((x * 2.0) * exp(x)) / 2.0;
} else if (x <= 1e+176) {
tmp = 0.0;
} else {
tmp = (x * (2.0 + (x * (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 <= 125.0d0) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= 5d+59) then
tmp = ((x * 2.0d0) * exp(x)) / 2.0d0
else if (x <= 1d+176) then
tmp = 0.0d0
else
tmp = (x * (2.0d0 + (x * (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 <= 125.0) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 5e+59) {
tmp = ((x * 2.0) * Math.exp(x)) / 2.0;
} else if (x <= 1e+176) {
tmp = 0.0;
} else {
tmp = (x * (2.0 + (x * (x - 2.0)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 125.0: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 5e+59: tmp = ((x * 2.0) * math.exp(x)) / 2.0 elif x <= 1e+176: tmp = 0.0 else: tmp = (x * (2.0 + (x * (x - 2.0)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 125.0) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 5e+59) tmp = Float64(Float64(Float64(x * 2.0) * exp(x)) / 2.0); elseif (x <= 1e+176) tmp = 0.0; else tmp = Float64(Float64(x * Float64(2.0 + Float64(x * Float64(x - 2.0)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 125.0) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= 5e+59) tmp = ((x * 2.0) * exp(x)) / 2.0; elseif (x <= 1e+176) tmp = 0.0; else tmp = (x * (2.0 + (x * (x - 2.0)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 125.0], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5e+59], N[(N[(N[(x * 2.0), $MachinePrecision] * N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1e+176], 0.0, N[(N[(x * N[(2.0 + N[(x * N[(x - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 125:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+59}:\\
\;\;\;\;\frac{\left(x \cdot 2\right) \cdot e^{x}}{2}\\
\mathbf{elif}\;x \leq 10^{+176}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(2 + x \cdot \left(x - 2\right)\right)}{2}\\
\end{array}
\end{array}
if x < 125Initial program 61.3%
Simplified44.0%
Taylor expanded in eps around inf 98.1%
Taylor expanded in eps around inf 98.1%
*-commutative98.1%
Simplified98.1%
Taylor expanded in eps around 0 76.9%
neg-mul-176.9%
Simplified76.9%
if 125 < x < 4.9999999999999997e59Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 13.1%
Simplified13.1%
Taylor expanded in x around inf 13.1%
associate-*r*13.1%
*-commutative13.1%
Simplified13.1%
pow113.1%
*-commutative13.1%
associate-*r*13.1%
add-sqr-sqrt0.0%
sqrt-unprod88.4%
sqr-neg88.4%
sqrt-unprod88.4%
add-sqr-sqrt88.4%
Applied egg-rr88.4%
unpow188.4%
associate-*l*88.4%
Simplified88.4%
if 4.9999999999999997e59 < x < 1e176Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 64.2%
mul-1-neg64.2%
mul-1-neg64.2%
rec-exp64.2%
sub-neg64.2%
div-sub64.2%
mul-1-neg64.2%
rec-exp64.2%
+-inverses64.2%
Simplified64.2%
if 1e176 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 30.7%
Simplified30.7%
Taylor expanded in x around inf 30.7%
associate-*r*30.7%
*-commutative30.7%
Simplified30.7%
Taylor expanded in x around 0 70.8%
Final simplification74.8%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 3600000000.0) (/ (+ 1.0 (exp (- x))) 2.0) (if (<= x 7e+175) 0.0 (/ (* x (+ 2.0 (* x (- x 2.0)))) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 3600000000.0) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 7e+175) {
tmp = 0.0;
} else {
tmp = (x * (2.0 + (x * (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 <= 3600000000.0d0) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= 7d+175) then
tmp = 0.0d0
else
tmp = (x * (2.0d0 + (x * (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 <= 3600000000.0) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 7e+175) {
tmp = 0.0;
} else {
tmp = (x * (2.0 + (x * (x - 2.0)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 3600000000.0: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 7e+175: tmp = 0.0 else: tmp = (x * (2.0 + (x * (x - 2.0)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 3600000000.0) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 7e+175) tmp = 0.0; else tmp = Float64(Float64(x * Float64(2.0 + Float64(x * Float64(x - 2.0)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 3600000000.0) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= 7e+175) tmp = 0.0; else tmp = (x * (2.0 + (x * (x - 2.0)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 3600000000.0], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 7e+175], 0.0, N[(N[(x * N[(2.0 + N[(x * N[(x - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3600000000:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 7 \cdot 10^{+175}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(2 + x \cdot \left(x - 2\right)\right)}{2}\\
\end{array}
\end{array}
if x < 3.6e9Initial program 62.2%
Simplified45.3%
Taylor expanded in eps around inf 98.1%
Taylor expanded in eps around inf 98.1%
*-commutative98.1%
Simplified98.1%
Taylor expanded in eps around 0 75.2%
neg-mul-175.2%
Simplified75.2%
if 3.6e9 < x < 7.0000000000000006e175Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 53.4%
mul-1-neg53.4%
mul-1-neg53.4%
rec-exp53.4%
sub-neg53.4%
div-sub53.4%
mul-1-neg53.4%
rec-exp53.4%
+-inverses53.4%
Simplified53.4%
if 7.0000000000000006e175 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 30.7%
Simplified30.7%
Taylor expanded in x around inf 30.7%
associate-*r*30.7%
*-commutative30.7%
Simplified30.7%
Taylor expanded in x around 0 70.8%
Final simplification69.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 2.0) (/ (+ 2.0 (* x (- -1.0 eps_m))) 2.0) (if (<= x 3.6e+175) 0.0 (/ (* x (+ 2.0 (* x (- x 2.0)))) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 2.0) {
tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0;
} else if (x <= 3.6e+175) {
tmp = 0.0;
} else {
tmp = (x * (2.0 + (x * (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 <= 2.0d0) then
tmp = (2.0d0 + (x * ((-1.0d0) - eps_m))) / 2.0d0
else if (x <= 3.6d+175) then
tmp = 0.0d0
else
tmp = (x * (2.0d0 + (x * (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 <= 2.0) {
tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0;
} else if (x <= 3.6e+175) {
tmp = 0.0;
} else {
tmp = (x * (2.0 + (x * (x - 2.0)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 2.0: tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0 elif x <= 3.6e+175: tmp = 0.0 else: tmp = (x * (2.0 + (x * (x - 2.0)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 2.0) tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 - eps_m))) / 2.0); elseif (x <= 3.6e+175) tmp = 0.0; else tmp = Float64(Float64(x * Float64(2.0 + Float64(x * Float64(x - 2.0)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 2.0) tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0; elseif (x <= 3.6e+175) tmp = 0.0; else tmp = (x * (2.0 + (x * (x - 2.0)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 2.0], N[(N[(2.0 + N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 3.6e+175], 0.0, N[(N[(x * N[(2.0 + N[(x * N[(x - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 - eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{+175}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(2 + x \cdot \left(x - 2\right)\right)}{2}\\
\end{array}
\end{array}
if x < 2Initial program 61.7%
Simplified61.7%
Taylor expanded in x around 0 39.9%
Taylor expanded in eps around inf 77.7%
mul-1-neg77.7%
associate-*r*77.7%
remove-double-neg77.7%
mul-1-neg77.7%
sub-neg77.7%
associate-*r*77.7%
mul-1-neg77.7%
distribute-rgt-neg-in77.7%
cancel-sign-sub-inv77.7%
metadata-eval77.7%
*-lft-identity77.7%
+-commutative77.7%
Simplified77.7%
Taylor expanded in x around 0 77.7%
mul-1-neg77.7%
distribute-rgt-neg-in77.7%
distribute-neg-in77.7%
metadata-eval77.7%
unsub-neg77.7%
Simplified77.7%
Taylor expanded in x around 0 66.2%
associate-*r*66.2%
neg-mul-166.2%
Simplified66.2%
if 2 < x < 3.60000000000000034e175Initial program 98.4%
Simplified98.4%
Taylor expanded in eps around 0 49.2%
mul-1-neg49.2%
mul-1-neg49.2%
rec-exp49.2%
sub-neg49.2%
div-sub49.2%
mul-1-neg49.2%
rec-exp49.2%
+-inverses49.2%
Simplified49.2%
if 3.60000000000000034e175 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 30.7%
Simplified30.7%
Taylor expanded in x around inf 30.7%
associate-*r*30.7%
*-commutative30.7%
Simplified30.7%
Taylor expanded in x around 0 70.8%
Final simplification62.6%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.4e-5) (/ (* eps_m (- (/ 1.0 eps_m) x)) 2.0) (if (<= x 3600000000.0) 1.0 0.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.4e-5) {
tmp = (eps_m * ((1.0 / eps_m) - x)) / 2.0;
} else if (x <= 3600000000.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 <= (-1.4d-5)) then
tmp = (eps_m * ((1.0d0 / eps_m) - x)) / 2.0d0
else if (x <= 3600000000.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 <= -1.4e-5) {
tmp = (eps_m * ((1.0 / eps_m) - x)) / 2.0;
} else if (x <= 3600000000.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.4e-5: tmp = (eps_m * ((1.0 / eps_m) - x)) / 2.0 elif x <= 3600000000.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.4e-5) tmp = Float64(Float64(eps_m * Float64(Float64(1.0 / eps_m) - x)) / 2.0); elseif (x <= 3600000000.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 <= -1.4e-5) tmp = (eps_m * ((1.0 / eps_m) - x)) / 2.0; elseif (x <= 3600000000.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, -1.4e-5], N[(N[(eps$95$m * N[(N[(1.0 / eps$95$m), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 3600000000.0], 1.0, 0.0]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{-5}:\\
\;\;\;\;\frac{eps\_m \cdot \left(\frac{1}{eps\_m} - x\right)}{2}\\
\mathbf{elif}\;x \leq 3600000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -1.39999999999999998e-5Initial program 99.9%
Simplified99.9%
Taylor expanded in eps around 0 43.0%
mul-1-neg43.0%
Simplified43.0%
Taylor expanded in x around 0 29.4%
Taylor expanded in eps around -inf 29.4%
associate-*r*29.4%
mul-1-neg29.4%
Simplified29.4%
if -1.39999999999999998e-5 < x < 3.6e9Initial program 54.9%
Simplified54.9%
Taylor expanded in x around 0 72.4%
if 3.6e9 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 46.1%
mul-1-neg46.1%
mul-1-neg46.1%
rec-exp46.1%
sub-neg46.1%
div-sub46.1%
mul-1-neg46.1%
rec-exp46.1%
+-inverses46.1%
Simplified46.1%
Final simplification59.1%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 2.0) (/ (+ 2.0 (* x (- -1.0 eps_m))) 2.0) 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 2.0) {
tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 2.0d0) then
tmp = (2.0d0 + (x * ((-1.0d0) - eps_m))) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 2.0) {
tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 2.0: tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 2.0) tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 - eps_m))) / 2.0); else tmp = 0.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 2.0) tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 2.0], N[(N[(2.0 + N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 - eps\_m\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2Initial program 61.7%
Simplified61.7%
Taylor expanded in x around 0 39.9%
Taylor expanded in eps around inf 77.7%
mul-1-neg77.7%
associate-*r*77.7%
remove-double-neg77.7%
mul-1-neg77.7%
sub-neg77.7%
associate-*r*77.7%
mul-1-neg77.7%
distribute-rgt-neg-in77.7%
cancel-sign-sub-inv77.7%
metadata-eval77.7%
*-lft-identity77.7%
+-commutative77.7%
Simplified77.7%
Taylor expanded in x around 0 77.7%
mul-1-neg77.7%
distribute-rgt-neg-in77.7%
distribute-neg-in77.7%
metadata-eval77.7%
unsub-neg77.7%
Simplified77.7%
Taylor expanded in x around 0 66.2%
associate-*r*66.2%
neg-mul-166.2%
Simplified66.2%
if 2 < x Initial program 98.9%
Simplified98.9%
Taylor expanded in eps around 0 43.6%
mul-1-neg43.6%
mul-1-neg43.6%
rec-exp43.6%
sub-neg43.6%
div-sub43.6%
mul-1-neg43.6%
rec-exp43.6%
+-inverses43.6%
Simplified43.6%
Final simplification58.3%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.4e-5) (* (* x eps_m) -0.5) (if (<= x 3600000000.0) 1.0 0.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.4e-5) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 3600000000.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 <= (-1.4d-5)) then
tmp = (x * eps_m) * (-0.5d0)
else if (x <= 3600000000.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 <= -1.4e-5) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 3600000000.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.4e-5: tmp = (x * eps_m) * -0.5 elif x <= 3600000000.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.4e-5) tmp = Float64(Float64(x * eps_m) * -0.5); elseif (x <= 3600000000.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 <= -1.4e-5) tmp = (x * eps_m) * -0.5; elseif (x <= 3600000000.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, -1.4e-5], N[(N[(x * eps$95$m), $MachinePrecision] * -0.5), $MachinePrecision], If[LessEqual[x, 3600000000.0], 1.0, 0.0]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{-5}:\\
\;\;\;\;\left(x \cdot eps\_m\right) \cdot -0.5\\
\mathbf{elif}\;x \leq 3600000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -1.39999999999999998e-5Initial program 99.9%
Simplified99.9%
Taylor expanded in x around 0 55.9%
Taylor expanded in eps around inf 29.4%
*-commutative29.4%
*-commutative29.4%
Simplified29.4%
if -1.39999999999999998e-5 < x < 3.6e9Initial program 54.9%
Simplified54.9%
Taylor expanded in x around 0 72.4%
if 3.6e9 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 46.1%
mul-1-neg46.1%
mul-1-neg46.1%
rec-exp46.1%
sub-neg46.1%
div-sub46.1%
mul-1-neg46.1%
rec-exp46.1%
+-inverses46.1%
Simplified46.1%
Final simplification59.1%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 3600000000.0) 0.5 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 3600000000.0) {
tmp = 0.5;
} 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 <= 3600000000.0d0) then
tmp = 0.5d0
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 <= 3600000000.0) {
tmp = 0.5;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 3600000000.0: tmp = 0.5 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 3600000000.0) tmp = 0.5; else tmp = 0.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 3600000000.0) tmp = 0.5; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 3600000000.0], 0.5, 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3600000000:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 3.6e9Initial program 62.2%
Simplified62.2%
Taylor expanded in eps around 0 22.4%
mul-1-neg22.4%
Simplified22.4%
Taylor expanded in x around 0 16.7%
Taylor expanded in x around 0 12.7%
if 3.6e9 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 46.1%
mul-1-neg46.1%
mul-1-neg46.1%
rec-exp46.1%
sub-neg46.1%
div-sub46.1%
mul-1-neg46.1%
rec-exp46.1%
+-inverses46.1%
Simplified46.1%
Final simplification23.6%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 3600000000.0) 1.0 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 3600000000.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 <= 3600000000.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 <= 3600000000.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 3600000000.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 3600000000.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 <= 3600000000.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, 3600000000.0], 1.0, 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3600000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 3.6e9Initial program 62.2%
Simplified62.2%
Taylor expanded in x around 0 61.2%
if 3.6e9 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 46.1%
mul-1-neg46.1%
mul-1-neg46.1%
rec-exp46.1%
sub-neg46.1%
div-sub46.1%
mul-1-neg46.1%
rec-exp46.1%
+-inverses46.1%
Simplified46.1%
Final simplification56.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 0.5)
eps_m = fabs(eps);
double code(double x, double eps_m) {
return 0.5;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = 0.5d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return 0.5;
}
eps_m = math.fabs(eps) def code(x, eps_m): return 0.5
eps_m = abs(eps) function code(x, eps_m) return 0.5 end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = 0.5; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := 0.5
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
0.5
\end{array}
Initial program 74.6%
Simplified74.6%
Taylor expanded in eps around 0 40.2%
mul-1-neg40.2%
Simplified40.2%
Taylor expanded in x around 0 16.3%
Taylor expanded in x around 0 9.5%
Final simplification9.5%
herbie shell --seed 2024115
(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))