
(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 20 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (let* ((t_0 (/ 1.0 (sqrt (exp (fma x eps_m x)))))) (/ (+ (exp (* x (+ -1.0 eps_m))) (* t_0 t_0)) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = 1.0 / sqrt(exp(fma(x, eps_m, x)));
return (exp((x * (-1.0 + eps_m))) + (t_0 * t_0)) / 2.0;
}
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(1.0 / sqrt(exp(fma(x, eps_m, x)))) return Float64(Float64(exp(Float64(x * Float64(-1.0 + eps_m))) + Float64(t_0 * t_0)) / 2.0) end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(1.0 / N[Sqrt[N[Exp[N[(x * eps$95$m + x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := \frac{1}{\sqrt{e^{\mathsf{fma}\left(x, eps\_m, x\right)}}}\\
\frac{e^{x \cdot \left(-1 + eps\_m\right)} + t\_0 \cdot t\_0}{2}
\end{array}
\end{array}
Initial program 75.0%
Simplified75.0%
Taylor expanded in eps around inf 98.9%
*-commutative98.9%
distribute-rgt-in98.9%
*-un-lft-identity98.9%
add-log-exp98.9%
pow-to-exp98.9%
add-sqr-sqrt98.9%
unpow-prod-down98.9%
+-commutative98.9%
*-commutative98.9%
fma-define98.9%
+-commutative98.9%
*-commutative98.9%
fma-define98.9%
Applied egg-rr98.9%
unpow-198.9%
Applied egg-rr98.9%
unpow-198.9%
Applied egg-rr98.9%
Final simplification98.9%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -5e-288)
(/ (+ 1.0 (pow E (* x (- 1.0 eps_m)))) 2.0)
(if (<= x 6.8e+68)
(/ (+ 1.0 (exp (* x eps_m))) 2.0)
(if (<= x 1.4e+77)
(/ (/ (+ (exp (- x)) (/ -1.0 (exp x))) eps_m) 2.0)
(if (or (<= x 7.5e+157) (not (<= x 7.2e+212)))
(/
(+ (exp (* x (+ -1.0 eps_m))) (/ 1.0 (+ 1.0 (* x (+ 1.0 eps_m)))))
2.0)
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (- 1.0 (/ 1.0 eps_m))) 2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -5e-288) {
tmp = (1.0 + pow(((double) M_E), (x * (1.0 - eps_m)))) / 2.0;
} else if (x <= 6.8e+68) {
tmp = (1.0 + exp((x * eps_m))) / 2.0;
} else if (x <= 1.4e+77) {
tmp = ((exp(-x) + (-1.0 / exp(x))) / eps_m) / 2.0;
} else if ((x <= 7.5e+157) || !(x <= 7.2e+212)) {
tmp = (exp((x * (-1.0 + eps_m))) + (1.0 / (1.0 + (x * (1.0 + eps_m))))) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -5e-288) {
tmp = (1.0 + Math.pow(Math.E, (x * (1.0 - eps_m)))) / 2.0;
} else if (x <= 6.8e+68) {
tmp = (1.0 + Math.exp((x * eps_m))) / 2.0;
} else if (x <= 1.4e+77) {
tmp = ((Math.exp(-x) + (-1.0 / Math.exp(x))) / eps_m) / 2.0;
} else if ((x <= 7.5e+157) || !(x <= 7.2e+212)) {
tmp = (Math.exp((x * (-1.0 + eps_m))) + (1.0 / (1.0 + (x * (1.0 + eps_m))))) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -5e-288: tmp = (1.0 + math.pow(math.e, (x * (1.0 - eps_m)))) / 2.0 elif x <= 6.8e+68: tmp = (1.0 + math.exp((x * eps_m))) / 2.0 elif x <= 1.4e+77: tmp = ((math.exp(-x) + (-1.0 / math.exp(x))) / eps_m) / 2.0 elif (x <= 7.5e+157) or not (x <= 7.2e+212): tmp = (math.exp((x * (-1.0 + eps_m))) + (1.0 / (1.0 + (x * (1.0 + eps_m))))) / 2.0 else: tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -5e-288) tmp = Float64(Float64(1.0 + (exp(1) ^ Float64(x * Float64(1.0 - eps_m)))) / 2.0); elseif (x <= 6.8e+68) tmp = Float64(Float64(1.0 + exp(Float64(x * eps_m))) / 2.0); elseif (x <= 1.4e+77) tmp = Float64(Float64(Float64(exp(Float64(-x)) + Float64(-1.0 / exp(x))) / eps_m) / 2.0); elseif ((x <= 7.5e+157) || !(x <= 7.2e+212)) tmp = Float64(Float64(exp(Float64(x * Float64(-1.0 + eps_m))) + Float64(1.0 / Float64(1.0 + Float64(x * Float64(1.0 + eps_m))))) / 2.0); else tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 - Float64(1.0 / eps_m))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -5e-288) tmp = (1.0 + (2.71828182845904523536 ^ (x * (1.0 - eps_m)))) / 2.0; elseif (x <= 6.8e+68) tmp = (1.0 + exp((x * eps_m))) / 2.0; elseif (x <= 1.4e+77) tmp = ((exp(-x) + (-1.0 / exp(x))) / eps_m) / 2.0; elseif ((x <= 7.5e+157) || ~((x <= 7.2e+212))) tmp = (exp((x * (-1.0 + eps_m))) + (1.0 / (1.0 + (x * (1.0 + eps_m))))) / 2.0; else tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -5e-288], N[(N[(1.0 + N[Power[E, N[(x * N[(1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 6.8e+68], N[(N[(1.0 + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.4e+77], N[(N[(N[(N[Exp[(-x)], $MachinePrecision] + N[(-1.0 / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 7.5e+157], N[Not[LessEqual[x, 7.2e+212]], $MachinePrecision]], N[(N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[(1.0 + N[(x * N[(1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-288}:\\
\;\;\;\;\frac{1 + {e}^{\left(x \cdot \left(1 - eps\_m\right)\right)}}{2}\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{+68}:\\
\;\;\;\;\frac{1 + e^{x \cdot eps\_m}}{2}\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{+77}:\\
\;\;\;\;\frac{\frac{e^{-x} + \frac{-1}{e^{x}}}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{+157} \lor \neg \left(x \leq 7.2 \cdot 10^{+212}\right):\\
\;\;\;\;\frac{e^{x \cdot \left(-1 + eps\_m\right)} + \frac{1}{1 + x \cdot \left(1 + eps\_m\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 - \frac{1}{eps\_m}\right)}{2}\\
\end{array}
\end{array}
if x < -5.00000000000000011e-288Initial program 70.8%
Simplified70.8%
Taylor expanded in x around 0 45.5%
Taylor expanded in eps around inf 71.6%
neg-mul-171.6%
distribute-lft-neg-in71.6%
Simplified71.6%
*-un-lft-identity71.6%
exp-prod71.6%
add-sqr-sqrt71.6%
sqrt-unprod68.8%
sqr-neg68.8%
sqrt-unprod0.0%
add-sqr-sqrt66.1%
Applied egg-rr66.1%
if -5.00000000000000011e-288 < x < 6.8000000000000003e68Initial program 63.1%
Simplified63.1%
Taylor expanded in x around 0 44.1%
Taylor expanded in eps around inf 80.6%
neg-mul-180.6%
distribute-lft-neg-in80.6%
Simplified80.6%
Taylor expanded in eps around inf 81.0%
if 6.8000000000000003e68 < x < 1.4e77Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 100.0%
if 1.4e77 < x < 7.5e157 or 7.2e212 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 33.1%
if 7.5e157 < x < 7.2e212Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 24.0%
Taylor expanded in x around 0 78.5%
Final simplification69.4%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* x (+ -1.0 eps_m))) (/ 1.0 (exp (+ x (* x eps_m))))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * (-1.0 + eps_m))) + (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 * ((-1.0d0) + eps_m))) + (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 * (-1.0 + eps_m))) + (1.0 / Math.exp((x + (x * eps_m))))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.exp((x * (-1.0 + eps_m))) + (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(-1.0 + eps_m))) + 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 * (-1.0 + eps_m))) + (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[(-1.0 + eps$95$m), $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(-1 + eps\_m\right)} + \frac{1}{e^{x + x \cdot eps\_m}}}{2}
\end{array}
Initial program 75.0%
Simplified66.8%
Taylor expanded in eps around inf 98.9%
Final simplification98.9%
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 75.0%
Simplified75.0%
Taylor expanded in eps around inf 98.9%
Final simplification98.9%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -2e-284)
(/ (+ 1.0 (exp (- x (* x eps_m)))) 2.0)
(if (<= x 6.6e+67)
(/ (+ 1.0 (exp (* x eps_m))) 2.0)
(if (or (<= x 1.4e+77) (and (not (<= x 6.5e+157)) (<= x 2.05e+212)))
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (- 1.0 (/ 1.0 eps_m))) 2.0)
(/
(+ (exp (* x (+ -1.0 eps_m))) (/ 1.0 (+ 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-284) {
tmp = (1.0 + exp((x - (x * eps_m)))) / 2.0;
} else if (x <= 6.6e+67) {
tmp = (1.0 + exp((x * eps_m))) / 2.0;
} else if ((x <= 1.4e+77) || (!(x <= 6.5e+157) && (x <= 2.05e+212))) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = (exp((x * (-1.0 + eps_m))) + (1.0 / (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-284)) then
tmp = (1.0d0 + exp((x - (x * eps_m)))) / 2.0d0
else if (x <= 6.6d+67) then
tmp = (1.0d0 + exp((x * eps_m))) / 2.0d0
else if ((x <= 1.4d+77) .or. (.not. (x <= 6.5d+157)) .and. (x <= 2.05d+212)) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 - (1.0d0 / eps_m))) / 2.0d0
else
tmp = (exp((x * ((-1.0d0) + eps_m))) + (1.0d0 / (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-284) {
tmp = (1.0 + Math.exp((x - (x * eps_m)))) / 2.0;
} else if (x <= 6.6e+67) {
tmp = (1.0 + Math.exp((x * eps_m))) / 2.0;
} else if ((x <= 1.4e+77) || (!(x <= 6.5e+157) && (x <= 2.05e+212))) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = (Math.exp((x * (-1.0 + eps_m))) + (1.0 / (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-284: tmp = (1.0 + math.exp((x - (x * eps_m)))) / 2.0 elif x <= 6.6e+67: tmp = (1.0 + math.exp((x * eps_m))) / 2.0 elif (x <= 1.4e+77) or (not (x <= 6.5e+157) and (x <= 2.05e+212)): tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0 else: tmp = (math.exp((x * (-1.0 + eps_m))) + (1.0 / (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-284) tmp = Float64(Float64(1.0 + exp(Float64(x - Float64(x * eps_m)))) / 2.0); elseif (x <= 6.6e+67) tmp = Float64(Float64(1.0 + exp(Float64(x * eps_m))) / 2.0); elseif ((x <= 1.4e+77) || (!(x <= 6.5e+157) && (x <= 2.05e+212))) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 - Float64(1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(-1.0 + eps_m))) + Float64(1.0 / Float64(1.0 + Float64(x * 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 <= -2e-284) tmp = (1.0 + exp((x - (x * eps_m)))) / 2.0; elseif (x <= 6.6e+67) tmp = (1.0 + exp((x * eps_m))) / 2.0; elseif ((x <= 1.4e+77) || (~((x <= 6.5e+157)) && (x <= 2.05e+212))) tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0; else tmp = (exp((x * (-1.0 + eps_m))) + (1.0 / (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-284], N[(N[(1.0 + N[Exp[N[(x - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 6.6e+67], N[(N[(1.0 + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 1.4e+77], And[N[Not[LessEqual[x, 6.5e+157]], $MachinePrecision], LessEqual[x, 2.05e+212]]], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[(1.0 + N[(x * N[(1.0 + eps$95$m), $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^{-284}:\\
\;\;\;\;\frac{1 + e^{x - x \cdot eps\_m}}{2}\\
\mathbf{elif}\;x \leq 6.6 \cdot 10^{+67}:\\
\;\;\;\;\frac{1 + e^{x \cdot eps\_m}}{2}\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{+77} \lor \neg \left(x \leq 6.5 \cdot 10^{+157}\right) \land x \leq 2.05 \cdot 10^{+212}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 - \frac{1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(-1 + eps\_m\right)} + \frac{1}{1 + x \cdot \left(1 + eps\_m\right)}}{2}\\
\end{array}
\end{array}
if x < -2.00000000000000007e-284Initial program 70.8%
Simplified70.8%
Taylor expanded in x around 0 45.5%
Taylor expanded in eps around inf 71.6%
neg-mul-171.6%
distribute-lft-neg-in71.6%
Simplified71.6%
add-sqr-sqrt71.6%
sqrt-unprod68.8%
sqr-neg68.8%
sqrt-unprod0.0%
add-sqr-sqrt66.1%
sub-neg66.1%
distribute-rgt-in66.1%
*-un-lft-identity66.1%
Applied egg-rr66.1%
if -2.00000000000000007e-284 < x < 6.6000000000000006e67Initial program 63.1%
Simplified63.1%
Taylor expanded in x around 0 44.1%
Taylor expanded in eps around inf 80.6%
neg-mul-180.6%
distribute-lft-neg-in80.6%
Simplified80.6%
Taylor expanded in eps around inf 81.0%
if 6.6000000000000006e67 < x < 1.4e77 or 6.5e157 < x < 2.04999999999999995e212Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 16.2%
Taylor expanded in x around 0 79.2%
if 1.4e77 < x < 6.5e157 or 2.04999999999999995e212 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 33.1%
Final simplification68.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -5e-288)
(/ (+ 1.0 (pow E (* x (- 1.0 eps_m)))) 2.0)
(if (<= x 9e+68)
(/ (+ 1.0 (exp (* x eps_m))) 2.0)
(if (or (<= x 1.45e+77) (and (not (<= x 3.7e+157)) (<= x 1.62e+212)))
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (- 1.0 (/ 1.0 eps_m))) 2.0)
(/
(+ (exp (* x (+ -1.0 eps_m))) (/ 1.0 (+ 1.0 (* x (+ 1.0 eps_m)))))
2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -5e-288) {
tmp = (1.0 + pow(((double) M_E), (x * (1.0 - eps_m)))) / 2.0;
} else if (x <= 9e+68) {
tmp = (1.0 + exp((x * eps_m))) / 2.0;
} else if ((x <= 1.45e+77) || (!(x <= 3.7e+157) && (x <= 1.62e+212))) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = (exp((x * (-1.0 + eps_m))) + (1.0 / (1.0 + (x * (1.0 + eps_m))))) / 2.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -5e-288) {
tmp = (1.0 + Math.pow(Math.E, (x * (1.0 - eps_m)))) / 2.0;
} else if (x <= 9e+68) {
tmp = (1.0 + Math.exp((x * eps_m))) / 2.0;
} else if ((x <= 1.45e+77) || (!(x <= 3.7e+157) && (x <= 1.62e+212))) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = (Math.exp((x * (-1.0 + eps_m))) + (1.0 / (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 <= -5e-288: tmp = (1.0 + math.pow(math.e, (x * (1.0 - eps_m)))) / 2.0 elif x <= 9e+68: tmp = (1.0 + math.exp((x * eps_m))) / 2.0 elif (x <= 1.45e+77) or (not (x <= 3.7e+157) and (x <= 1.62e+212)): tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0 else: tmp = (math.exp((x * (-1.0 + eps_m))) + (1.0 / (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 <= -5e-288) tmp = Float64(Float64(1.0 + (exp(1) ^ Float64(x * Float64(1.0 - eps_m)))) / 2.0); elseif (x <= 9e+68) tmp = Float64(Float64(1.0 + exp(Float64(x * eps_m))) / 2.0); elseif ((x <= 1.45e+77) || (!(x <= 3.7e+157) && (x <= 1.62e+212))) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 - Float64(1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(-1.0 + eps_m))) + Float64(1.0 / Float64(1.0 + Float64(x * 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 <= -5e-288) tmp = (1.0 + (2.71828182845904523536 ^ (x * (1.0 - eps_m)))) / 2.0; elseif (x <= 9e+68) tmp = (1.0 + exp((x * eps_m))) / 2.0; elseif ((x <= 1.45e+77) || (~((x <= 3.7e+157)) && (x <= 1.62e+212))) tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0; else tmp = (exp((x * (-1.0 + eps_m))) + (1.0 / (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, -5e-288], N[(N[(1.0 + N[Power[E, N[(x * N[(1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 9e+68], N[(N[(1.0 + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 1.45e+77], And[N[Not[LessEqual[x, 3.7e+157]], $MachinePrecision], LessEqual[x, 1.62e+212]]], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[(1.0 + N[(x * N[(1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-288}:\\
\;\;\;\;\frac{1 + {e}^{\left(x \cdot \left(1 - eps\_m\right)\right)}}{2}\\
\mathbf{elif}\;x \leq 9 \cdot 10^{+68}:\\
\;\;\;\;\frac{1 + e^{x \cdot eps\_m}}{2}\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{+77} \lor \neg \left(x \leq 3.7 \cdot 10^{+157}\right) \land x \leq 1.62 \cdot 10^{+212}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 - \frac{1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(-1 + eps\_m\right)} + \frac{1}{1 + x \cdot \left(1 + eps\_m\right)}}{2}\\
\end{array}
\end{array}
if x < -5.00000000000000011e-288Initial program 70.8%
Simplified70.8%
Taylor expanded in x around 0 45.5%
Taylor expanded in eps around inf 71.6%
neg-mul-171.6%
distribute-lft-neg-in71.6%
Simplified71.6%
*-un-lft-identity71.6%
exp-prod71.6%
add-sqr-sqrt71.6%
sqrt-unprod68.8%
sqr-neg68.8%
sqrt-unprod0.0%
add-sqr-sqrt66.1%
Applied egg-rr66.1%
if -5.00000000000000011e-288 < x < 9.0000000000000007e68Initial program 63.1%
Simplified63.1%
Taylor expanded in x around 0 44.1%
Taylor expanded in eps around inf 80.6%
neg-mul-180.6%
distribute-lft-neg-in80.6%
Simplified80.6%
Taylor expanded in eps around inf 81.0%
if 9.0000000000000007e68 < x < 1.4500000000000001e77 or 3.6999999999999999e157 < x < 1.61999999999999994e212Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 16.2%
Taylor expanded in x around 0 79.2%
if 1.4500000000000001e77 < x < 3.6999999999999999e157 or 1.61999999999999994e212 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 33.1%
Final simplification68.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -5e-288)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (<= x 8.5e+68)
(/ (+ 1.0 (exp (* x eps_m))) 2.0)
(if (or (<= x 1.4e+77) (and (not (<= x 1.65e+155)) (<= x 1.38e+212)))
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (- 1.0 (/ 1.0 eps_m))) 2.0)
(/ (+ 1.0 (exp (* x (+ -1.0 eps_m)))) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -5e-288) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 8.5e+68) {
tmp = (1.0 + exp((x * eps_m))) / 2.0;
} else if ((x <= 1.4e+77) || (!(x <= 1.65e+155) && (x <= 1.38e+212))) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = (1.0 + exp((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 <= (-5d-288)) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= 8.5d+68) then
tmp = (1.0d0 + exp((x * eps_m))) / 2.0d0
else if ((x <= 1.4d+77) .or. (.not. (x <= 1.65d+155)) .and. (x <= 1.38d+212)) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 - (1.0d0 / eps_m))) / 2.0d0
else
tmp = (1.0d0 + exp((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 <= -5e-288) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 8.5e+68) {
tmp = (1.0 + Math.exp((x * eps_m))) / 2.0;
} else if ((x <= 1.4e+77) || (!(x <= 1.65e+155) && (x <= 1.38e+212))) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = (1.0 + Math.exp((x * (-1.0 + eps_m)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -5e-288: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 8.5e+68: tmp = (1.0 + math.exp((x * eps_m))) / 2.0 elif (x <= 1.4e+77) or (not (x <= 1.65e+155) and (x <= 1.38e+212)): tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0 else: tmp = (1.0 + math.exp((x * (-1.0 + eps_m)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -5e-288) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 8.5e+68) tmp = Float64(Float64(1.0 + exp(Float64(x * eps_m))) / 2.0); elseif ((x <= 1.4e+77) || (!(x <= 1.65e+155) && (x <= 1.38e+212))) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 - Float64(1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(1.0 + exp(Float64(x * 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 <= -5e-288) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= 8.5e+68) tmp = (1.0 + exp((x * eps_m))) / 2.0; elseif ((x <= 1.4e+77) || (~((x <= 1.65e+155)) && (x <= 1.38e+212))) tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0; else tmp = (1.0 + exp((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, -5e-288], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 8.5e+68], N[(N[(1.0 + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 1.4e+77], And[N[Not[LessEqual[x, 1.65e+155]], $MachinePrecision], LessEqual[x, 1.38e+212]]], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + 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|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-288}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{+68}:\\
\;\;\;\;\frac{1 + e^{x \cdot eps\_m}}{2}\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{+77} \lor \neg \left(x \leq 1.65 \cdot 10^{+155}\right) \land x \leq 1.38 \cdot 10^{+212}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 - \frac{1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 + eps\_m\right)}}{2}\\
\end{array}
\end{array}
if x < -5.00000000000000011e-288Initial program 70.8%
Simplified70.8%
Taylor expanded in x around 0 45.5%
Taylor expanded in eps around inf 71.6%
neg-mul-171.6%
distribute-lft-neg-in71.6%
Simplified71.6%
Taylor expanded in eps around 0 77.0%
if -5.00000000000000011e-288 < x < 8.49999999999999966e68Initial program 63.1%
Simplified63.1%
Taylor expanded in x around 0 44.1%
Taylor expanded in eps around inf 80.6%
neg-mul-180.6%
distribute-lft-neg-in80.6%
Simplified80.6%
Taylor expanded in eps around inf 81.0%
if 8.49999999999999966e68 < x < 1.4e77 or 1.6499999999999999e155 < x < 1.38e212Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 16.2%
Taylor expanded in x around 0 79.2%
if 1.4e77 < x < 1.6499999999999999e155 or 1.38e212 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 32.2%
Taylor expanded in eps around inf 32.5%
neg-mul-132.5%
distribute-lft-neg-in32.5%
Simplified32.5%
Final simplification72.9%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -4e-288)
(/ (+ 1.0 (exp (- x (* x eps_m)))) 2.0)
(if (<= x 4.4e+68)
(/ (+ 1.0 (exp (* x eps_m))) 2.0)
(if (or (<= x 1.85e+77) (and (not (<= x 3.6e+154)) (<= x 7.5e+212)))
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (- 1.0 (/ 1.0 eps_m))) 2.0)
(/ (+ 1.0 (exp (* x (+ -1.0 eps_m)))) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -4e-288) {
tmp = (1.0 + exp((x - (x * eps_m)))) / 2.0;
} else if (x <= 4.4e+68) {
tmp = (1.0 + exp((x * eps_m))) / 2.0;
} else if ((x <= 1.85e+77) || (!(x <= 3.6e+154) && (x <= 7.5e+212))) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = (1.0 + exp((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 <= (-4d-288)) then
tmp = (1.0d0 + exp((x - (x * eps_m)))) / 2.0d0
else if (x <= 4.4d+68) then
tmp = (1.0d0 + exp((x * eps_m))) / 2.0d0
else if ((x <= 1.85d+77) .or. (.not. (x <= 3.6d+154)) .and. (x <= 7.5d+212)) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 - (1.0d0 / eps_m))) / 2.0d0
else
tmp = (1.0d0 + exp((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 <= -4e-288) {
tmp = (1.0 + Math.exp((x - (x * eps_m)))) / 2.0;
} else if (x <= 4.4e+68) {
tmp = (1.0 + Math.exp((x * eps_m))) / 2.0;
} else if ((x <= 1.85e+77) || (!(x <= 3.6e+154) && (x <= 7.5e+212))) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = (1.0 + Math.exp((x * (-1.0 + eps_m)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -4e-288: tmp = (1.0 + math.exp((x - (x * eps_m)))) / 2.0 elif x <= 4.4e+68: tmp = (1.0 + math.exp((x * eps_m))) / 2.0 elif (x <= 1.85e+77) or (not (x <= 3.6e+154) and (x <= 7.5e+212)): tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0 else: tmp = (1.0 + math.exp((x * (-1.0 + eps_m)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -4e-288) tmp = Float64(Float64(1.0 + exp(Float64(x - Float64(x * eps_m)))) / 2.0); elseif (x <= 4.4e+68) tmp = Float64(Float64(1.0 + exp(Float64(x * eps_m))) / 2.0); elseif ((x <= 1.85e+77) || (!(x <= 3.6e+154) && (x <= 7.5e+212))) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 - Float64(1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(1.0 + exp(Float64(x * 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 <= -4e-288) tmp = (1.0 + exp((x - (x * eps_m)))) / 2.0; elseif (x <= 4.4e+68) tmp = (1.0 + exp((x * eps_m))) / 2.0; elseif ((x <= 1.85e+77) || (~((x <= 3.6e+154)) && (x <= 7.5e+212))) tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0; else tmp = (1.0 + exp((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, -4e-288], N[(N[(1.0 + N[Exp[N[(x - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 4.4e+68], N[(N[(1.0 + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 1.85e+77], And[N[Not[LessEqual[x, 3.6e+154]], $MachinePrecision], LessEqual[x, 7.5e+212]]], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + 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|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-288}:\\
\;\;\;\;\frac{1 + e^{x - x \cdot eps\_m}}{2}\\
\mathbf{elif}\;x \leq 4.4 \cdot 10^{+68}:\\
\;\;\;\;\frac{1 + e^{x \cdot eps\_m}}{2}\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{+77} \lor \neg \left(x \leq 3.6 \cdot 10^{+154}\right) \land x \leq 7.5 \cdot 10^{+212}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 - \frac{1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 + eps\_m\right)}}{2}\\
\end{array}
\end{array}
if x < -4.00000000000000023e-288Initial program 70.8%
Simplified70.8%
Taylor expanded in x around 0 45.5%
Taylor expanded in eps around inf 71.6%
neg-mul-171.6%
distribute-lft-neg-in71.6%
Simplified71.6%
add-sqr-sqrt71.6%
sqrt-unprod68.8%
sqr-neg68.8%
sqrt-unprod0.0%
add-sqr-sqrt66.1%
sub-neg66.1%
distribute-rgt-in66.1%
*-un-lft-identity66.1%
Applied egg-rr66.1%
if -4.00000000000000023e-288 < x < 4.39999999999999974e68Initial program 63.1%
Simplified63.1%
Taylor expanded in x around 0 44.1%
Taylor expanded in eps around inf 80.6%
neg-mul-180.6%
distribute-lft-neg-in80.6%
Simplified80.6%
Taylor expanded in eps around inf 81.0%
if 4.39999999999999974e68 < x < 1.84999999999999997e77 or 3.6000000000000001e154 < x < 7.5000000000000003e212Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 16.2%
Taylor expanded in x around 0 79.2%
if 1.84999999999999997e77 < x < 3.6000000000000001e154 or 7.5000000000000003e212 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 32.2%
Taylor expanded in eps around inf 32.5%
neg-mul-132.5%
distribute-lft-neg-in32.5%
Simplified32.5%
Final simplification68.6%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -2e-287)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (or (<= x 4.8e+68)
(not
(or (<= x 2e+77) (and (not (<= x 3.35e+156)) (<= x 6.6e+212)))))
(/ (+ 1.0 (exp (* x eps_m))) 2.0)
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (- 1.0 (/ 1.0 eps_m))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -2e-287) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if ((x <= 4.8e+68) || !((x <= 2e+77) || (!(x <= 3.35e+156) && (x <= 6.6e+212)))) {
tmp = (1.0 + exp((x * eps_m))) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-2d-287)) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if ((x <= 4.8d+68) .or. (.not. (x <= 2d+77) .or. (.not. (x <= 3.35d+156)) .and. (x <= 6.6d+212))) then
tmp = (1.0d0 + exp((x * eps_m))) / 2.0d0
else
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 - (1.0d0 / eps_m))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -2e-287) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if ((x <= 4.8e+68) || !((x <= 2e+77) || (!(x <= 3.35e+156) && (x <= 6.6e+212)))) {
tmp = (1.0 + Math.exp((x * eps_m))) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -2e-287: tmp = (1.0 + math.exp(-x)) / 2.0 elif (x <= 4.8e+68) or not ((x <= 2e+77) or (not (x <= 3.35e+156) and (x <= 6.6e+212))): tmp = (1.0 + math.exp((x * eps_m))) / 2.0 else: tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -2e-287) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif ((x <= 4.8e+68) || !((x <= 2e+77) || (!(x <= 3.35e+156) && (x <= 6.6e+212)))) tmp = Float64(Float64(1.0 + exp(Float64(x * eps_m))) / 2.0); else tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 - Float64(1.0 / eps_m))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -2e-287) tmp = (1.0 + exp(-x)) / 2.0; elseif ((x <= 4.8e+68) || ~(((x <= 2e+77) || (~((x <= 3.35e+156)) && (x <= 6.6e+212))))) tmp = (1.0 + exp((x * eps_m))) / 2.0; else tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -2e-287], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 4.8e+68], N[Not[Or[LessEqual[x, 2e+77], And[N[Not[LessEqual[x, 3.35e+156]], $MachinePrecision], LessEqual[x, 6.6e+212]]]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-287}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{+68} \lor \neg \left(x \leq 2 \cdot 10^{+77} \lor \neg \left(x \leq 3.35 \cdot 10^{+156}\right) \land x \leq 6.6 \cdot 10^{+212}\right):\\
\;\;\;\;\frac{1 + e^{x \cdot eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 - \frac{1}{eps\_m}\right)}{2}\\
\end{array}
\end{array}
if x < -2.00000000000000004e-287Initial program 70.8%
Simplified70.8%
Taylor expanded in x around 0 45.5%
Taylor expanded in eps around inf 71.6%
neg-mul-171.6%
distribute-lft-neg-in71.6%
Simplified71.6%
Taylor expanded in eps around 0 77.0%
if -2.00000000000000004e-287 < x < 4.80000000000000016e68 or 1.99999999999999997e77 < x < 3.35e156 or 6.6e212 < x Initial program 72.9%
Simplified72.9%
Taylor expanded in x around 0 40.9%
Taylor expanded in eps around inf 67.9%
neg-mul-167.9%
distribute-lft-neg-in67.9%
Simplified67.9%
Taylor expanded in eps around inf 68.1%
if 4.80000000000000016e68 < x < 1.99999999999999997e77 or 3.35e156 < x < 6.6e212Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 16.2%
Taylor expanded in x around 0 79.2%
Final simplification72.9%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -210000000.0)
(/ (/ (expm1 (- x)) eps_m) 2.0)
(if (<= x 1.12e-10)
(/
(+
2.0
(*
x
(- (+ (/ -1.0 eps_m) (* (- 1.0 eps_m) (+ -1.0 (/ 1.0 eps_m)))) eps_m)))
2.0)
(if (or (<= x 3.7e+213) (not (<= x 5.2e+303)))
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (- 1.0 (/ 1.0 eps_m))) 2.0)
(/ (* x eps_m) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -210000000.0) {
tmp = (expm1(-x) / eps_m) / 2.0;
} else if (x <= 1.12e-10) {
tmp = (2.0 + (x * (((-1.0 / eps_m) + ((1.0 - eps_m) * (-1.0 + (1.0 / eps_m)))) - eps_m))) / 2.0;
} else if ((x <= 3.7e+213) || !(x <= 5.2e+303)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -210000000.0) {
tmp = (Math.expm1(-x) / eps_m) / 2.0;
} else if (x <= 1.12e-10) {
tmp = (2.0 + (x * (((-1.0 / eps_m) + ((1.0 - eps_m) * (-1.0 + (1.0 / eps_m)))) - eps_m))) / 2.0;
} else if ((x <= 3.7e+213) || !(x <= 5.2e+303)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -210000000.0: tmp = (math.expm1(-x) / eps_m) / 2.0 elif x <= 1.12e-10: tmp = (2.0 + (x * (((-1.0 / eps_m) + ((1.0 - eps_m) * (-1.0 + (1.0 / eps_m)))) - eps_m))) / 2.0 elif (x <= 3.7e+213) or not (x <= 5.2e+303): tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0 else: tmp = (x * eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -210000000.0) tmp = Float64(Float64(expm1(Float64(-x)) / eps_m) / 2.0); elseif (x <= 1.12e-10) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(-1.0 / eps_m) + Float64(Float64(1.0 - eps_m) * Float64(-1.0 + Float64(1.0 / eps_m)))) - eps_m))) / 2.0); elseif ((x <= 3.7e+213) || !(x <= 5.2e+303)) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 - Float64(1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(x * eps_m) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -210000000.0], N[(N[(N[(Exp[(-x)] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.12e-10], N[(N[(2.0 + N[(x * N[(N[(N[(-1.0 / eps$95$m), $MachinePrecision] + N[(N[(1.0 - eps$95$m), $MachinePrecision] * N[(-1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 3.7e+213], N[Not[LessEqual[x, 5.2e+303]], $MachinePrecision]], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x * eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -210000000:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(-x\right)}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq 1.12 \cdot 10^{-10}:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(\frac{-1}{eps\_m} + \left(1 - eps\_m\right) \cdot \left(-1 + \frac{1}{eps\_m}\right)\right) - eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 3.7 \cdot 10^{+213} \lor \neg \left(x \leq 5.2 \cdot 10^{+303}\right):\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 - \frac{1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < -2.1e8Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 55.5%
Taylor expanded in eps around 0 45.9%
expm1-define45.9%
mul-1-neg45.9%
Simplified45.9%
if -2.1e8 < x < 1.12e-10Initial program 52.9%
Simplified37.5%
Taylor expanded in x around 0 70.7%
+-commutative70.7%
*-un-lft-identity70.7%
fma-define70.7%
add-sqr-sqrt28.9%
sqrt-unprod38.3%
frac-times37.6%
metadata-eval37.6%
metadata-eval37.6%
frac-times38.3%
sqrt-unprod20.8%
add-sqr-sqrt38.0%
add-sqr-sqrt17.2%
sqrt-unprod38.2%
frac-times37.5%
metadata-eval37.5%
metadata-eval37.5%
frac-times38.2%
sqrt-unprod29.3%
add-sqr-sqrt70.7%
sub-neg70.7%
metadata-eval70.7%
Applied egg-rr70.7%
fma-undefine70.7%
*-lft-identity70.7%
+-commutative70.7%
Simplified70.7%
if 1.12e-10 < x < 3.69999999999999993e213 or 5.20000000000000024e303 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 30.4%
Taylor expanded in x around 0 50.8%
if 3.69999999999999993e213 < x < 5.20000000000000024e303Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 46.5%
Taylor expanded in x around inf 26.5%
mul-1-neg26.5%
*-commutative26.5%
distribute-rgt-neg-in26.5%
distribute-rgt-neg-in26.5%
mul-1-neg26.5%
distribute-lft-in26.5%
metadata-eval26.5%
neg-mul-126.5%
distribute-neg-frac26.5%
metadata-eval26.5%
Simplified26.5%
Taylor expanded in eps around inf 26.7%
*-commutative26.7%
Simplified26.7%
Final simplification58.8%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 1.12e-10)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (or (<= x 2.7e+214) (not (<= x 2.1e+303)))
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (- 1.0 (/ 1.0 eps_m))) 2.0)
(/ (* x eps_m) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1.12e-10) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if ((x <= 2.7e+214) || !(x <= 2.1e+303)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = (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 <= 1.12d-10) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if ((x <= 2.7d+214) .or. (.not. (x <= 2.1d+303))) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 - (1.0d0 / eps_m))) / 2.0d0
else
tmp = (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 <= 1.12e-10) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if ((x <= 2.7e+214) || !(x <= 2.1e+303)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1.12e-10: tmp = (1.0 + math.exp(-x)) / 2.0 elif (x <= 2.7e+214) or not (x <= 2.1e+303): tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0 else: tmp = (x * eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1.12e-10) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif ((x <= 2.7e+214) || !(x <= 2.1e+303)) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 - Float64(1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(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 <= 1.12e-10) tmp = (1.0 + exp(-x)) / 2.0; elseif ((x <= 2.7e+214) || ~((x <= 2.1e+303))) tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0; else tmp = (x * eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 1.12e-10], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 2.7e+214], N[Not[LessEqual[x, 2.1e+303]], $MachinePrecision]], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x * eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.12 \cdot 10^{-10}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{+214} \lor \neg \left(x \leq 2.1 \cdot 10^{+303}\right):\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 - \frac{1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < 1.12e-10Initial program 63.0%
Simplified63.0%
Taylor expanded in x around 0 44.0%
Taylor expanded in eps around inf 78.9%
neg-mul-178.9%
distribute-lft-neg-in78.9%
Simplified78.9%
Taylor expanded in eps around 0 76.6%
if 1.12e-10 < x < 2.70000000000000009e214 or 2.1e303 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 30.4%
Taylor expanded in x around 0 50.8%
if 2.70000000000000009e214 < x < 2.1e303Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 46.5%
Taylor expanded in x around inf 26.5%
mul-1-neg26.5%
*-commutative26.5%
distribute-rgt-neg-in26.5%
distribute-rgt-neg-in26.5%
mul-1-neg26.5%
distribute-lft-in26.5%
metadata-eval26.5%
neg-mul-126.5%
distribute-neg-frac26.5%
metadata-eval26.5%
Simplified26.5%
Taylor expanded in eps around inf 26.7%
*-commutative26.7%
Simplified26.7%
Final simplification66.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -0.0008)
(/ (+ 2.0 (* x (- (+ (/ 1.0 eps_m) (/ 1.0 eps_m)) eps_m))) 2.0)
(if (<= x 1.12e-10)
1.0
(if (or (<= x 1.22e+213) (not (<= x 1.35e+306)))
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (- 1.0 (/ 1.0 eps_m))) 2.0)
(/ (* x eps_m) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -0.0008) {
tmp = (2.0 + (x * (((1.0 / eps_m) + (1.0 / eps_m)) - eps_m))) / 2.0;
} else if (x <= 1.12e-10) {
tmp = 1.0;
} else if ((x <= 1.22e+213) || !(x <= 1.35e+306)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = (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 <= (-0.0008d0)) then
tmp = (2.0d0 + (x * (((1.0d0 / eps_m) + (1.0d0 / eps_m)) - eps_m))) / 2.0d0
else if (x <= 1.12d-10) then
tmp = 1.0d0
else if ((x <= 1.22d+213) .or. (.not. (x <= 1.35d+306))) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 - (1.0d0 / eps_m))) / 2.0d0
else
tmp = (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 <= -0.0008) {
tmp = (2.0 + (x * (((1.0 / eps_m) + (1.0 / eps_m)) - eps_m))) / 2.0;
} else if (x <= 1.12e-10) {
tmp = 1.0;
} else if ((x <= 1.22e+213) || !(x <= 1.35e+306)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -0.0008: tmp = (2.0 + (x * (((1.0 / eps_m) + (1.0 / eps_m)) - eps_m))) / 2.0 elif x <= 1.12e-10: tmp = 1.0 elif (x <= 1.22e+213) or not (x <= 1.35e+306): tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0 else: tmp = (x * eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -0.0008) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(1.0 / eps_m) + Float64(1.0 / eps_m)) - eps_m))) / 2.0); elseif (x <= 1.12e-10) tmp = 1.0; elseif ((x <= 1.22e+213) || !(x <= 1.35e+306)) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 - Float64(1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(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 <= -0.0008) tmp = (2.0 + (x * (((1.0 / eps_m) + (1.0 / eps_m)) - eps_m))) / 2.0; elseif (x <= 1.12e-10) tmp = 1.0; elseif ((x <= 1.22e+213) || ~((x <= 1.35e+306))) tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0; else tmp = (x * eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -0.0008], N[(N[(2.0 + N[(x * N[(N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.12e-10], 1.0, If[Or[LessEqual[x, 1.22e+213], N[Not[LessEqual[x, 1.35e+306]], $MachinePrecision]], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x * eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0008:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(\frac{1}{eps\_m} + \frac{1}{eps\_m}\right) - eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 1.12 \cdot 10^{-10}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.22 \cdot 10^{+213} \lor \neg \left(x \leq 1.35 \cdot 10^{+306}\right):\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 - \frac{1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < -8.00000000000000038e-4Initial program 95.0%
Simplified95.0%
Taylor expanded in x around 0 2.9%
add-sqr-sqrt1.3%
sqrt-unprod7.9%
frac-times7.9%
metadata-eval7.9%
metadata-eval7.9%
frac-times7.9%
sqrt-unprod1.7%
add-sqr-sqrt3.1%
div-inv3.1%
mul-1-neg3.1%
sub-neg3.1%
add-sqr-sqrt1.3%
sqrt-unprod3.0%
frac-times3.0%
metadata-eval3.0%
metadata-eval3.0%
frac-times3.0%
sqrt-unprod1.7%
add-sqr-sqrt3.0%
sub-neg3.0%
metadata-eval3.0%
add-sqr-sqrt1.3%
Applied egg-rr3.1%
Taylor expanded in eps around 0 26.1%
if -8.00000000000000038e-4 < x < 1.12e-10Initial program 53.4%
Simplified53.4%
Taylor expanded in x around 0 72.2%
if 1.12e-10 < x < 1.2199999999999999e213 or 1.3499999999999999e306 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 30.4%
Taylor expanded in x around 0 50.8%
if 1.2199999999999999e213 < x < 1.3499999999999999e306Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 46.5%
Taylor expanded in x around inf 26.5%
mul-1-neg26.5%
*-commutative26.5%
distribute-rgt-neg-in26.5%
distribute-rgt-neg-in26.5%
mul-1-neg26.5%
distribute-lft-in26.5%
metadata-eval26.5%
neg-mul-126.5%
distribute-neg-frac26.5%
metadata-eval26.5%
Simplified26.5%
Taylor expanded in eps around inf 26.7%
*-commutative26.7%
Simplified26.7%
Final simplification56.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -0.0008)
(/ (+ 2.0 (* x (- (+ (/ 1.0 eps_m) (- (/ 1.0 eps_m) 2.0)) eps_m))) 2.0)
(if (<= x 1.12e-10)
1.0
(if (or (<= x 2e+212) (not (<= x 3.8e+302)))
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (- 1.0 (/ 1.0 eps_m))) 2.0)
(/ (* x eps_m) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -0.0008) {
tmp = (2.0 + (x * (((1.0 / eps_m) + ((1.0 / eps_m) - 2.0)) - eps_m))) / 2.0;
} else if (x <= 1.12e-10) {
tmp = 1.0;
} else if ((x <= 2e+212) || !(x <= 3.8e+302)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = (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 <= (-0.0008d0)) then
tmp = (2.0d0 + (x * (((1.0d0 / eps_m) + ((1.0d0 / eps_m) - 2.0d0)) - eps_m))) / 2.0d0
else if (x <= 1.12d-10) then
tmp = 1.0d0
else if ((x <= 2d+212) .or. (.not. (x <= 3.8d+302))) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 - (1.0d0 / eps_m))) / 2.0d0
else
tmp = (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 <= -0.0008) {
tmp = (2.0 + (x * (((1.0 / eps_m) + ((1.0 / eps_m) - 2.0)) - eps_m))) / 2.0;
} else if (x <= 1.12e-10) {
tmp = 1.0;
} else if ((x <= 2e+212) || !(x <= 3.8e+302)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -0.0008: tmp = (2.0 + (x * (((1.0 / eps_m) + ((1.0 / eps_m) - 2.0)) - eps_m))) / 2.0 elif x <= 1.12e-10: tmp = 1.0 elif (x <= 2e+212) or not (x <= 3.8e+302): tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0 else: tmp = (x * eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -0.0008) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(1.0 / eps_m) + Float64(Float64(1.0 / eps_m) - 2.0)) - eps_m))) / 2.0); elseif (x <= 1.12e-10) tmp = 1.0; elseif ((x <= 2e+212) || !(x <= 3.8e+302)) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 - Float64(1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(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 <= -0.0008) tmp = (2.0 + (x * (((1.0 / eps_m) + ((1.0 / eps_m) - 2.0)) - eps_m))) / 2.0; elseif (x <= 1.12e-10) tmp = 1.0; elseif ((x <= 2e+212) || ~((x <= 3.8e+302))) tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0; else tmp = (x * eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -0.0008], N[(N[(2.0 + N[(x * N[(N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(N[(1.0 / eps$95$m), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision] - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.12e-10], 1.0, If[Or[LessEqual[x, 2e+212], N[Not[LessEqual[x, 3.8e+302]], $MachinePrecision]], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x * eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0008:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(\frac{1}{eps\_m} + \left(\frac{1}{eps\_m} - 2\right)\right) - eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 1.12 \cdot 10^{-10}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+212} \lor \neg \left(x \leq 3.8 \cdot 10^{+302}\right):\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 - \frac{1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < -8.00000000000000038e-4Initial program 95.0%
Simplified95.0%
Taylor expanded in x around 0 2.9%
add-sqr-sqrt1.3%
sqrt-unprod7.9%
frac-times7.9%
metadata-eval7.9%
metadata-eval7.9%
frac-times7.9%
sqrt-unprod1.7%
add-sqr-sqrt3.1%
div-inv3.1%
mul-1-neg3.1%
sub-neg3.1%
add-sqr-sqrt1.3%
sqrt-unprod3.0%
frac-times3.0%
metadata-eval3.0%
metadata-eval3.0%
frac-times3.0%
sqrt-unprod1.7%
add-sqr-sqrt3.0%
sub-neg3.0%
metadata-eval3.0%
add-sqr-sqrt1.3%
Applied egg-rr3.1%
Taylor expanded in eps around 0 26.1%
if -8.00000000000000038e-4 < x < 1.12e-10Initial program 53.4%
Simplified53.4%
Taylor expanded in x around 0 72.2%
if 1.12e-10 < x < 1.9999999999999998e212 or 3.8000000000000004e302 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 30.4%
Taylor expanded in x around 0 50.8%
if 1.9999999999999998e212 < x < 3.8000000000000004e302Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 46.5%
Taylor expanded in x around inf 26.5%
mul-1-neg26.5%
*-commutative26.5%
distribute-rgt-neg-in26.5%
distribute-rgt-neg-in26.5%
mul-1-neg26.5%
distribute-lft-in26.5%
metadata-eval26.5%
neg-mul-126.5%
distribute-neg-frac26.5%
metadata-eval26.5%
Simplified26.5%
Taylor expanded in eps around inf 26.7%
*-commutative26.7%
Simplified26.7%
Final simplification56.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -0.0008)
(/ (+ 2.0 (* x (- (+ (/ 1.0 eps_m) (- (/ 1.0 eps_m) 2.0)) eps_m))) 2.0)
(if (<= x 1.12e-10)
(/
(+
2.0
(*
x
(- (+ (/ 1.0 eps_m) (* (- 1.0 eps_m) (- -1.0 (/ 1.0 eps_m)))) eps_m)))
2.0)
(if (or (<= x 3.6e+212) (not (<= x 4.3e+306)))
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (- 1.0 (/ 1.0 eps_m))) 2.0)
(/ (* x eps_m) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -0.0008) {
tmp = (2.0 + (x * (((1.0 / eps_m) + ((1.0 / eps_m) - 2.0)) - eps_m))) / 2.0;
} else if (x <= 1.12e-10) {
tmp = (2.0 + (x * (((1.0 / eps_m) + ((1.0 - eps_m) * (-1.0 - (1.0 / eps_m)))) - eps_m))) / 2.0;
} else if ((x <= 3.6e+212) || !(x <= 4.3e+306)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = (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 <= (-0.0008d0)) then
tmp = (2.0d0 + (x * (((1.0d0 / eps_m) + ((1.0d0 / eps_m) - 2.0d0)) - eps_m))) / 2.0d0
else if (x <= 1.12d-10) then
tmp = (2.0d0 + (x * (((1.0d0 / eps_m) + ((1.0d0 - eps_m) * ((-1.0d0) - (1.0d0 / eps_m)))) - eps_m))) / 2.0d0
else if ((x <= 3.6d+212) .or. (.not. (x <= 4.3d+306))) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 - (1.0d0 / eps_m))) / 2.0d0
else
tmp = (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 <= -0.0008) {
tmp = (2.0 + (x * (((1.0 / eps_m) + ((1.0 / eps_m) - 2.0)) - eps_m))) / 2.0;
} else if (x <= 1.12e-10) {
tmp = (2.0 + (x * (((1.0 / eps_m) + ((1.0 - eps_m) * (-1.0 - (1.0 / eps_m)))) - eps_m))) / 2.0;
} else if ((x <= 3.6e+212) || !(x <= 4.3e+306)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -0.0008: tmp = (2.0 + (x * (((1.0 / eps_m) + ((1.0 / eps_m) - 2.0)) - eps_m))) / 2.0 elif x <= 1.12e-10: tmp = (2.0 + (x * (((1.0 / eps_m) + ((1.0 - eps_m) * (-1.0 - (1.0 / eps_m)))) - eps_m))) / 2.0 elif (x <= 3.6e+212) or not (x <= 4.3e+306): tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0 else: tmp = (x * eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -0.0008) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(1.0 / eps_m) + Float64(Float64(1.0 / eps_m) - 2.0)) - eps_m))) / 2.0); elseif (x <= 1.12e-10) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(1.0 / eps_m) + Float64(Float64(1.0 - eps_m) * Float64(-1.0 - Float64(1.0 / eps_m)))) - eps_m))) / 2.0); elseif ((x <= 3.6e+212) || !(x <= 4.3e+306)) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 - Float64(1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(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 <= -0.0008) tmp = (2.0 + (x * (((1.0 / eps_m) + ((1.0 / eps_m) - 2.0)) - eps_m))) / 2.0; elseif (x <= 1.12e-10) tmp = (2.0 + (x * (((1.0 / eps_m) + ((1.0 - eps_m) * (-1.0 - (1.0 / eps_m)))) - eps_m))) / 2.0; elseif ((x <= 3.6e+212) || ~((x <= 4.3e+306))) tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0; else tmp = (x * eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -0.0008], N[(N[(2.0 + N[(x * N[(N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(N[(1.0 / eps$95$m), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision] - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.12e-10], N[(N[(2.0 + N[(x * N[(N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(N[(1.0 - eps$95$m), $MachinePrecision] * N[(-1.0 - N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 3.6e+212], N[Not[LessEqual[x, 4.3e+306]], $MachinePrecision]], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x * eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0008:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(\frac{1}{eps\_m} + \left(\frac{1}{eps\_m} - 2\right)\right) - eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 1.12 \cdot 10^{-10}:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(\frac{1}{eps\_m} + \left(1 - eps\_m\right) \cdot \left(-1 - \frac{1}{eps\_m}\right)\right) - eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{+212} \lor \neg \left(x \leq 4.3 \cdot 10^{+306}\right):\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 - \frac{1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < -8.00000000000000038e-4Initial program 95.0%
Simplified95.0%
Taylor expanded in x around 0 2.9%
add-sqr-sqrt1.3%
sqrt-unprod7.9%
frac-times7.9%
metadata-eval7.9%
metadata-eval7.9%
frac-times7.9%
sqrt-unprod1.7%
add-sqr-sqrt3.1%
div-inv3.1%
mul-1-neg3.1%
sub-neg3.1%
add-sqr-sqrt1.3%
sqrt-unprod3.0%
frac-times3.0%
metadata-eval3.0%
metadata-eval3.0%
frac-times3.0%
sqrt-unprod1.7%
add-sqr-sqrt3.0%
sub-neg3.0%
metadata-eval3.0%
add-sqr-sqrt1.3%
Applied egg-rr3.1%
Taylor expanded in eps around 0 26.1%
if -8.00000000000000038e-4 < x < 1.12e-10Initial program 53.4%
Simplified37.6%
Taylor expanded in x around 0 72.2%
if 1.12e-10 < x < 3.6e212 or 4.2999999999999998e306 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 30.4%
Taylor expanded in x around 0 50.8%
if 3.6e212 < x < 4.2999999999999998e306Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 46.5%
Taylor expanded in x around inf 26.5%
mul-1-neg26.5%
*-commutative26.5%
distribute-rgt-neg-in26.5%
distribute-rgt-neg-in26.5%
mul-1-neg26.5%
distribute-lft-in26.5%
metadata-eval26.5%
neg-mul-126.5%
distribute-neg-frac26.5%
metadata-eval26.5%
Simplified26.5%
Taylor expanded in eps around inf 26.7%
*-commutative26.7%
Simplified26.7%
Final simplification56.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -0.0008)
(/ (+ 2.0 (* x (- (+ (/ 1.0 eps_m) (- (/ 1.0 eps_m) 2.0)) eps_m))) 2.0)
(if (<= x 1.12e-10)
(/
(+
2.0
(*
x
(- (+ (/ -1.0 eps_m) (* (- 1.0 eps_m) (+ -1.0 (/ 1.0 eps_m)))) eps_m)))
2.0)
(if (or (<= x 1.4e+212) (not (<= x 1.06e+303)))
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (- 1.0 (/ 1.0 eps_m))) 2.0)
(/ (* x eps_m) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -0.0008) {
tmp = (2.0 + (x * (((1.0 / eps_m) + ((1.0 / eps_m) - 2.0)) - eps_m))) / 2.0;
} else if (x <= 1.12e-10) {
tmp = (2.0 + (x * (((-1.0 / eps_m) + ((1.0 - eps_m) * (-1.0 + (1.0 / eps_m)))) - eps_m))) / 2.0;
} else if ((x <= 1.4e+212) || !(x <= 1.06e+303)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = (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 <= (-0.0008d0)) then
tmp = (2.0d0 + (x * (((1.0d0 / eps_m) + ((1.0d0 / eps_m) - 2.0d0)) - eps_m))) / 2.0d0
else if (x <= 1.12d-10) then
tmp = (2.0d0 + (x * ((((-1.0d0) / eps_m) + ((1.0d0 - eps_m) * ((-1.0d0) + (1.0d0 / eps_m)))) - eps_m))) / 2.0d0
else if ((x <= 1.4d+212) .or. (.not. (x <= 1.06d+303))) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 - (1.0d0 / eps_m))) / 2.0d0
else
tmp = (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 <= -0.0008) {
tmp = (2.0 + (x * (((1.0 / eps_m) + ((1.0 / eps_m) - 2.0)) - eps_m))) / 2.0;
} else if (x <= 1.12e-10) {
tmp = (2.0 + (x * (((-1.0 / eps_m) + ((1.0 - eps_m) * (-1.0 + (1.0 / eps_m)))) - eps_m))) / 2.0;
} else if ((x <= 1.4e+212) || !(x <= 1.06e+303)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -0.0008: tmp = (2.0 + (x * (((1.0 / eps_m) + ((1.0 / eps_m) - 2.0)) - eps_m))) / 2.0 elif x <= 1.12e-10: tmp = (2.0 + (x * (((-1.0 / eps_m) + ((1.0 - eps_m) * (-1.0 + (1.0 / eps_m)))) - eps_m))) / 2.0 elif (x <= 1.4e+212) or not (x <= 1.06e+303): tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0 else: tmp = (x * eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -0.0008) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(1.0 / eps_m) + Float64(Float64(1.0 / eps_m) - 2.0)) - eps_m))) / 2.0); elseif (x <= 1.12e-10) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(-1.0 / eps_m) + Float64(Float64(1.0 - eps_m) * Float64(-1.0 + Float64(1.0 / eps_m)))) - eps_m))) / 2.0); elseif ((x <= 1.4e+212) || !(x <= 1.06e+303)) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 - Float64(1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(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 <= -0.0008) tmp = (2.0 + (x * (((1.0 / eps_m) + ((1.0 / eps_m) - 2.0)) - eps_m))) / 2.0; elseif (x <= 1.12e-10) tmp = (2.0 + (x * (((-1.0 / eps_m) + ((1.0 - eps_m) * (-1.0 + (1.0 / eps_m)))) - eps_m))) / 2.0; elseif ((x <= 1.4e+212) || ~((x <= 1.06e+303))) tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0; else tmp = (x * eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -0.0008], N[(N[(2.0 + N[(x * N[(N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(N[(1.0 / eps$95$m), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision] - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.12e-10], N[(N[(2.0 + N[(x * N[(N[(N[(-1.0 / eps$95$m), $MachinePrecision] + N[(N[(1.0 - eps$95$m), $MachinePrecision] * N[(-1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 1.4e+212], N[Not[LessEqual[x, 1.06e+303]], $MachinePrecision]], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x * eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0008:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(\frac{1}{eps\_m} + \left(\frac{1}{eps\_m} - 2\right)\right) - eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 1.12 \cdot 10^{-10}:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(\frac{-1}{eps\_m} + \left(1 - eps\_m\right) \cdot \left(-1 + \frac{1}{eps\_m}\right)\right) - eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{+212} \lor \neg \left(x \leq 1.06 \cdot 10^{+303}\right):\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 - \frac{1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < -8.00000000000000038e-4Initial program 95.0%
Simplified95.0%
Taylor expanded in x around 0 2.9%
add-sqr-sqrt1.3%
sqrt-unprod7.9%
frac-times7.9%
metadata-eval7.9%
metadata-eval7.9%
frac-times7.9%
sqrt-unprod1.7%
add-sqr-sqrt3.1%
div-inv3.1%
mul-1-neg3.1%
sub-neg3.1%
add-sqr-sqrt1.3%
sqrt-unprod3.0%
frac-times3.0%
metadata-eval3.0%
metadata-eval3.0%
frac-times3.0%
sqrt-unprod1.7%
add-sqr-sqrt3.0%
sub-neg3.0%
metadata-eval3.0%
add-sqr-sqrt1.3%
Applied egg-rr3.1%
Taylor expanded in eps around 0 26.1%
if -8.00000000000000038e-4 < x < 1.12e-10Initial program 53.4%
Simplified37.6%
Taylor expanded in x around 0 72.2%
+-commutative72.2%
*-un-lft-identity72.2%
fma-define72.2%
add-sqr-sqrt29.5%
sqrt-unprod37.6%
frac-times36.9%
metadata-eval36.9%
metadata-eval36.9%
frac-times37.6%
sqrt-unprod21.2%
add-sqr-sqrt38.8%
add-sqr-sqrt17.6%
sqrt-unprod39.1%
frac-times38.3%
metadata-eval38.3%
metadata-eval38.3%
frac-times39.1%
sqrt-unprod30.0%
add-sqr-sqrt72.2%
sub-neg72.2%
metadata-eval72.2%
Applied egg-rr72.2%
fma-undefine72.2%
*-lft-identity72.2%
+-commutative72.2%
Simplified72.2%
if 1.12e-10 < x < 1.39999999999999999e212 or 1.06e303 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 30.4%
Taylor expanded in x around 0 50.8%
if 1.39999999999999999e212 < x < 1.06e303Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 46.5%
Taylor expanded in x around inf 26.5%
mul-1-neg26.5%
*-commutative26.5%
distribute-rgt-neg-in26.5%
distribute-rgt-neg-in26.5%
mul-1-neg26.5%
distribute-lft-in26.5%
metadata-eval26.5%
neg-mul-126.5%
distribute-neg-frac26.5%
metadata-eval26.5%
Simplified26.5%
Taylor expanded in eps around inf 26.7%
*-commutative26.7%
Simplified26.7%
Final simplification56.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 1.12e-10)
(/ (+ 2.0 (* x -2.0)) 2.0)
(if (or (<= x 7e+212) (not (<= x 2e+306)))
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (- 1.0 (/ 1.0 eps_m))) 2.0)
(/ (* x eps_m) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1.12e-10) {
tmp = (2.0 + (x * -2.0)) / 2.0;
} else if ((x <= 7e+212) || !(x <= 2e+306)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = (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 <= 1.12d-10) then
tmp = (2.0d0 + (x * (-2.0d0))) / 2.0d0
else if ((x <= 7d+212) .or. (.not. (x <= 2d+306))) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 - (1.0d0 / eps_m))) / 2.0d0
else
tmp = (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 <= 1.12e-10) {
tmp = (2.0 + (x * -2.0)) / 2.0;
} else if ((x <= 7e+212) || !(x <= 2e+306)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1.12e-10: tmp = (2.0 + (x * -2.0)) / 2.0 elif (x <= 7e+212) or not (x <= 2e+306): tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0 else: tmp = (x * eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1.12e-10) tmp = Float64(Float64(2.0 + Float64(x * -2.0)) / 2.0); elseif ((x <= 7e+212) || !(x <= 2e+306)) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 - Float64(1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(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 <= 1.12e-10) tmp = (2.0 + (x * -2.0)) / 2.0; elseif ((x <= 7e+212) || ~((x <= 2e+306))) tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0; else tmp = (x * eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 1.12e-10], N[(N[(2.0 + N[(x * -2.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 7e+212], N[Not[LessEqual[x, 2e+306]], $MachinePrecision]], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x * eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.12 \cdot 10^{-10}:\\
\;\;\;\;\frac{2 + x \cdot -2}{2}\\
\mathbf{elif}\;x \leq 7 \cdot 10^{+212} \lor \neg \left(x \leq 2 \cdot 10^{+306}\right):\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 - \frac{1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < 1.12e-10Initial program 63.0%
Simplified50.8%
Taylor expanded in x around 0 56.2%
add-sqr-sqrt23.0%
sqrt-unprod30.8%
frac-times30.2%
metadata-eval30.2%
metadata-eval30.2%
frac-times30.8%
sqrt-unprod16.7%
add-sqr-sqrt30.5%
div-inv30.5%
mul-1-neg30.5%
sub-neg30.5%
add-sqr-sqrt13.9%
sqrt-unprod30.7%
frac-times30.2%
metadata-eval30.2%
metadata-eval30.2%
frac-times30.7%
sqrt-unprod23.4%
add-sqr-sqrt56.2%
sub-neg56.2%
metadata-eval56.2%
add-sqr-sqrt23.0%
Applied egg-rr30.6%
Taylor expanded in eps around inf 56.3%
if 1.12e-10 < x < 6.99999999999999974e212 or 2.00000000000000003e306 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 30.4%
Taylor expanded in x around 0 50.8%
if 6.99999999999999974e212 < x < 2.00000000000000003e306Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 46.5%
Taylor expanded in x around inf 26.5%
mul-1-neg26.5%
*-commutative26.5%
distribute-rgt-neg-in26.5%
distribute-rgt-neg-in26.5%
mul-1-neg26.5%
distribute-lft-in26.5%
metadata-eval26.5%
neg-mul-126.5%
distribute-neg-frac26.5%
metadata-eval26.5%
Simplified26.5%
Taylor expanded in eps around inf 26.7%
*-commutative26.7%
Simplified26.7%
Final simplification52.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 1.12e-10) (/ (+ 2.0 (* x -2.0)) 2.0) (/ (* x eps_m) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1.12e-10) {
tmp = (2.0 + (x * -2.0)) / 2.0;
} else {
tmp = (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 <= 1.12d-10) then
tmp = (2.0d0 + (x * (-2.0d0))) / 2.0d0
else
tmp = (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 <= 1.12e-10) {
tmp = (2.0 + (x * -2.0)) / 2.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1.12e-10: tmp = (2.0 + (x * -2.0)) / 2.0 else: tmp = (x * eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1.12e-10) tmp = Float64(Float64(2.0 + Float64(x * -2.0)) / 2.0); else tmp = Float64(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 <= 1.12e-10) tmp = (2.0 + (x * -2.0)) / 2.0; else tmp = (x * eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 1.12e-10], N[(N[(2.0 + N[(x * -2.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x * eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.12 \cdot 10^{-10}:\\
\;\;\;\;\frac{2 + x \cdot -2}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < 1.12e-10Initial program 63.0%
Simplified50.8%
Taylor expanded in x around 0 56.2%
add-sqr-sqrt23.0%
sqrt-unprod30.8%
frac-times30.2%
metadata-eval30.2%
metadata-eval30.2%
frac-times30.8%
sqrt-unprod16.7%
add-sqr-sqrt30.5%
div-inv30.5%
mul-1-neg30.5%
sub-neg30.5%
add-sqr-sqrt13.9%
sqrt-unprod30.7%
frac-times30.2%
metadata-eval30.2%
metadata-eval30.2%
frac-times30.7%
sqrt-unprod23.4%
add-sqr-sqrt56.2%
sub-neg56.2%
metadata-eval56.2%
add-sqr-sqrt23.0%
Applied egg-rr30.6%
Taylor expanded in eps around inf 56.3%
if 1.12e-10 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 26.3%
Taylor expanded in x around inf 11.9%
mul-1-neg11.9%
*-commutative11.9%
distribute-rgt-neg-in11.9%
distribute-rgt-neg-in11.9%
mul-1-neg11.9%
distribute-lft-in11.9%
metadata-eval11.9%
neg-mul-111.9%
distribute-neg-frac11.9%
metadata-eval11.9%
Simplified11.9%
Taylor expanded in eps around inf 12.6%
*-commutative12.6%
Simplified12.6%
Final simplification42.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 1.12e-10) 1.0 (/ (* x eps_m) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1.12e-10) {
tmp = 1.0;
} else {
tmp = (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 <= 1.12d-10) then
tmp = 1.0d0
else
tmp = (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 <= 1.12e-10) {
tmp = 1.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1.12e-10: tmp = 1.0 else: tmp = (x * eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1.12e-10) tmp = 1.0; else tmp = Float64(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 <= 1.12e-10) tmp = 1.0; else tmp = (x * eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 1.12e-10], 1.0, N[(N[(x * eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.12 \cdot 10^{-10}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < 1.12e-10Initial program 63.0%
Simplified63.0%
Taylor expanded in x around 0 56.2%
if 1.12e-10 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 26.3%
Taylor expanded in x around inf 11.9%
mul-1-neg11.9%
*-commutative11.9%
distribute-rgt-neg-in11.9%
distribute-rgt-neg-in11.9%
mul-1-neg11.9%
distribute-lft-in11.9%
metadata-eval11.9%
neg-mul-111.9%
distribute-neg-frac11.9%
metadata-eval11.9%
Simplified11.9%
Taylor expanded in eps around inf 12.6%
*-commutative12.6%
Simplified12.6%
Final simplification42.1%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (* x (+ -1.0 eps_m)) 2.0) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return ((x * (-1.0 + eps_m)) + 2.0) / 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 = ((x * ((-1.0d0) + eps_m)) + 2.0d0) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return ((x * (-1.0 + eps_m)) + 2.0) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return ((x * (-1.0 + eps_m)) + 2.0) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(Float64(x * Float64(-1.0 + eps_m)) + 2.0) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = ((x * (-1.0 + eps_m)) + 2.0) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\frac{x \cdot \left(-1 + eps\_m\right) + 2}{2}
\end{array}
Initial program 75.0%
Simplified75.0%
Taylor expanded in x around 0 40.1%
Taylor expanded in eps around inf 63.8%
neg-mul-163.8%
distribute-lft-neg-in63.8%
Simplified63.8%
Taylor expanded in x around 0 45.7%
Final simplification45.7%
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 75.0%
Simplified75.0%
Taylor expanded in x around 0 39.0%
Final simplification39.0%
herbie shell --seed 2024034
(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))