
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 3.7e-6) (/ (/ (fma x 2.0 2.0) (exp x)) 2.0) (/ (+ (/ 1.0 (exp (+ x (* x eps_m)))) (exp (* x eps_m))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 3.7e-6) {
tmp = (fma(x, 2.0, 2.0) / exp(x)) / 2.0;
} else {
tmp = ((1.0 / exp((x + (x * eps_m)))) + exp((x * eps_m))) / 2.0;
}
return tmp;
}
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 3.7e-6) tmp = Float64(Float64(fma(x, 2.0, 2.0) / exp(x)) / 2.0); else tmp = Float64(Float64(Float64(1.0 / exp(Float64(x + Float64(x * eps_m)))) + exp(Float64(x * eps_m))) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 3.7e-6], N[(N[(N[(x * 2.0 + 2.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 / N[Exp[N[(x + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 3.7 \cdot 10^{-6}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(x, 2, 2\right)}{e^{x}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{e^{x + x \cdot eps\_m}} + e^{x \cdot eps\_m}}{2}\\
\end{array}
\end{array}
if eps < 3.7000000000000002e-6Initial program 61.2%
Simplified49.7%
Taylor expanded in eps around 0 29.3%
+-commutative29.3%
associate-+r+29.3%
associate-+l+67.5%
associate-*r*67.5%
distribute-rgt-out67.5%
mul-1-neg67.5%
mul-1-neg67.5%
sub-neg67.5%
+-inverses68.1%
Simplified68.1%
*-commutative68.1%
exp-neg68.1%
un-div-inv68.1%
+-commutative68.1%
*-commutative68.1%
fma-define68.1%
Applied egg-rr68.1%
if 3.7000000000000002e-6 < eps Initial program 100.0%
Simplified89.2%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification76.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 3.7e-6) (/ (/ (fma x 2.0 2.0) (exp x)) 2.0) (/ (+ (exp (* x eps_m)) (exp (* x (- eps_m)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 3.7e-6) {
tmp = (fma(x, 2.0, 2.0) / exp(x)) / 2.0;
} else {
tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0;
}
return tmp;
}
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 3.7e-6) tmp = Float64(Float64(fma(x, 2.0, 2.0) / exp(x)) / 2.0); else tmp = Float64(Float64(exp(Float64(x * eps_m)) + exp(Float64(x * Float64(-eps_m)))) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 3.7e-6], N[(N[(N[(x * 2.0 + 2.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 3.7 \cdot 10^{-6}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(x, 2, 2\right)}{e^{x}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot eps\_m} + e^{x \cdot \left(-eps\_m\right)}}{2}\\
\end{array}
\end{array}
if eps < 3.7000000000000002e-6Initial program 61.2%
Simplified49.7%
Taylor expanded in eps around 0 29.3%
+-commutative29.3%
associate-+r+29.3%
associate-+l+67.5%
associate-*r*67.5%
distribute-rgt-out67.5%
mul-1-neg67.5%
mul-1-neg67.5%
sub-neg67.5%
+-inverses68.1%
Simplified68.1%
*-commutative68.1%
exp-neg68.1%
un-div-inv68.1%
+-commutative68.1%
*-commutative68.1%
fma-define68.1%
Applied egg-rr68.1%
if 3.7000000000000002e-6 < eps Initial program 100.0%
Simplified89.2%
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%
rec-exp100.0%
distribute-rgt-out--100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification76.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* x (+ eps_m -1.0))) (/ 1.0 (exp (+ x (* x eps_m))))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * (eps_m + -1.0))) + (1.0 / exp((x + (x * eps_m))))) / 2.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = (exp((x * (eps_m + (-1.0d0)))) + (1.0d0 / exp((x + (x * eps_m))))) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return (Math.exp((x * (eps_m + -1.0))) + (1.0 / Math.exp((x + (x * eps_m))))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.exp((x * (eps_m + -1.0))) + (1.0 / math.exp((x + (x * eps_m))))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + Float64(1.0 / exp(Float64(x + Float64(x * eps_m))))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((x * (eps_m + -1.0))) + (1.0 / exp((x + (x * eps_m))))) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[Exp[N[(x + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\frac{e^{x \cdot \left(eps\_m + -1\right)} + \frac{1}{e^{x + x \cdot eps\_m}}}{2}
\end{array}
Initial program 72.0%
Simplified66.4%
Taylor expanded in eps around inf 98.7%
Final simplification98.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (or (<= x 5.8e+152) (not (<= x 1.45e+210)))
(/ (/ 2.0 (exp x)) 2.0)
(/
(+ 2.0 (* x (- (* (+ eps_m -1.0) (+ 1.0 (/ 1.0 eps_m))) (/ -1.0 eps_m))))
2.0)))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if ((x <= 5.8e+152) || !(x <= 1.45e+210)) {
tmp = (2.0 / exp(x)) / 2.0;
} else {
tmp = (2.0 + (x * (((eps_m + -1.0) * (1.0 + (1.0 / eps_m))) - (-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 <= 5.8d+152) .or. (.not. (x <= 1.45d+210))) then
tmp = (2.0d0 / exp(x)) / 2.0d0
else
tmp = (2.0d0 + (x * (((eps_m + (-1.0d0)) * (1.0d0 + (1.0d0 / eps_m))) - ((-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 <= 5.8e+152) || !(x <= 1.45e+210)) {
tmp = (2.0 / Math.exp(x)) / 2.0;
} else {
tmp = (2.0 + (x * (((eps_m + -1.0) * (1.0 + (1.0 / eps_m))) - (-1.0 / eps_m)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if (x <= 5.8e+152) or not (x <= 1.45e+210): tmp = (2.0 / math.exp(x)) / 2.0 else: tmp = (2.0 + (x * (((eps_m + -1.0) * (1.0 + (1.0 / eps_m))) - (-1.0 / eps_m)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if ((x <= 5.8e+152) || !(x <= 1.45e+210)) tmp = Float64(Float64(2.0 / exp(x)) / 2.0); else tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(eps_m + -1.0) * Float64(1.0 + Float64(1.0 / eps_m))) - 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 <= 5.8e+152) || ~((x <= 1.45e+210))) tmp = (2.0 / exp(x)) / 2.0; else tmp = (2.0 + (x * (((eps_m + -1.0) * (1.0 + (1.0 / eps_m))) - (-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, 5.8e+152], N[Not[LessEqual[x, 1.45e+210]], $MachinePrecision]], N[(N[(2.0 / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * N[(N[(N[(eps$95$m + -1.0), $MachinePrecision] * N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.8 \cdot 10^{+152} \lor \neg \left(x \leq 1.45 \cdot 10^{+210}\right):\\
\;\;\;\;\frac{\frac{2}{e^{x}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(eps\_m + -1\right) \cdot \left(1 + \frac{1}{eps\_m}\right) - \frac{-1}{eps\_m}\right)}{2}\\
\end{array}
\end{array}
if x < 5.7999999999999997e152 or 1.44999999999999996e210 < x Initial program 70.8%
Simplified65.0%
Taylor expanded in eps around inf 98.6%
Taylor expanded in eps around 0 70.8%
neg-mul-170.8%
rec-exp70.8%
count-270.8%
associate-*r/70.8%
metadata-eval70.8%
Simplified70.8%
if 5.7999999999999997e152 < x < 1.44999999999999996e210Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 3.1%
Taylor expanded in eps around 0 40.6%
Final simplification69.6%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -8.5e-292) (/ (/ 2.0 (exp x)) 2.0) (/ (+ 1.0 (exp (* x (+ eps_m -1.0)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -8.5e-292) {
tmp = (2.0 / exp(x)) / 2.0;
} else {
tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-8.5d-292)) then
tmp = (2.0d0 / exp(x)) / 2.0d0
else
tmp = (1.0d0 + exp((x * (eps_m + (-1.0d0))))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -8.5e-292) {
tmp = (2.0 / Math.exp(x)) / 2.0;
} else {
tmp = (1.0 + Math.exp((x * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -8.5e-292: tmp = (2.0 / math.exp(x)) / 2.0 else: tmp = (1.0 + math.exp((x * (eps_m + -1.0)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -8.5e-292) tmp = Float64(Float64(2.0 / exp(x)) / 2.0); else tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps_m + -1.0)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -8.5e-292) tmp = (2.0 / exp(x)) / 2.0; else tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -8.5e-292], N[(N[(2.0 / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.5 \cdot 10^{-292}:\\
\;\;\;\;\frac{\frac{2}{e^{x}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\end{array}
\end{array}
if x < -8.50000000000000066e-292Initial program 65.9%
Simplified60.1%
Taylor expanded in eps around inf 97.7%
Taylor expanded in eps around 0 82.1%
neg-mul-182.1%
rec-exp82.1%
count-282.1%
associate-*r/82.1%
metadata-eval82.1%
Simplified82.1%
if -8.50000000000000066e-292 < x Initial program 76.6%
Simplified71.3%
Taylor expanded in eps around inf 99.4%
Taylor expanded in x around 0 59.3%
Final simplification69.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -9e-292) (/ (+ 1.0 (exp (- x (* x eps_m)))) 2.0) (/ (+ 1.0 (exp (* x (+ eps_m -1.0)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -9e-292) {
tmp = (1.0 + exp((x - (x * eps_m)))) / 2.0;
} else {
tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-9d-292)) then
tmp = (1.0d0 + exp((x - (x * eps_m)))) / 2.0d0
else
tmp = (1.0d0 + exp((x * (eps_m + (-1.0d0))))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -9e-292) {
tmp = (1.0 + Math.exp((x - (x * eps_m)))) / 2.0;
} else {
tmp = (1.0 + Math.exp((x * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -9e-292: tmp = (1.0 + math.exp((x - (x * eps_m)))) / 2.0 else: tmp = (1.0 + math.exp((x * (eps_m + -1.0)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -9e-292) tmp = Float64(Float64(1.0 + exp(Float64(x - Float64(x * eps_m)))) / 2.0); else tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps_m + -1.0)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -9e-292) tmp = (1.0 + exp((x - (x * eps_m)))) / 2.0; else tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -9e-292], N[(N[(1.0 + N[Exp[N[(x - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{-292}:\\
\;\;\;\;\frac{1 + e^{x - x \cdot eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\end{array}
\end{array}
if x < -8.99999999999999913e-292Initial program 65.9%
Simplified60.1%
Taylor expanded in eps around inf 97.7%
Taylor expanded in x around 0 71.8%
sub-neg71.8%
metadata-eval71.8%
distribute-rgt-in71.8%
neg-mul-171.8%
add-sqr-sqrt71.8%
sqrt-unprod72.5%
sqr-neg72.5%
sqrt-unprod0.0%
add-sqr-sqrt71.8%
+-commutative71.8%
*-commutative71.8%
add-sqr-sqrt0.0%
sqrt-unprod72.5%
sqr-neg72.5%
sqrt-unprod74.4%
add-sqr-sqrt74.4%
cancel-sign-sub-inv74.4%
Applied egg-rr74.4%
if -8.99999999999999913e-292 < x Initial program 76.6%
Simplified71.3%
Taylor expanded in eps around inf 99.4%
Taylor expanded in x around 0 59.3%
Final simplification65.8%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1e-291) (/ (/ 2.0 (exp x)) 2.0) (/ (+ 1.0 (exp (* x eps_m))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1e-291) {
tmp = (2.0 / exp(x)) / 2.0;
} else {
tmp = (1.0 + exp((x * eps_m))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-1d-291)) then
tmp = (2.0d0 / exp(x)) / 2.0d0
else
tmp = (1.0d0 + exp((x * eps_m))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1e-291) {
tmp = (2.0 / Math.exp(x)) / 2.0;
} else {
tmp = (1.0 + Math.exp((x * eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1e-291: tmp = (2.0 / math.exp(x)) / 2.0 else: tmp = (1.0 + math.exp((x * eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1e-291) tmp = Float64(Float64(2.0 / exp(x)) / 2.0); else tmp = Float64(Float64(1.0 + exp(Float64(x * eps_m))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1e-291) tmp = (2.0 / exp(x)) / 2.0; else tmp = (1.0 + exp((x * eps_m))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1e-291], N[(N[(2.0 / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-291}:\\
\;\;\;\;\frac{\frac{2}{e^{x}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot eps\_m}}{2}\\
\end{array}
\end{array}
if x < -9.99999999999999962e-292Initial program 65.9%
Simplified60.1%
Taylor expanded in eps around inf 97.7%
Taylor expanded in eps around 0 82.1%
neg-mul-182.1%
rec-exp82.1%
count-282.1%
associate-*r/82.1%
metadata-eval82.1%
Simplified82.1%
if -9.99999999999999962e-292 < x Initial program 76.6%
Simplified71.3%
Taylor expanded in eps around inf 99.4%
Taylor expanded in eps around inf 85.2%
*-commutative85.2%
Simplified85.2%
Taylor expanded in x around 0 59.2%
Final simplification69.1%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 1.65e+33)
(/ (+ 2.0 (* x (+ x -2.0))) 2.0)
(if (<= x 5.5e+152)
0.0
(if (<= x 1.66e+208)
(/
(+
2.0
(* x (- (* (+ eps_m -1.0) (+ 1.0 (/ 1.0 eps_m))) (/ -1.0 eps_m))))
2.0)
0.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1.65e+33) {
tmp = (2.0 + (x * (x + -2.0))) / 2.0;
} else if (x <= 5.5e+152) {
tmp = 0.0;
} else if (x <= 1.66e+208) {
tmp = (2.0 + (x * (((eps_m + -1.0) * (1.0 + (1.0 / eps_m))) - (-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.65d+33) then
tmp = (2.0d0 + (x * (x + (-2.0d0)))) / 2.0d0
else if (x <= 5.5d+152) then
tmp = 0.0d0
else if (x <= 1.66d+208) then
tmp = (2.0d0 + (x * (((eps_m + (-1.0d0)) * (1.0d0 + (1.0d0 / eps_m))) - ((-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.65e+33) {
tmp = (2.0 + (x * (x + -2.0))) / 2.0;
} else if (x <= 5.5e+152) {
tmp = 0.0;
} else if (x <= 1.66e+208) {
tmp = (2.0 + (x * (((eps_m + -1.0) * (1.0 + (1.0 / eps_m))) - (-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.65e+33: tmp = (2.0 + (x * (x + -2.0))) / 2.0 elif x <= 5.5e+152: tmp = 0.0 elif x <= 1.66e+208: tmp = (2.0 + (x * (((eps_m + -1.0) * (1.0 + (1.0 / eps_m))) - (-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.65e+33) tmp = Float64(Float64(2.0 + Float64(x * Float64(x + -2.0))) / 2.0); elseif (x <= 5.5e+152) tmp = 0.0; elseif (x <= 1.66e+208) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(eps_m + -1.0) * Float64(1.0 + Float64(1.0 / eps_m))) - 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.65e+33) tmp = (2.0 + (x * (x + -2.0))) / 2.0; elseif (x <= 5.5e+152) tmp = 0.0; elseif (x <= 1.66e+208) tmp = (2.0 + (x * (((eps_m + -1.0) * (1.0 + (1.0 / eps_m))) - (-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.65e+33], N[(N[(2.0 + N[(x * N[(x + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5.5e+152], 0.0, If[LessEqual[x, 1.66e+208], N[(N[(2.0 + N[(x * N[(N[(N[(eps$95$m + -1.0), $MachinePrecision] * N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 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.65 \cdot 10^{+33}:\\
\;\;\;\;\frac{2 + x \cdot \left(x + -2\right)}{2}\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{+152}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 1.66 \cdot 10^{+208}:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(eps\_m + -1\right) \cdot \left(1 + \frac{1}{eps\_m}\right) - \frac{-1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.64999999999999988e33Initial program 64.5%
Simplified57.4%
Taylor expanded in eps around inf 98.3%
Taylor expanded in eps around 0 74.7%
neg-mul-174.7%
rec-exp74.7%
count-274.7%
associate-*r/74.7%
metadata-eval74.7%
Simplified74.7%
Taylor expanded in x around 0 67.2%
+-commutative67.2%
unpow267.2%
distribute-rgt-out67.2%
Simplified67.2%
if 1.64999999999999988e33 < x < 5.4999999999999999e152 or 1.66e208 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 53.0%
mul-1-neg53.0%
mul-1-neg53.0%
rec-exp53.0%
sub-neg53.0%
div-sub53.0%
rec-exp53.0%
mul-1-neg53.0%
+-inverses53.0%
Simplified53.0%
if 5.4999999999999999e152 < x < 1.66e208Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 3.1%
Taylor expanded in eps around 0 40.6%
Final simplification63.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1.0)
(/ (* x eps_m) (- 2.0))
(if (<= x 1.65e+33)
1.0
(if (<= x 2.9e+152)
0.0
(if (<= x 3.2e+209) (/ (+ 2.0 (* x eps_m)) 2.0) 0.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.0) {
tmp = (x * eps_m) / -2.0;
} else if (x <= 1.65e+33) {
tmp = 1.0;
} else if (x <= 2.9e+152) {
tmp = 0.0;
} else if (x <= 3.2e+209) {
tmp = (2.0 + (x * eps_m)) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-1.0d0)) then
tmp = (x * eps_m) / -2.0d0
else if (x <= 1.65d+33) then
tmp = 1.0d0
else if (x <= 2.9d+152) then
tmp = 0.0d0
else if (x <= 3.2d+209) then
tmp = (2.0d0 + (x * eps_m)) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1.0) {
tmp = (x * eps_m) / -2.0;
} else if (x <= 1.65e+33) {
tmp = 1.0;
} else if (x <= 2.9e+152) {
tmp = 0.0;
} else if (x <= 3.2e+209) {
tmp = (2.0 + (x * eps_m)) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.0: tmp = (x * eps_m) / -2.0 elif x <= 1.65e+33: tmp = 1.0 elif x <= 2.9e+152: tmp = 0.0 elif x <= 3.2e+209: tmp = (2.0 + (x * eps_m)) / 2.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.0) tmp = Float64(Float64(x * eps_m) / Float64(-2.0)); elseif (x <= 1.65e+33) tmp = 1.0; elseif (x <= 2.9e+152) tmp = 0.0; elseif (x <= 3.2e+209) tmp = Float64(Float64(2.0 + Float64(x * eps_m)) / 2.0); else tmp = 0.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.0) tmp = (x * eps_m) / -2.0; elseif (x <= 1.65e+33) tmp = 1.0; elseif (x <= 2.9e+152) tmp = 0.0; elseif (x <= 3.2e+209) tmp = (2.0 + (x * eps_m)) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.0], N[(N[(x * eps$95$m), $MachinePrecision] / (-2.0)), $MachinePrecision], If[LessEqual[x, 1.65e+33], 1.0, If[LessEqual[x, 2.9e+152], 0.0, If[LessEqual[x, 3.2e+209], N[(N[(2.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{x \cdot eps\_m}{-2}\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{+33}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{+152}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{+209}:\\
\;\;\;\;\frac{2 + x \cdot eps\_m}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -1Initial program 97.3%
Simplified97.3%
Taylor expanded in eps around inf 97.3%
Taylor expanded in x around 0 39.5%
Taylor expanded in eps around inf 23.3%
*-commutative23.3%
neg-mul-123.3%
distribute-rgt-neg-in23.3%
Simplified23.3%
if -1 < x < 1.64999999999999988e33Initial program 57.1%
Simplified57.1%
Taylor expanded in x around 0 69.7%
if 1.64999999999999988e33 < x < 2.8999999999999998e152 or 3.1999999999999999e209 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 53.0%
mul-1-neg53.0%
mul-1-neg53.0%
rec-exp53.0%
sub-neg53.0%
div-sub53.0%
rec-exp53.0%
mul-1-neg53.0%
+-inverses53.0%
Simplified53.0%
if 2.8999999999999998e152 < x < 3.1999999999999999e209Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 3.1%
Taylor expanded in eps around 0 40.6%
Taylor expanded in eps around 0 40.6%
Final simplification59.0%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 1.65e+33)
(/ (+ 2.0 (* x (+ x -2.0))) 2.0)
(if (<= x 8e+152)
0.0
(if (<= x 1.1e+207) (/ (+ 2.0 (* x eps_m)) 2.0) 0.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1.65e+33) {
tmp = (2.0 + (x * (x + -2.0))) / 2.0;
} else if (x <= 8e+152) {
tmp = 0.0;
} else if (x <= 1.1e+207) {
tmp = (2.0 + (x * eps_m)) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 1.65d+33) then
tmp = (2.0d0 + (x * (x + (-2.0d0)))) / 2.0d0
else if (x <= 8d+152) then
tmp = 0.0d0
else if (x <= 1.1d+207) then
tmp = (2.0d0 + (x * eps_m)) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 1.65e+33) {
tmp = (2.0 + (x * (x + -2.0))) / 2.0;
} else if (x <= 8e+152) {
tmp = 0.0;
} else if (x <= 1.1e+207) {
tmp = (2.0 + (x * eps_m)) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1.65e+33: tmp = (2.0 + (x * (x + -2.0))) / 2.0 elif x <= 8e+152: tmp = 0.0 elif x <= 1.1e+207: tmp = (2.0 + (x * eps_m)) / 2.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1.65e+33) tmp = Float64(Float64(2.0 + Float64(x * Float64(x + -2.0))) / 2.0); elseif (x <= 8e+152) tmp = 0.0; elseif (x <= 1.1e+207) tmp = Float64(Float64(2.0 + Float64(x * eps_m)) / 2.0); else tmp = 0.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 1.65e+33) tmp = (2.0 + (x * (x + -2.0))) / 2.0; elseif (x <= 8e+152) tmp = 0.0; elseif (x <= 1.1e+207) tmp = (2.0 + (x * eps_m)) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 1.65e+33], N[(N[(2.0 + N[(x * N[(x + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 8e+152], 0.0, If[LessEqual[x, 1.1e+207], N[(N[(2.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.65 \cdot 10^{+33}:\\
\;\;\;\;\frac{2 + x \cdot \left(x + -2\right)}{2}\\
\mathbf{elif}\;x \leq 8 \cdot 10^{+152}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{+207}:\\
\;\;\;\;\frac{2 + x \cdot eps\_m}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.64999999999999988e33Initial program 64.5%
Simplified57.4%
Taylor expanded in eps around inf 98.3%
Taylor expanded in eps around 0 74.7%
neg-mul-174.7%
rec-exp74.7%
count-274.7%
associate-*r/74.7%
metadata-eval74.7%
Simplified74.7%
Taylor expanded in x around 0 67.2%
+-commutative67.2%
unpow267.2%
distribute-rgt-out67.2%
Simplified67.2%
if 1.64999999999999988e33 < x < 8.0000000000000004e152 or 1.10000000000000004e207 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 53.0%
mul-1-neg53.0%
mul-1-neg53.0%
rec-exp53.0%
sub-neg53.0%
div-sub53.0%
rec-exp53.0%
mul-1-neg53.0%
+-inverses53.0%
Simplified53.0%
if 8.0000000000000004e152 < x < 1.10000000000000004e207Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 3.1%
Taylor expanded in eps around 0 40.6%
Taylor expanded in eps around 0 40.6%
Final simplification63.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.0) (/ (* x eps_m) (- 2.0)) (if (<= x 1.65e+33) 1.0 0.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.0) {
tmp = (x * eps_m) / -2.0;
} else if (x <= 1.65e+33) {
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.0d0)) then
tmp = (x * eps_m) / -2.0d0
else if (x <= 1.65d+33) 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.0) {
tmp = (x * eps_m) / -2.0;
} else if (x <= 1.65e+33) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.0: tmp = (x * eps_m) / -2.0 elif x <= 1.65e+33: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.0) tmp = Float64(Float64(x * eps_m) / Float64(-2.0)); elseif (x <= 1.65e+33) 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.0) tmp = (x * eps_m) / -2.0; elseif (x <= 1.65e+33) 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.0], N[(N[(x * eps$95$m), $MachinePrecision] / (-2.0)), $MachinePrecision], If[LessEqual[x, 1.65e+33], 1.0, 0.0]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{x \cdot eps\_m}{-2}\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{+33}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -1Initial program 97.3%
Simplified97.3%
Taylor expanded in eps around inf 97.3%
Taylor expanded in x around 0 39.5%
Taylor expanded in eps around inf 23.3%
*-commutative23.3%
neg-mul-123.3%
distribute-rgt-neg-in23.3%
Simplified23.3%
if -1 < x < 1.64999999999999988e33Initial program 57.1%
Simplified57.1%
Taylor expanded in x around 0 69.7%
if 1.64999999999999988e33 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 47.1%
mul-1-neg47.1%
mul-1-neg47.1%
rec-exp47.1%
sub-neg47.1%
div-sub47.1%
rec-exp47.1%
mul-1-neg47.1%
+-inverses47.1%
Simplified47.1%
Final simplification58.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 2.0) (/ (- 2.0 x) 2.0) 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 2.0) {
tmp = (2.0 - x) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 2.0d0) then
tmp = (2.0d0 - x) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 2.0) {
tmp = (2.0 - x) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 2.0: tmp = (2.0 - x) / 2.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 2.0) tmp = Float64(Float64(2.0 - x) / 2.0); else tmp = 0.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 2.0) tmp = (2.0 - x) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 2.0], N[(N[(2.0 - x), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2:\\
\;\;\;\;\frac{2 - x}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2Initial program 63.7%
Simplified56.4%
Taylor expanded in eps around inf 98.7%
Taylor expanded in eps around inf 98.7%
*-commutative98.7%
Simplified98.7%
Taylor expanded in x around 0 59.7%
neg-mul-159.7%
unsub-neg59.7%
Simplified59.7%
if 2 < x Initial program 98.4%
Simplified98.5%
Taylor expanded in eps around 0 41.9%
mul-1-neg41.9%
mul-1-neg41.9%
rec-exp41.9%
sub-neg41.9%
div-sub41.9%
rec-exp41.9%
mul-1-neg41.9%
+-inverses41.9%
Simplified41.9%
Final simplification55.5%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 1.65e+33) 1.0 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1.65e+33) {
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.65d+33) 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.65e+33) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1.65e+33: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1.65e+33) 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.65e+33) 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.65e+33], 1.0, 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.65 \cdot 10^{+33}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.64999999999999988e33Initial program 64.5%
Simplified64.5%
Taylor expanded in x around 0 57.5%
if 1.64999999999999988e33 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 47.1%
mul-1-neg47.1%
mul-1-neg47.1%
rec-exp47.1%
sub-neg47.1%
div-sub47.1%
rec-exp47.1%
mul-1-neg47.1%
+-inverses47.1%
Simplified47.1%
Final simplification55.3%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 0.0)
eps_m = fabs(eps);
double code(double x, double eps_m) {
return 0.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = 0.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return 0.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return 0.0
eps_m = abs(eps) function code(x, eps_m) return 0.0 end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = 0.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := 0.0
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
0
\end{array}
Initial program 72.0%
Simplified58.5%
Taylor expanded in eps around 0 11.7%
mul-1-neg11.7%
mul-1-neg11.7%
rec-exp11.7%
sub-neg11.7%
div-sub11.7%
rec-exp11.7%
mul-1-neg11.7%
+-inverses11.9%
Simplified11.9%
Final simplification11.9%
herbie shell --seed 2024044
(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))