
(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 16 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 (<= x 4e-277) (/ (+ (exp (* x eps_m)) (exp (* x (- eps_m)))) 2.0) (/ (+ (exp (* x (+ eps_m -1.0))) (/ 1.0 (exp x))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 4e-277) {
tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0;
} else {
tmp = (exp((x * (eps_m + -1.0))) + (1.0 / exp(x))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 4d-277) then
tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0d0
else
tmp = (exp((x * (eps_m + (-1.0d0)))) + (1.0d0 / exp(x))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 4e-277) {
tmp = (Math.exp((x * eps_m)) + Math.exp((x * -eps_m))) / 2.0;
} else {
tmp = (Math.exp((x * (eps_m + -1.0))) + (1.0 / Math.exp(x))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 4e-277: tmp = (math.exp((x * eps_m)) + math.exp((x * -eps_m))) / 2.0 else: tmp = (math.exp((x * (eps_m + -1.0))) + (1.0 / math.exp(x))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 4e-277) tmp = Float64(Float64(exp(Float64(x * eps_m)) + exp(Float64(x * Float64(-eps_m)))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + Float64(1.0 / exp(x))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 4e-277) tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0; else tmp = (exp((x * (eps_m + -1.0))) + (1.0 / exp(x))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 4e-277], N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4 \cdot 10^{-277}:\\
\;\;\;\;\frac{e^{x \cdot eps\_m} + e^{x \cdot \left(-eps\_m\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(eps\_m + -1\right)} + \frac{1}{e^{x}}}{2}\\
\end{array}
\end{array}
if x < 3.99999999999999988e-277Initial program 61.7%
Simplified53.6%
Taylor expanded in eps around inf 99.9%
Taylor expanded in eps around inf 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around -inf 99.9%
rec-exp99.9%
distribute-rgt-out--99.9%
Simplified99.9%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
if 3.99999999999999988e-277 < x Initial program 83.9%
Simplified80.2%
Taylor expanded in eps around inf 98.7%
Taylor expanded in eps around 0 77.2%
Final simplification88.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 0.102) (/ (+ (+ x 1.0) (- 1.0 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 <= 0.102) {
tmp = ((x + 1.0) + (1.0 - x)) / 2.0;
} else {
tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (eps_m <= 0.102d0) then
tmp = ((x + 1.0d0) + (1.0d0 - x)) / 2.0d0
else
tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (eps_m <= 0.102) {
tmp = ((x + 1.0) + (1.0 - x)) / 2.0;
} else {
tmp = (Math.exp((x * eps_m)) + Math.exp((x * -eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 0.102: tmp = ((x + 1.0) + (1.0 - x)) / 2.0 else: tmp = (math.exp((x * eps_m)) + math.exp((x * -eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 0.102) tmp = Float64(Float64(Float64(x + 1.0) + Float64(1.0 - 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 = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 0.102) tmp = ((x + 1.0) + (1.0 - x)) / 2.0; else tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 0.102], N[(N[(N[(x + 1.0), $MachinePrecision] + N[(1.0 - 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 0.102:\\
\;\;\;\;\frac{\left(x + 1\right) + \left(1 - x\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot eps\_m} + e^{x \cdot \left(-eps\_m\right)}}{2}\\
\end{array}
\end{array}
if eps < 0.101999999999999993Initial program 61.7%
Simplified61.7%
Taylor expanded in x around 0 29.7%
Taylor expanded in x around 0 20.4%
Taylor expanded in eps around 0 66.9%
if 0.101999999999999993 < eps Initial program 99.9%
Simplified91.3%
Taylor expanded in eps around inf 99.9%
Taylor expanded in eps around inf 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around -inf 99.9%
rec-exp99.9%
distribute-rgt-out--99.9%
Simplified99.9%
Taylor expanded in eps around inf 99.9%
*-commutative99.9%
Simplified99.9%
Final simplification76.4%
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.7%
Simplified66.8%
Taylor expanded in eps around inf 99.3%
Final simplification99.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1.75e-241)
(/ (* 2.0 (exp (- x))) 2.0)
(if (or (<= x 5e+73) (not (<= x 4e+158)))
(/ (+ 1.0 (exp (* x eps_m))) 2.0)
(/
(+
(* (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (* x (+ eps_m -1.0))))
(/ (+ x -1.0) eps_m))
2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.75e-241) {
tmp = (2.0 * exp(-x)) / 2.0;
} else if ((x <= 5e+73) || !(x <= 4e+158)) {
tmp = (1.0 + exp((x * eps_m))) / 2.0;
} else {
tmp = (((1.0 + (1.0 / eps_m)) * (1.0 + (x * (eps_m + -1.0)))) + ((x + -1.0) / eps_m)) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-1.75d-241)) then
tmp = (2.0d0 * exp(-x)) / 2.0d0
else if ((x <= 5d+73) .or. (.not. (x <= 4d+158))) then
tmp = (1.0d0 + exp((x * eps_m))) / 2.0d0
else
tmp = (((1.0d0 + (1.0d0 / eps_m)) * (1.0d0 + (x * (eps_m + (-1.0d0))))) + ((x + (-1.0d0)) / eps_m)) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1.75e-241) {
tmp = (2.0 * Math.exp(-x)) / 2.0;
} else if ((x <= 5e+73) || !(x <= 4e+158)) {
tmp = (1.0 + Math.exp((x * eps_m))) / 2.0;
} else {
tmp = (((1.0 + (1.0 / eps_m)) * (1.0 + (x * (eps_m + -1.0)))) + ((x + -1.0) / eps_m)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.75e-241: tmp = (2.0 * math.exp(-x)) / 2.0 elif (x <= 5e+73) or not (x <= 4e+158): tmp = (1.0 + math.exp((x * eps_m))) / 2.0 else: tmp = (((1.0 + (1.0 / eps_m)) * (1.0 + (x * (eps_m + -1.0)))) + ((x + -1.0) / eps_m)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.75e-241) tmp = Float64(Float64(2.0 * exp(Float64(-x))) / 2.0); elseif ((x <= 5e+73) || !(x <= 4e+158)) tmp = Float64(Float64(1.0 + exp(Float64(x * eps_m))) / 2.0); else tmp = Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) * Float64(1.0 + Float64(x * Float64(eps_m + -1.0)))) + Float64(Float64(x + -1.0) / eps_m)) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.75e-241) tmp = (2.0 * exp(-x)) / 2.0; elseif ((x <= 5e+73) || ~((x <= 4e+158))) tmp = (1.0 + exp((x * eps_m))) / 2.0; else tmp = (((1.0 + (1.0 / eps_m)) * (1.0 + (x * (eps_m + -1.0)))) + ((x + -1.0) / eps_m)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.75e-241], N[(N[(2.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 5e+73], N[Not[LessEqual[x, 4e+158]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x + -1.0), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{-241}:\\
\;\;\;\;\frac{2 \cdot e^{-x}}{2}\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+73} \lor \neg \left(x \leq 4 \cdot 10^{+158}\right):\\
\;\;\;\;\frac{1 + e^{x \cdot eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) \cdot \left(1 + x \cdot \left(eps\_m + -1\right)\right) + \frac{x + -1}{eps\_m}}{2}\\
\end{array}
\end{array}
if x < -1.7499999999999999e-241Initial program 63.8%
Simplified54.1%
Taylor expanded in eps around inf 99.9%
Taylor expanded in eps around 0 92.0%
Taylor expanded in eps around 0 83.6%
neg-mul-183.6%
rec-exp83.6%
count-283.6%
rec-exp83.6%
Simplified83.6%
if -1.7499999999999999e-241 < x < 4.99999999999999976e73 or 3.99999999999999981e158 < x Initial program 76.8%
Simplified73.3%
Taylor expanded in eps around inf 98.7%
Taylor expanded in eps around inf 88.5%
*-commutative88.5%
Simplified88.5%
Taylor expanded in x around -inf 88.5%
rec-exp88.5%
distribute-rgt-out--88.5%
Simplified88.5%
Taylor expanded in x around 0 68.4%
if 4.99999999999999976e73 < x < 3.99999999999999981e158Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 22.4%
Taylor expanded in x around 0 33.9%
Taylor expanded in eps around 0 46.8%
mul-1-neg46.8%
unsub-neg46.8%
Simplified46.8%
Final simplification73.5%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -2e-240)
(/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) 2.0)
(if (or (<= x 3.7e+74) (not (<= x 6.4e+158)))
(/ (+ 1.0 (exp (* x eps_m))) 2.0)
(/
(+
(* (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (* x (+ eps_m -1.0))))
(/ (+ x -1.0) eps_m))
2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -2e-240) {
tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0;
} else if ((x <= 3.7e+74) || !(x <= 6.4e+158)) {
tmp = (1.0 + exp((x * eps_m))) / 2.0;
} else {
tmp = (((1.0 + (1.0 / eps_m)) * (1.0 + (x * (eps_m + -1.0)))) + ((x + -1.0) / eps_m)) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-2d-240)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
else if ((x <= 3.7d+74) .or. (.not. (x <= 6.4d+158))) then
tmp = (1.0d0 + exp((x * eps_m))) / 2.0d0
else
tmp = (((1.0d0 + (1.0d0 / eps_m)) * (1.0d0 + (x * (eps_m + (-1.0d0))))) + ((x + (-1.0d0)) / eps_m)) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -2e-240) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
} else if ((x <= 3.7e+74) || !(x <= 6.4e+158)) {
tmp = (1.0 + Math.exp((x * eps_m))) / 2.0;
} else {
tmp = (((1.0 + (1.0 / eps_m)) * (1.0 + (x * (eps_m + -1.0)))) + ((x + -1.0) / eps_m)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -2e-240: tmp = (1.0 + math.exp((x * (-1.0 - eps_m)))) / 2.0 elif (x <= 3.7e+74) or not (x <= 6.4e+158): tmp = (1.0 + math.exp((x * eps_m))) / 2.0 else: tmp = (((1.0 + (1.0 / eps_m)) * (1.0 + (x * (eps_m + -1.0)))) + ((x + -1.0) / eps_m)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -2e-240) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); elseif ((x <= 3.7e+74) || !(x <= 6.4e+158)) tmp = Float64(Float64(1.0 + exp(Float64(x * eps_m))) / 2.0); else tmp = Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) * Float64(1.0 + Float64(x * Float64(eps_m + -1.0)))) + Float64(Float64(x + -1.0) / eps_m)) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -2e-240) tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0; elseif ((x <= 3.7e+74) || ~((x <= 6.4e+158))) tmp = (1.0 + exp((x * eps_m))) / 2.0; else tmp = (((1.0 + (1.0 / eps_m)) * (1.0 + (x * (eps_m + -1.0)))) + ((x + -1.0) / eps_m)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -2e-240], 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, 3.7e+74], N[Not[LessEqual[x, 6.4e+158]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x + -1.0), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-240}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\mathbf{elif}\;x \leq 3.7 \cdot 10^{+74} \lor \neg \left(x \leq 6.4 \cdot 10^{+158}\right):\\
\;\;\;\;\frac{1 + e^{x \cdot eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) \cdot \left(1 + x \cdot \left(eps\_m + -1\right)\right) + \frac{x + -1}{eps\_m}}{2}\\
\end{array}
\end{array}
if x < -1.9999999999999999e-240Initial program 63.8%
Simplified54.1%
Taylor expanded in eps around inf 99.9%
Taylor expanded in eps around inf 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around -inf 99.9%
rec-exp99.9%
distribute-rgt-out--99.9%
Simplified99.9%
Taylor expanded in x around 0 70.3%
if -1.9999999999999999e-240 < x < 3.7000000000000001e74 or 6.39999999999999989e158 < x Initial program 76.8%
Simplified73.3%
Taylor expanded in eps around inf 98.7%
Taylor expanded in eps around inf 88.5%
*-commutative88.5%
Simplified88.5%
Taylor expanded in x around -inf 88.5%
rec-exp88.5%
distribute-rgt-out--88.5%
Simplified88.5%
Taylor expanded in x around 0 68.4%
if 3.7000000000000001e74 < x < 6.39999999999999989e158Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 22.4%
Taylor expanded in x around 0 33.9%
Taylor expanded in eps around 0 46.8%
mul-1-neg46.8%
unsub-neg46.8%
Simplified46.8%
Final simplification67.9%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -2e-241)
(/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) 2.0)
(/
(+ (exp (* x (+ eps_m -1.0))) (/ 1.0 (+ 1.0 (* x (- eps_m -1.0)))))
2.0)))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -2e-241) {
tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0;
} else {
tmp = (exp((x * (eps_m + -1.0))) + (1.0 / (1.0 + (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 <= (-2d-241)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
else
tmp = (exp((x * (eps_m + (-1.0d0)))) + (1.0d0 / (1.0d0 + (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 <= -2e-241) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
} else {
tmp = (Math.exp((x * (eps_m + -1.0))) + (1.0 / (1.0 + (x * (eps_m - -1.0))))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -2e-241: tmp = (1.0 + math.exp((x * (-1.0 - eps_m)))) / 2.0 else: tmp = (math.exp((x * (eps_m + -1.0))) + (1.0 / (1.0 + (x * (eps_m - -1.0))))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -2e-241) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + Float64(1.0 / Float64(1.0 + 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 <= -2e-241) tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0; else tmp = (exp((x * (eps_m + -1.0))) + (1.0 / (1.0 + (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, -2e-241], 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[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[(1.0 + N[(x * N[(eps$95$m - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-241}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(eps\_m + -1\right)} + \frac{1}{1 + x \cdot \left(eps\_m - -1\right)}}{2}\\
\end{array}
\end{array}
if x < -1.9999999999999999e-241Initial program 63.8%
Simplified54.1%
Taylor expanded in eps around inf 99.9%
Taylor expanded in eps around inf 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around -inf 99.9%
rec-exp99.9%
distribute-rgt-out--99.9%
Simplified99.9%
Taylor expanded in x around 0 70.3%
if -1.9999999999999999e-241 < x Initial program 79.1%
Simplified76.0%
Taylor expanded in eps around inf 98.9%
Taylor expanded in x around 0 62.4%
Final simplification65.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.75e-241) (/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) 2.0) (/ (+ 1.0 (exp (* x (+ eps_m -1.0)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.75e-241) {
tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0;
} else {
tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-1.75d-241)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
else
tmp = (1.0d0 + exp((x * (eps_m + (-1.0d0))))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1.75e-241) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
} else {
tmp = (1.0 + Math.exp((x * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.75e-241: tmp = (1.0 + math.exp((x * (-1.0 - eps_m)))) / 2.0 else: tmp = (1.0 + math.exp((x * (eps_m + -1.0)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.75e-241) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); else tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps_m + -1.0)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.75e-241) tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0; else tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.75e-241], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - 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 -1.75 \cdot 10^{-241}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\end{array}
\end{array}
if x < -1.7499999999999999e-241Initial program 63.8%
Simplified54.1%
Taylor expanded in eps around inf 99.9%
Taylor expanded in eps around inf 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around -inf 99.9%
rec-exp99.9%
distribute-rgt-out--99.9%
Simplified99.9%
Taylor expanded in x around 0 70.3%
if -1.7499999999999999e-241 < x Initial program 79.1%
Simplified76.0%
Taylor expanded in eps around inf 98.9%
Taylor expanded in x around 0 62.4%
Final simplification65.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 4.1e+259) (/ (* 2.0 (exp (- x))) 2.0) (/ (+ 2.0 (* x eps_m)) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 4.1e+259) {
tmp = (2.0 * exp(-x)) / 2.0;
} else {
tmp = (2.0 + (x * eps_m)) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (eps_m <= 4.1d+259) then
tmp = (2.0d0 * exp(-x)) / 2.0d0
else
tmp = (2.0d0 + (x * eps_m)) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (eps_m <= 4.1e+259) {
tmp = (2.0 * Math.exp(-x)) / 2.0;
} else {
tmp = (2.0 + (x * eps_m)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 4.1e+259: tmp = (2.0 * math.exp(-x)) / 2.0 else: tmp = (2.0 + (x * eps_m)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 4.1e+259) tmp = Float64(Float64(2.0 * exp(Float64(-x))) / 2.0); else tmp = Float64(Float64(2.0 + 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 (eps_m <= 4.1e+259) tmp = (2.0 * exp(-x)) / 2.0; else tmp = (2.0 + (x * eps_m)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 4.1e+259], N[(N[(2.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 4.1 \cdot 10^{+259}:\\
\;\;\;\;\frac{2 \cdot e^{-x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if eps < 4.1000000000000003e259Initial program 71.7%
Simplified66.4%
Taylor expanded in eps around inf 99.3%
Taylor expanded in eps around 0 84.8%
Taylor expanded in eps around 0 74.1%
neg-mul-174.1%
rec-exp74.1%
count-274.1%
rec-exp74.1%
Simplified74.1%
if 4.1000000000000003e259 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 13.9%
Taylor expanded in eps around 0 56.3%
Taylor expanded in eps around 0 56.3%
Final simplification73.4%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (+ 1.0 (/ 1.0 eps_m))) (t_1 (* x (+ eps_m -1.0))))
(if (<= x -1.3e+107)
(/
(-
(* t_0 (- 1.0 t_1))
(* (- -1.0 (/ -1.0 eps_m)) (+ 1.0 (* x (- -1.0 eps_m)))))
2.0)
(if (<= x -9.2e-8)
(/
(+
(* t_0 (+ 1.0 t_1))
(/ (- -1.0 (- (* eps_m (- (+ (* x eps_m) (+ x -1.0)) x)) x)) eps_m))
2.0)
(if (<= x 5.7e+268)
(/ (+ (+ x 1.0) (- 1.0 x)) 2.0)
(/ (+ 2.0 (* x (+ (/ 1.0 eps_m) (* t_0 (+ eps_m -1.0))))) 2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = 1.0 + (1.0 / eps_m);
double t_1 = x * (eps_m + -1.0);
double tmp;
if (x <= -1.3e+107) {
tmp = ((t_0 * (1.0 - t_1)) - ((-1.0 - (-1.0 / eps_m)) * (1.0 + (x * (-1.0 - eps_m))))) / 2.0;
} else if (x <= -9.2e-8) {
tmp = ((t_0 * (1.0 + t_1)) + ((-1.0 - ((eps_m * (((x * eps_m) + (x + -1.0)) - x)) - x)) / eps_m)) / 2.0;
} else if (x <= 5.7e+268) {
tmp = ((x + 1.0) + (1.0 - x)) / 2.0;
} else {
tmp = (2.0 + (x * ((1.0 / eps_m) + (t_0 * (eps_m + -1.0))))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + (1.0d0 / eps_m)
t_1 = x * (eps_m + (-1.0d0))
if (x <= (-1.3d+107)) then
tmp = ((t_0 * (1.0d0 - t_1)) - (((-1.0d0) - ((-1.0d0) / eps_m)) * (1.0d0 + (x * ((-1.0d0) - eps_m))))) / 2.0d0
else if (x <= (-9.2d-8)) then
tmp = ((t_0 * (1.0d0 + t_1)) + (((-1.0d0) - ((eps_m * (((x * eps_m) + (x + (-1.0d0))) - x)) - x)) / eps_m)) / 2.0d0
else if (x <= 5.7d+268) then
tmp = ((x + 1.0d0) + (1.0d0 - x)) / 2.0d0
else
tmp = (2.0d0 + (x * ((1.0d0 / eps_m) + (t_0 * (eps_m + (-1.0d0)))))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = 1.0 + (1.0 / eps_m);
double t_1 = x * (eps_m + -1.0);
double tmp;
if (x <= -1.3e+107) {
tmp = ((t_0 * (1.0 - t_1)) - ((-1.0 - (-1.0 / eps_m)) * (1.0 + (x * (-1.0 - eps_m))))) / 2.0;
} else if (x <= -9.2e-8) {
tmp = ((t_0 * (1.0 + t_1)) + ((-1.0 - ((eps_m * (((x * eps_m) + (x + -1.0)) - x)) - x)) / eps_m)) / 2.0;
} else if (x <= 5.7e+268) {
tmp = ((x + 1.0) + (1.0 - x)) / 2.0;
} else {
tmp = (2.0 + (x * ((1.0 / eps_m) + (t_0 * (eps_m + -1.0))))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = 1.0 + (1.0 / eps_m) t_1 = x * (eps_m + -1.0) tmp = 0 if x <= -1.3e+107: tmp = ((t_0 * (1.0 - t_1)) - ((-1.0 - (-1.0 / eps_m)) * (1.0 + (x * (-1.0 - eps_m))))) / 2.0 elif x <= -9.2e-8: tmp = ((t_0 * (1.0 + t_1)) + ((-1.0 - ((eps_m * (((x * eps_m) + (x + -1.0)) - x)) - x)) / eps_m)) / 2.0 elif x <= 5.7e+268: tmp = ((x + 1.0) + (1.0 - x)) / 2.0 else: tmp = (2.0 + (x * ((1.0 / eps_m) + (t_0 * (eps_m + -1.0))))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(1.0 + Float64(1.0 / eps_m)) t_1 = Float64(x * Float64(eps_m + -1.0)) tmp = 0.0 if (x <= -1.3e+107) tmp = Float64(Float64(Float64(t_0 * Float64(1.0 - t_1)) - Float64(Float64(-1.0 - Float64(-1.0 / eps_m)) * Float64(1.0 + Float64(x * Float64(-1.0 - eps_m))))) / 2.0); elseif (x <= -9.2e-8) tmp = Float64(Float64(Float64(t_0 * Float64(1.0 + t_1)) + Float64(Float64(-1.0 - Float64(Float64(eps_m * Float64(Float64(Float64(x * eps_m) + Float64(x + -1.0)) - x)) - x)) / eps_m)) / 2.0); elseif (x <= 5.7e+268) tmp = Float64(Float64(Float64(x + 1.0) + Float64(1.0 - x)) / 2.0); else tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(1.0 / eps_m) + Float64(t_0 * Float64(eps_m + -1.0))))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = 1.0 + (1.0 / eps_m); t_1 = x * (eps_m + -1.0); tmp = 0.0; if (x <= -1.3e+107) tmp = ((t_0 * (1.0 - t_1)) - ((-1.0 - (-1.0 / eps_m)) * (1.0 + (x * (-1.0 - eps_m))))) / 2.0; elseif (x <= -9.2e-8) tmp = ((t_0 * (1.0 + t_1)) + ((-1.0 - ((eps_m * (((x * eps_m) + (x + -1.0)) - x)) - x)) / eps_m)) / 2.0; elseif (x <= 5.7e+268) tmp = ((x + 1.0) + (1.0 - x)) / 2.0; else tmp = (2.0 + (x * ((1.0 / eps_m) + (t_0 * (eps_m + -1.0))))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.3e+107], N[(N[(N[(t$95$0 * N[(1.0 - t$95$1), $MachinePrecision]), $MachinePrecision] - N[(N[(-1.0 - N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -9.2e-8], N[(N[(N[(t$95$0 * N[(1.0 + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 - N[(N[(eps$95$m * N[(N[(N[(x * eps$95$m), $MachinePrecision] + N[(x + -1.0), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5.7e+268], N[(N[(N[(x + 1.0), $MachinePrecision] + N[(1.0 - x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(t$95$0 * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := 1 + \frac{1}{eps\_m}\\
t_1 := x \cdot \left(eps\_m + -1\right)\\
\mathbf{if}\;x \leq -1.3 \cdot 10^{+107}:\\
\;\;\;\;\frac{t\_0 \cdot \left(1 - t\_1\right) - \left(-1 - \frac{-1}{eps\_m}\right) \cdot \left(1 + x \cdot \left(-1 - eps\_m\right)\right)}{2}\\
\mathbf{elif}\;x \leq -9.2 \cdot 10^{-8}:\\
\;\;\;\;\frac{t\_0 \cdot \left(1 + t\_1\right) + \frac{-1 - \left(eps\_m \cdot \left(\left(x \cdot eps\_m + \left(x + -1\right)\right) - x\right) - x\right)}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq 5.7 \cdot 10^{+268}:\\
\;\;\;\;\frac{\left(x + 1\right) + \left(1 - x\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(\frac{1}{eps\_m} + t\_0 \cdot \left(eps\_m + -1\right)\right)}{2}\\
\end{array}
\end{array}
if x < -1.3000000000000001e107Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 35.3%
Taylor expanded in x around 0 0.6%
distribute-rgt-in0.6%
*-un-lft-identity0.6%
add-sqr-sqrt0.3%
sqrt-unprod52.6%
mul-1-neg52.6%
mul-1-neg52.6%
sqr-neg52.6%
sqrt-unprod25.8%
add-sqr-sqrt25.8%
Applied egg-rr25.8%
*-lft-identity25.8%
distribute-rgt-in25.8%
Simplified25.8%
if -1.3000000000000001e107 < x < -9.2000000000000003e-8Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 60.3%
Taylor expanded in x around 0 1.4%
Taylor expanded in eps around 0 32.0%
if -9.2000000000000003e-8 < x < 5.7e268Initial program 66.6%
Simplified66.6%
Taylor expanded in x around 0 37.9%
Taylor expanded in x around 0 29.9%
Taylor expanded in eps around 0 69.9%
if 5.7e268 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 3.1%
Taylor expanded in eps around 0 43.3%
Final simplification62.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= eps_m 1.12e+24)
(/ (+ (+ x 1.0) (- 1.0 x)) 2.0)
(if (<= eps_m 4.6e+198)
(/
(-
(+ 1.0 (/ 1.0 eps_m))
(* (- -1.0 (/ -1.0 eps_m)) (+ 1.0 (* x (- -1.0 eps_m)))))
2.0)
(/ (+ 2.0 (* x eps_m)) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 1.12e+24) {
tmp = ((x + 1.0) + (1.0 - x)) / 2.0;
} else if (eps_m <= 4.6e+198) {
tmp = ((1.0 + (1.0 / eps_m)) - ((-1.0 - (-1.0 / eps_m)) * (1.0 + (x * (-1.0 - eps_m))))) / 2.0;
} else {
tmp = (2.0 + (x * eps_m)) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (eps_m <= 1.12d+24) then
tmp = ((x + 1.0d0) + (1.0d0 - x)) / 2.0d0
else if (eps_m <= 4.6d+198) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) - (((-1.0d0) - ((-1.0d0) / eps_m)) * (1.0d0 + (x * ((-1.0d0) - eps_m))))) / 2.0d0
else
tmp = (2.0d0 + (x * eps_m)) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (eps_m <= 1.12e+24) {
tmp = ((x + 1.0) + (1.0 - x)) / 2.0;
} else if (eps_m <= 4.6e+198) {
tmp = ((1.0 + (1.0 / eps_m)) - ((-1.0 - (-1.0 / eps_m)) * (1.0 + (x * (-1.0 - eps_m))))) / 2.0;
} else {
tmp = (2.0 + (x * eps_m)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 1.12e+24: tmp = ((x + 1.0) + (1.0 - x)) / 2.0 elif eps_m <= 4.6e+198: tmp = ((1.0 + (1.0 / eps_m)) - ((-1.0 - (-1.0 / eps_m)) * (1.0 + (x * (-1.0 - eps_m))))) / 2.0 else: tmp = (2.0 + (x * eps_m)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 1.12e+24) tmp = Float64(Float64(Float64(x + 1.0) + Float64(1.0 - x)) / 2.0); elseif (eps_m <= 4.6e+198) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) - Float64(Float64(-1.0 - Float64(-1.0 / eps_m)) * Float64(1.0 + Float64(x * Float64(-1.0 - eps_m))))) / 2.0); else tmp = Float64(Float64(2.0 + 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 (eps_m <= 1.12e+24) tmp = ((x + 1.0) + (1.0 - x)) / 2.0; elseif (eps_m <= 4.6e+198) tmp = ((1.0 + (1.0 / eps_m)) - ((-1.0 - (-1.0 / eps_m)) * (1.0 + (x * (-1.0 - eps_m))))) / 2.0; else tmp = (2.0 + (x * eps_m)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 1.12e+24], N[(N[(N[(x + 1.0), $MachinePrecision] + N[(1.0 - x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps$95$m, 4.6e+198], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] - N[(N[(-1.0 - N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 1.12 \cdot 10^{+24}:\\
\;\;\;\;\frac{\left(x + 1\right) + \left(1 - x\right)}{2}\\
\mathbf{elif}\;eps\_m \leq 4.6 \cdot 10^{+198}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) - \left(-1 - \frac{-1}{eps\_m}\right) \cdot \left(1 + x \cdot \left(-1 - eps\_m\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if eps < 1.12e24Initial program 63.3%
Simplified63.3%
Taylor expanded in x around 0 32.6%
Taylor expanded in x around 0 22.7%
Taylor expanded in eps around 0 67.2%
if 1.12e24 < eps < 4.6000000000000001e198Initial program 99.8%
Simplified99.8%
Taylor expanded in x around 0 63.6%
Taylor expanded in x around 0 43.7%
Taylor expanded in x around 0 49.5%
if 4.6000000000000001e198 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 14.4%
Taylor expanded in eps around 0 47.1%
Taylor expanded in eps around 0 47.1%
Final simplification62.4%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= eps_m 1.5e+24)
(/ (+ (+ x 1.0) (- 1.0 x)) 2.0)
(if (<= eps_m 1.95e+197)
(/ (- 2.0 (* x (- eps_m -1.0))) 2.0)
(/ (+ 2.0 (* x eps_m)) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 1.5e+24) {
tmp = ((x + 1.0) + (1.0 - x)) / 2.0;
} else if (eps_m <= 1.95e+197) {
tmp = (2.0 - (x * (eps_m - -1.0))) / 2.0;
} else {
tmp = (2.0 + (x * eps_m)) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (eps_m <= 1.5d+24) then
tmp = ((x + 1.0d0) + (1.0d0 - x)) / 2.0d0
else if (eps_m <= 1.95d+197) then
tmp = (2.0d0 - (x * (eps_m - (-1.0d0)))) / 2.0d0
else
tmp = (2.0d0 + (x * eps_m)) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (eps_m <= 1.5e+24) {
tmp = ((x + 1.0) + (1.0 - x)) / 2.0;
} else if (eps_m <= 1.95e+197) {
tmp = (2.0 - (x * (eps_m - -1.0))) / 2.0;
} else {
tmp = (2.0 + (x * eps_m)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 1.5e+24: tmp = ((x + 1.0) + (1.0 - x)) / 2.0 elif eps_m <= 1.95e+197: tmp = (2.0 - (x * (eps_m - -1.0))) / 2.0 else: tmp = (2.0 + (x * eps_m)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 1.5e+24) tmp = Float64(Float64(Float64(x + 1.0) + Float64(1.0 - x)) / 2.0); elseif (eps_m <= 1.95e+197) tmp = Float64(Float64(2.0 - Float64(x * Float64(eps_m - -1.0))) / 2.0); else tmp = Float64(Float64(2.0 + 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 (eps_m <= 1.5e+24) tmp = ((x + 1.0) + (1.0 - x)) / 2.0; elseif (eps_m <= 1.95e+197) tmp = (2.0 - (x * (eps_m - -1.0))) / 2.0; else tmp = (2.0 + (x * eps_m)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 1.5e+24], N[(N[(N[(x + 1.0), $MachinePrecision] + N[(1.0 - x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps$95$m, 1.95e+197], N[(N[(2.0 - N[(x * N[(eps$95$m - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 1.5 \cdot 10^{+24}:\\
\;\;\;\;\frac{\left(x + 1\right) + \left(1 - x\right)}{2}\\
\mathbf{elif}\;eps\_m \leq 1.95 \cdot 10^{+197}:\\
\;\;\;\;\frac{2 - x \cdot \left(eps\_m - -1\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if eps < 1.49999999999999997e24Initial program 63.3%
Simplified63.3%
Taylor expanded in x around 0 32.6%
Taylor expanded in x around 0 22.7%
Taylor expanded in eps around 0 67.2%
if 1.49999999999999997e24 < eps < 1.95e197Initial program 99.8%
Simplified96.2%
Taylor expanded in eps around inf 99.8%
Taylor expanded in eps around inf 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around 0 85.7%
Taylor expanded in x around 0 49.5%
if 1.95e197 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 14.4%
Taylor expanded in eps around 0 47.1%
Taylor expanded in eps around 0 47.1%
Final simplification62.4%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -2e-240) (/ (- 2.0 (* x (- eps_m -1.0))) 2.0) (/ (+ 2.0 (* x eps_m)) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -2e-240) {
tmp = (2.0 - (x * (eps_m - -1.0))) / 2.0;
} else {
tmp = (2.0 + (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 <= (-2d-240)) then
tmp = (2.0d0 - (x * (eps_m - (-1.0d0)))) / 2.0d0
else
tmp = (2.0d0 + (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 <= -2e-240) {
tmp = (2.0 - (x * (eps_m - -1.0))) / 2.0;
} else {
tmp = (2.0 + (x * eps_m)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -2e-240: tmp = (2.0 - (x * (eps_m - -1.0))) / 2.0 else: tmp = (2.0 + (x * eps_m)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -2e-240) tmp = Float64(Float64(2.0 - Float64(x * Float64(eps_m - -1.0))) / 2.0); else tmp = Float64(Float64(2.0 + 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 <= -2e-240) tmp = (2.0 - (x * (eps_m - -1.0))) / 2.0; else tmp = (2.0 + (x * eps_m)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -2e-240], N[(N[(2.0 - N[(x * N[(eps$95$m - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-240}:\\
\;\;\;\;\frac{2 - x \cdot \left(eps\_m - -1\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < -1.9999999999999999e-240Initial program 63.8%
Simplified54.1%
Taylor expanded in eps around inf 99.9%
Taylor expanded in eps around inf 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around 0 70.3%
Taylor expanded in x around 0 53.6%
if -1.9999999999999999e-240 < x Initial program 79.1%
Simplified79.1%
Taylor expanded in x around 0 47.0%
Taylor expanded in eps around 0 53.1%
Taylor expanded in eps around 0 53.0%
Final simplification53.3%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -9.6e-11) (/ (* x (- -1.0 eps_m)) 2.0) 1.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -9.6e-11) {
tmp = (x * (-1.0 - eps_m)) / 2.0;
} else {
tmp = 1.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 <= (-9.6d-11)) then
tmp = (x * ((-1.0d0) - eps_m)) / 2.0d0
else
tmp = 1.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 <= -9.6e-11) {
tmp = (x * (-1.0 - eps_m)) / 2.0;
} else {
tmp = 1.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -9.6e-11: tmp = (x * (-1.0 - eps_m)) / 2.0 else: tmp = 1.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -9.6e-11) tmp = Float64(Float64(x * Float64(-1.0 - eps_m)) / 2.0); else tmp = 1.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -9.6e-11) tmp = (x * (-1.0 - eps_m)) / 2.0; else tmp = 1.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -9.6e-11], N[(N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 1.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.6 \cdot 10^{-11}:\\
\;\;\;\;\frac{x \cdot \left(-1 - eps\_m\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -9.6000000000000005e-11Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 46.1%
Taylor expanded in x around inf 16.9%
mul-1-neg16.9%
distribute-rgt-neg-in16.9%
mul-1-neg16.9%
distribute-lft-in16.9%
metadata-eval16.9%
mul-1-neg16.9%
unsub-neg16.9%
Simplified16.9%
if -9.6000000000000005e-11 < x Initial program 67.5%
Simplified67.5%
Taylor expanded in x around 0 56.5%
Final simplification50.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -9.6e-11) (/ (* x (- -1.0 eps_m)) 2.0) (/ (+ 2.0 (* x eps_m)) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -9.6e-11) {
tmp = (x * (-1.0 - eps_m)) / 2.0;
} else {
tmp = (2.0 + (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 <= (-9.6d-11)) then
tmp = (x * ((-1.0d0) - eps_m)) / 2.0d0
else
tmp = (2.0d0 + (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 <= -9.6e-11) {
tmp = (x * (-1.0 - eps_m)) / 2.0;
} else {
tmp = (2.0 + (x * eps_m)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -9.6e-11: tmp = (x * (-1.0 - eps_m)) / 2.0 else: tmp = (2.0 + (x * eps_m)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -9.6e-11) tmp = Float64(Float64(x * Float64(-1.0 - eps_m)) / 2.0); else tmp = Float64(Float64(2.0 + 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 <= -9.6e-11) tmp = (x * (-1.0 - eps_m)) / 2.0; else tmp = (2.0 + (x * eps_m)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -9.6e-11], N[(N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.6 \cdot 10^{-11}:\\
\;\;\;\;\frac{x \cdot \left(-1 - eps\_m\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < -9.6000000000000005e-11Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 46.1%
Taylor expanded in x around inf 16.9%
mul-1-neg16.9%
distribute-rgt-neg-in16.9%
mul-1-neg16.9%
distribute-lft-in16.9%
metadata-eval16.9%
mul-1-neg16.9%
unsub-neg16.9%
Simplified16.9%
if -9.6000000000000005e-11 < x Initial program 67.5%
Simplified67.5%
Taylor expanded in x around 0 56.5%
Taylor expanded in eps around 0 60.4%
Taylor expanded in eps around 0 60.3%
Final simplification53.4%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -9.6e-11) (/ (* x eps_m) (- 2.0)) 1.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -9.6e-11) {
tmp = (x * eps_m) / -2.0;
} else {
tmp = 1.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 <= (-9.6d-11)) then
tmp = (x * eps_m) / -2.0d0
else
tmp = 1.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 <= -9.6e-11) {
tmp = (x * eps_m) / -2.0;
} else {
tmp = 1.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -9.6e-11: tmp = (x * eps_m) / -2.0 else: tmp = 1.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -9.6e-11) tmp = Float64(Float64(x * eps_m) / Float64(-2.0)); else tmp = 1.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -9.6e-11) tmp = (x * eps_m) / -2.0; else tmp = 1.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -9.6e-11], N[(N[(x * eps$95$m), $MachinePrecision] / (-2.0)), $MachinePrecision], 1.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.6 \cdot 10^{-11}:\\
\;\;\;\;\frac{x \cdot eps\_m}{-2}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -9.6000000000000005e-11Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 46.1%
Taylor expanded in eps around inf 16.9%
mul-1-neg16.9%
distribute-lft-neg-out16.9%
*-commutative16.9%
Simplified16.9%
if -9.6000000000000005e-11 < x Initial program 67.5%
Simplified67.5%
Taylor expanded in x around 0 56.5%
Final simplification50.2%
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.7%
Simplified72.7%
Taylor expanded in x around 0 48.0%
Final simplification48.0%
herbie shell --seed 2024089
(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))