
(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 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 1.0) (/ (* 2.0 (* (exp (- x)) (+ x 1.0))) 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 <= 1.0) {
tmp = (2.0 * (exp(-x) * (x + 1.0))) / 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 <= 1.0d0) then
tmp = (2.0d0 * (exp(-x) * (x + 1.0d0))) / 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 <= 1.0) {
tmp = (2.0 * (Math.exp(-x) * (x + 1.0))) / 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 <= 1.0: tmp = (2.0 * (math.exp(-x) * (x + 1.0))) / 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 <= 1.0) tmp = Float64(Float64(2.0 * Float64(exp(Float64(-x)) * Float64(x + 1.0))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * eps_m)) + exp(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 (eps_m <= 1.0) tmp = (2.0 * (exp(-x) * (x + 1.0))) / 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, 1.0], N[(N[(2.0 * N[(N[Exp[(-x)], $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $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 1:\\
\;\;\;\;\frac{2 \cdot \left(e^{-x} \cdot \left(x + 1\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot eps\_m} + e^{\left(-x\right) \cdot eps\_m}}{2}\\
\end{array}
\end{array}
if eps < 1Initial program 61.5%
Simplified61.5%
Taylor expanded in eps around 0 71.9%
distribute-lft-out71.9%
cancel-sign-sub-inv71.9%
metadata-eval71.9%
distribute-rgt1-in71.9%
metadata-eval71.9%
distribute-rgt1-in71.9%
*-commutative71.9%
mul-1-neg71.9%
Simplified71.9%
if 1 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
exp-prod100.0%
*-commutative100.0%
*-commutative100.0%
sub-neg100.0%
neg-mul-1100.0%
exp-prod100.0%
associate-*r*100.0%
mul-1-neg100.0%
neg-mul-1100.0%
sub-neg100.0%
mul-1-neg100.0%
associate-*r*100.0%
remove-double-neg100.0%
sub-neg100.0%
neg-mul-1100.0%
associate-*r*100.0%
associate-*r*100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
*-commutative100.0%
distribute-lft-neg-in100.0%
Simplified100.0%
Final simplification80.1%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* x (+ eps_m -1.0))) (exp (* x (- -1.0 eps_m)))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * (eps_m + -1.0))) + 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 * (eps_m + (-1.0d0)))) + 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 * (eps_m + -1.0))) + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.exp((x * (eps_m + -1.0))) + 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(eps_m + -1.0))) + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((x * (eps_m + -1.0))) + 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[(eps$95$m + -1.0), $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(eps\_m + -1\right)} + e^{x \cdot \left(-1 - eps\_m\right)}}{2}
\end{array}
Initial program 72.8%
Simplified72.8%
Taylor expanded in eps around inf 99.8%
exp-prod99.8%
*-commutative99.8%
*-commutative99.8%
sub-neg99.8%
neg-mul-199.8%
exp-prod99.8%
associate-*r*99.8%
mul-1-neg99.8%
neg-mul-199.8%
sub-neg99.8%
mul-1-neg99.8%
associate-*r*99.8%
remove-double-neg99.8%
sub-neg99.8%
neg-mul-199.8%
associate-*r*99.8%
associate-*r*99.8%
Simplified99.8%
Final simplification99.8%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (+ -1.0 (/ -1.0 eps_m)))
(t_1 (* eps_m t_0))
(t_2 (/ (+ 1.0 eps_m) eps_m)))
(if (<= x -1.35e+67)
(/ (+ 2.0 (* x (- (/ -1.0 eps_m) eps_m))) 2.0)
(if (<= x -2.8e-191)
(/
(+
2.0
(*
x
(+
(* (- 1.0 eps_m) t_0)
(/
(+
(* (+ 1.0 eps_m) (+ 1.0 eps_m))
(* t_2 (/ (- -1.0 eps_m) eps_m)))
(- (- -1.0 eps_m) t_2)))))
2.0)
(if (<= x 7.5e-217)
1.0
(if (<= x 7e-124)
(/
(+ 2.0 (* x (+ (/ 1.0 eps_m) (/ (- 1.0 (* t_1 t_1)) (+ t_0 t_1)))))
2.0)
(if (or (<= x 1e+23) (and (not (<= x 6e+140)) (<= x 1e+166)))
(/ (* 2.0 (* (+ x 1.0) (exp x))) 2.0)
(/ (* 2.0 (/ x (exp x))) 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 = eps_m * t_0;
double t_2 = (1.0 + eps_m) / eps_m;
double tmp;
if (x <= -1.35e+67) {
tmp = (2.0 + (x * ((-1.0 / eps_m) - eps_m))) / 2.0;
} else if (x <= -2.8e-191) {
tmp = (2.0 + (x * (((1.0 - eps_m) * t_0) + ((((1.0 + eps_m) * (1.0 + eps_m)) + (t_2 * ((-1.0 - eps_m) / eps_m))) / ((-1.0 - eps_m) - t_2))))) / 2.0;
} else if (x <= 7.5e-217) {
tmp = 1.0;
} else if (x <= 7e-124) {
tmp = (2.0 + (x * ((1.0 / eps_m) + ((1.0 - (t_1 * t_1)) / (t_0 + t_1))))) / 2.0;
} else if ((x <= 1e+23) || (!(x <= 6e+140) && (x <= 1e+166))) {
tmp = (2.0 * ((x + 1.0) * exp(x))) / 2.0;
} else {
tmp = (2.0 * (x / 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) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (-1.0d0) + ((-1.0d0) / eps_m)
t_1 = eps_m * t_0
t_2 = (1.0d0 + eps_m) / eps_m
if (x <= (-1.35d+67)) then
tmp = (2.0d0 + (x * (((-1.0d0) / eps_m) - eps_m))) / 2.0d0
else if (x <= (-2.8d-191)) then
tmp = (2.0d0 + (x * (((1.0d0 - eps_m) * t_0) + ((((1.0d0 + eps_m) * (1.0d0 + eps_m)) + (t_2 * (((-1.0d0) - eps_m) / eps_m))) / (((-1.0d0) - eps_m) - t_2))))) / 2.0d0
else if (x <= 7.5d-217) then
tmp = 1.0d0
else if (x <= 7d-124) then
tmp = (2.0d0 + (x * ((1.0d0 / eps_m) + ((1.0d0 - (t_1 * t_1)) / (t_0 + t_1))))) / 2.0d0
else if ((x <= 1d+23) .or. (.not. (x <= 6d+140)) .and. (x <= 1d+166)) then
tmp = (2.0d0 * ((x + 1.0d0) * exp(x))) / 2.0d0
else
tmp = (2.0d0 * (x / 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 t_0 = -1.0 + (-1.0 / eps_m);
double t_1 = eps_m * t_0;
double t_2 = (1.0 + eps_m) / eps_m;
double tmp;
if (x <= -1.35e+67) {
tmp = (2.0 + (x * ((-1.0 / eps_m) - eps_m))) / 2.0;
} else if (x <= -2.8e-191) {
tmp = (2.0 + (x * (((1.0 - eps_m) * t_0) + ((((1.0 + eps_m) * (1.0 + eps_m)) + (t_2 * ((-1.0 - eps_m) / eps_m))) / ((-1.0 - eps_m) - t_2))))) / 2.0;
} else if (x <= 7.5e-217) {
tmp = 1.0;
} else if (x <= 7e-124) {
tmp = (2.0 + (x * ((1.0 / eps_m) + ((1.0 - (t_1 * t_1)) / (t_0 + t_1))))) / 2.0;
} else if ((x <= 1e+23) || (!(x <= 6e+140) && (x <= 1e+166))) {
tmp = (2.0 * ((x + 1.0) * Math.exp(x))) / 2.0;
} else {
tmp = (2.0 * (x / Math.exp(x))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = -1.0 + (-1.0 / eps_m) t_1 = eps_m * t_0 t_2 = (1.0 + eps_m) / eps_m tmp = 0 if x <= -1.35e+67: tmp = (2.0 + (x * ((-1.0 / eps_m) - eps_m))) / 2.0 elif x <= -2.8e-191: tmp = (2.0 + (x * (((1.0 - eps_m) * t_0) + ((((1.0 + eps_m) * (1.0 + eps_m)) + (t_2 * ((-1.0 - eps_m) / eps_m))) / ((-1.0 - eps_m) - t_2))))) / 2.0 elif x <= 7.5e-217: tmp = 1.0 elif x <= 7e-124: tmp = (2.0 + (x * ((1.0 / eps_m) + ((1.0 - (t_1 * t_1)) / (t_0 + t_1))))) / 2.0 elif (x <= 1e+23) or (not (x <= 6e+140) and (x <= 1e+166)): tmp = (2.0 * ((x + 1.0) * math.exp(x))) / 2.0 else: tmp = (2.0 * (x / math.exp(x))) / 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(eps_m * t_0) t_2 = Float64(Float64(1.0 + eps_m) / eps_m) tmp = 0.0 if (x <= -1.35e+67) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(-1.0 / eps_m) - eps_m))) / 2.0); elseif (x <= -2.8e-191) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(1.0 - eps_m) * t_0) + Float64(Float64(Float64(Float64(1.0 + eps_m) * Float64(1.0 + eps_m)) + Float64(t_2 * Float64(Float64(-1.0 - eps_m) / eps_m))) / Float64(Float64(-1.0 - eps_m) - t_2))))) / 2.0); elseif (x <= 7.5e-217) tmp = 1.0; elseif (x <= 7e-124) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(1.0 / eps_m) + Float64(Float64(1.0 - Float64(t_1 * t_1)) / Float64(t_0 + t_1))))) / 2.0); elseif ((x <= 1e+23) || (!(x <= 6e+140) && (x <= 1e+166))) tmp = Float64(Float64(2.0 * Float64(Float64(x + 1.0) * exp(x))) / 2.0); else tmp = Float64(Float64(2.0 * Float64(x / exp(x))) / 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 = eps_m * t_0; t_2 = (1.0 + eps_m) / eps_m; tmp = 0.0; if (x <= -1.35e+67) tmp = (2.0 + (x * ((-1.0 / eps_m) - eps_m))) / 2.0; elseif (x <= -2.8e-191) tmp = (2.0 + (x * (((1.0 - eps_m) * t_0) + ((((1.0 + eps_m) * (1.0 + eps_m)) + (t_2 * ((-1.0 - eps_m) / eps_m))) / ((-1.0 - eps_m) - t_2))))) / 2.0; elseif (x <= 7.5e-217) tmp = 1.0; elseif (x <= 7e-124) tmp = (2.0 + (x * ((1.0 / eps_m) + ((1.0 - (t_1 * t_1)) / (t_0 + t_1))))) / 2.0; elseif ((x <= 1e+23) || (~((x <= 6e+140)) && (x <= 1e+166))) tmp = (2.0 * ((x + 1.0) * exp(x))) / 2.0; else tmp = (2.0 * (x / exp(x))) / 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[(eps$95$m * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(1.0 + eps$95$m), $MachinePrecision] / eps$95$m), $MachinePrecision]}, If[LessEqual[x, -1.35e+67], N[(N[(2.0 + N[(x * N[(N[(-1.0 / eps$95$m), $MachinePrecision] - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -2.8e-191], N[(N[(2.0 + N[(x * N[(N[(N[(1.0 - eps$95$m), $MachinePrecision] * t$95$0), $MachinePrecision] + N[(N[(N[(N[(1.0 + eps$95$m), $MachinePrecision] * N[(1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 * N[(N[(-1.0 - eps$95$m), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(-1.0 - eps$95$m), $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 7.5e-217], 1.0, If[LessEqual[x, 7e-124], N[(N[(2.0 + N[(x * N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(N[(1.0 - N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 1e+23], And[N[Not[LessEqual[x, 6e+140]], $MachinePrecision], LessEqual[x, 1e+166]]], N[(N[(2.0 * N[(N[(x + 1.0), $MachinePrecision] * N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 * N[(x / N[Exp[x], $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 := eps\_m \cdot t\_0\\
t_2 := \frac{1 + eps\_m}{eps\_m}\\
\mathbf{if}\;x \leq -1.35 \cdot 10^{+67}:\\
\;\;\;\;\frac{2 + x \cdot \left(\frac{-1}{eps\_m} - eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq -2.8 \cdot 10^{-191}:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(1 - eps\_m\right) \cdot t\_0 + \frac{\left(1 + eps\_m\right) \cdot \left(1 + eps\_m\right) + t\_2 \cdot \frac{-1 - eps\_m}{eps\_m}}{\left(-1 - eps\_m\right) - t\_2}\right)}{2}\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-217}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 7 \cdot 10^{-124}:\\
\;\;\;\;\frac{2 + x \cdot \left(\frac{1}{eps\_m} + \frac{1 - t\_1 \cdot t\_1}{t\_0 + t\_1}\right)}{2}\\
\mathbf{elif}\;x \leq 10^{+23} \lor \neg \left(x \leq 6 \cdot 10^{+140}\right) \land x \leq 10^{+166}:\\
\;\;\;\;\frac{2 \cdot \left(\left(x + 1\right) \cdot e^{x}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \frac{x}{e^{x}}}{2}\\
\end{array}
\end{array}
if x < -1.35e67Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 3.2%
mul-1-neg3.2%
distribute-lft-neg-in3.2%
cancel-sign-sub-inv3.2%
mul-1-neg3.2%
distribute-rgt-neg-in3.2%
sub-neg3.2%
distribute-neg-in3.2%
metadata-eval3.2%
remove-double-neg3.2%
remove-double-neg3.2%
+-commutative3.2%
sub-neg3.2%
metadata-eval3.2%
+-commutative3.2%
Simplified3.2%
Taylor expanded in eps around 0 35.8%
Taylor expanded in eps around inf 35.8%
neg-mul-135.8%
Simplified35.8%
if -1.35e67 < x < -2.80000000000000012e-191Initial program 67.7%
Simplified67.7%
Taylor expanded in x around 0 55.6%
mul-1-neg55.6%
distribute-lft-neg-in55.6%
cancel-sign-sub-inv55.6%
mul-1-neg55.6%
distribute-rgt-neg-in55.6%
sub-neg55.6%
distribute-neg-in55.6%
metadata-eval55.6%
remove-double-neg55.6%
remove-double-neg55.6%
+-commutative55.6%
sub-neg55.6%
metadata-eval55.6%
+-commutative55.6%
Simplified55.6%
distribute-lft-in55.6%
flip-+56.8%
Applied egg-rr56.8%
if -2.80000000000000012e-191 < x < 7.50000000000000031e-217Initial program 55.8%
Simplified55.8%
Taylor expanded in x around 0 98.6%
if 7.50000000000000031e-217 < x < 6.9999999999999997e-124Initial program 59.0%
Simplified59.0%
Taylor expanded in x around 0 66.5%
mul-1-neg66.5%
distribute-lft-neg-in66.5%
cancel-sign-sub-inv66.5%
mul-1-neg66.5%
distribute-rgt-neg-in66.5%
sub-neg66.5%
distribute-neg-in66.5%
metadata-eval66.5%
remove-double-neg66.5%
remove-double-neg66.5%
+-commutative66.5%
sub-neg66.5%
metadata-eval66.5%
+-commutative66.5%
Simplified66.5%
Taylor expanded in eps around 0 66.2%
distribute-lft-in66.2%
flip-+58.3%
Applied egg-rr58.3%
Taylor expanded in eps around inf 66.2%
if 6.9999999999999997e-124 < x < 9.9999999999999992e22 or 5.99999999999999993e140 < x < 9.9999999999999994e165Initial program 56.2%
Simplified56.2%
Taylor expanded in eps around 0 53.5%
distribute-lft-out53.5%
cancel-sign-sub-inv53.5%
metadata-eval53.5%
distribute-rgt1-in53.5%
metadata-eval53.5%
distribute-rgt1-in53.5%
*-commutative53.5%
mul-1-neg53.5%
Simplified53.5%
+-commutative53.5%
distribute-rgt-in53.5%
*-un-lft-identity53.5%
add-sqr-sqrt0.0%
sqrt-unprod73.7%
sqr-neg73.7%
sqrt-unprod73.7%
add-sqr-sqrt73.7%
add-sqr-sqrt0.0%
sqrt-unprod73.7%
sqr-neg73.7%
sqrt-unprod73.7%
add-sqr-sqrt73.7%
Applied egg-rr73.7%
distribute-rgt1-in73.7%
+-commutative73.7%
Simplified73.7%
if 9.9999999999999992e22 < x < 5.99999999999999993e140 or 9.9999999999999994e165 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 63.1%
distribute-lft-out63.1%
cancel-sign-sub-inv63.1%
metadata-eval63.1%
distribute-rgt1-in63.1%
metadata-eval63.1%
distribute-rgt1-in63.1%
*-commutative63.1%
mul-1-neg63.1%
Simplified63.1%
Taylor expanded in x around inf 63.1%
exp-neg63.1%
associate-*r/63.1%
*-rgt-identity63.1%
Simplified63.1%
Final simplification68.1%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (+ -1.0 (/ -1.0 eps_m)))
(t_1 (* eps_m t_0))
(t_2 (/ (+ 1.0 eps_m) eps_m)))
(if (<= x -1.35e+67)
(/ (+ 2.0 (* x (- (/ -1.0 eps_m) eps_m))) 2.0)
(if (<= x -3e-193)
(/
(+
2.0
(*
x
(+
(* (- 1.0 eps_m) t_0)
(/
(+
(* (+ 1.0 eps_m) (+ 1.0 eps_m))
(* t_2 (/ (- -1.0 eps_m) eps_m)))
(- (- -1.0 eps_m) t_2)))))
2.0)
(if (<= x 2.65e-216)
1.0
(if (<= x 5e-124)
(/
(+ 2.0 (* x (+ (/ 1.0 eps_m) (/ (- 1.0 (* t_1 t_1)) (+ t_0 t_1)))))
2.0)
(if (<= x 1.12e+17)
(/ (+ 2.0 (* x eps_m)) 2.0)
(/ (* 2.0 (/ x (exp x))) 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 = eps_m * t_0;
double t_2 = (1.0 + eps_m) / eps_m;
double tmp;
if (x <= -1.35e+67) {
tmp = (2.0 + (x * ((-1.0 / eps_m) - eps_m))) / 2.0;
} else if (x <= -3e-193) {
tmp = (2.0 + (x * (((1.0 - eps_m) * t_0) + ((((1.0 + eps_m) * (1.0 + eps_m)) + (t_2 * ((-1.0 - eps_m) / eps_m))) / ((-1.0 - eps_m) - t_2))))) / 2.0;
} else if (x <= 2.65e-216) {
tmp = 1.0;
} else if (x <= 5e-124) {
tmp = (2.0 + (x * ((1.0 / eps_m) + ((1.0 - (t_1 * t_1)) / (t_0 + t_1))))) / 2.0;
} else if (x <= 1.12e+17) {
tmp = (2.0 + (x * eps_m)) / 2.0;
} else {
tmp = (2.0 * (x / 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) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (-1.0d0) + ((-1.0d0) / eps_m)
t_1 = eps_m * t_0
t_2 = (1.0d0 + eps_m) / eps_m
if (x <= (-1.35d+67)) then
tmp = (2.0d0 + (x * (((-1.0d0) / eps_m) - eps_m))) / 2.0d0
else if (x <= (-3d-193)) then
tmp = (2.0d0 + (x * (((1.0d0 - eps_m) * t_0) + ((((1.0d0 + eps_m) * (1.0d0 + eps_m)) + (t_2 * (((-1.0d0) - eps_m) / eps_m))) / (((-1.0d0) - eps_m) - t_2))))) / 2.0d0
else if (x <= 2.65d-216) then
tmp = 1.0d0
else if (x <= 5d-124) then
tmp = (2.0d0 + (x * ((1.0d0 / eps_m) + ((1.0d0 - (t_1 * t_1)) / (t_0 + t_1))))) / 2.0d0
else if (x <= 1.12d+17) then
tmp = (2.0d0 + (x * eps_m)) / 2.0d0
else
tmp = (2.0d0 * (x / 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 t_0 = -1.0 + (-1.0 / eps_m);
double t_1 = eps_m * t_0;
double t_2 = (1.0 + eps_m) / eps_m;
double tmp;
if (x <= -1.35e+67) {
tmp = (2.0 + (x * ((-1.0 / eps_m) - eps_m))) / 2.0;
} else if (x <= -3e-193) {
tmp = (2.0 + (x * (((1.0 - eps_m) * t_0) + ((((1.0 + eps_m) * (1.0 + eps_m)) + (t_2 * ((-1.0 - eps_m) / eps_m))) / ((-1.0 - eps_m) - t_2))))) / 2.0;
} else if (x <= 2.65e-216) {
tmp = 1.0;
} else if (x <= 5e-124) {
tmp = (2.0 + (x * ((1.0 / eps_m) + ((1.0 - (t_1 * t_1)) / (t_0 + t_1))))) / 2.0;
} else if (x <= 1.12e+17) {
tmp = (2.0 + (x * eps_m)) / 2.0;
} else {
tmp = (2.0 * (x / Math.exp(x))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = -1.0 + (-1.0 / eps_m) t_1 = eps_m * t_0 t_2 = (1.0 + eps_m) / eps_m tmp = 0 if x <= -1.35e+67: tmp = (2.0 + (x * ((-1.0 / eps_m) - eps_m))) / 2.0 elif x <= -3e-193: tmp = (2.0 + (x * (((1.0 - eps_m) * t_0) + ((((1.0 + eps_m) * (1.0 + eps_m)) + (t_2 * ((-1.0 - eps_m) / eps_m))) / ((-1.0 - eps_m) - t_2))))) / 2.0 elif x <= 2.65e-216: tmp = 1.0 elif x <= 5e-124: tmp = (2.0 + (x * ((1.0 / eps_m) + ((1.0 - (t_1 * t_1)) / (t_0 + t_1))))) / 2.0 elif x <= 1.12e+17: tmp = (2.0 + (x * eps_m)) / 2.0 else: tmp = (2.0 * (x / math.exp(x))) / 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(eps_m * t_0) t_2 = Float64(Float64(1.0 + eps_m) / eps_m) tmp = 0.0 if (x <= -1.35e+67) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(-1.0 / eps_m) - eps_m))) / 2.0); elseif (x <= -3e-193) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(1.0 - eps_m) * t_0) + Float64(Float64(Float64(Float64(1.0 + eps_m) * Float64(1.0 + eps_m)) + Float64(t_2 * Float64(Float64(-1.0 - eps_m) / eps_m))) / Float64(Float64(-1.0 - eps_m) - t_2))))) / 2.0); elseif (x <= 2.65e-216) tmp = 1.0; elseif (x <= 5e-124) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(1.0 / eps_m) + Float64(Float64(1.0 - Float64(t_1 * t_1)) / Float64(t_0 + t_1))))) / 2.0); elseif (x <= 1.12e+17) tmp = Float64(Float64(2.0 + Float64(x * eps_m)) / 2.0); else tmp = Float64(Float64(2.0 * Float64(x / exp(x))) / 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 = eps_m * t_0; t_2 = (1.0 + eps_m) / eps_m; tmp = 0.0; if (x <= -1.35e+67) tmp = (2.0 + (x * ((-1.0 / eps_m) - eps_m))) / 2.0; elseif (x <= -3e-193) tmp = (2.0 + (x * (((1.0 - eps_m) * t_0) + ((((1.0 + eps_m) * (1.0 + eps_m)) + (t_2 * ((-1.0 - eps_m) / eps_m))) / ((-1.0 - eps_m) - t_2))))) / 2.0; elseif (x <= 2.65e-216) tmp = 1.0; elseif (x <= 5e-124) tmp = (2.0 + (x * ((1.0 / eps_m) + ((1.0 - (t_1 * t_1)) / (t_0 + t_1))))) / 2.0; elseif (x <= 1.12e+17) tmp = (2.0 + (x * eps_m)) / 2.0; else tmp = (2.0 * (x / exp(x))) / 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[(eps$95$m * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(1.0 + eps$95$m), $MachinePrecision] / eps$95$m), $MachinePrecision]}, If[LessEqual[x, -1.35e+67], N[(N[(2.0 + N[(x * N[(N[(-1.0 / eps$95$m), $MachinePrecision] - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -3e-193], N[(N[(2.0 + N[(x * N[(N[(N[(1.0 - eps$95$m), $MachinePrecision] * t$95$0), $MachinePrecision] + N[(N[(N[(N[(1.0 + eps$95$m), $MachinePrecision] * N[(1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 * N[(N[(-1.0 - eps$95$m), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(-1.0 - eps$95$m), $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.65e-216], 1.0, If[LessEqual[x, 5e-124], N[(N[(2.0 + N[(x * N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(N[(1.0 - N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.12e+17], N[(N[(2.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 * N[(x / N[Exp[x], $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 := eps\_m \cdot t\_0\\
t_2 := \frac{1 + eps\_m}{eps\_m}\\
\mathbf{if}\;x \leq -1.35 \cdot 10^{+67}:\\
\;\;\;\;\frac{2 + x \cdot \left(\frac{-1}{eps\_m} - eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq -3 \cdot 10^{-193}:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(1 - eps\_m\right) \cdot t\_0 + \frac{\left(1 + eps\_m\right) \cdot \left(1 + eps\_m\right) + t\_2 \cdot \frac{-1 - eps\_m}{eps\_m}}{\left(-1 - eps\_m\right) - t\_2}\right)}{2}\\
\mathbf{elif}\;x \leq 2.65 \cdot 10^{-216}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-124}:\\
\;\;\;\;\frac{2 + x \cdot \left(\frac{1}{eps\_m} + \frac{1 - t\_1 \cdot t\_1}{t\_0 + t\_1}\right)}{2}\\
\mathbf{elif}\;x \leq 1.12 \cdot 10^{+17}:\\
\;\;\;\;\frac{2 + x \cdot eps\_m}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \frac{x}{e^{x}}}{2}\\
\end{array}
\end{array}
if x < -1.35e67Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 3.2%
mul-1-neg3.2%
distribute-lft-neg-in3.2%
cancel-sign-sub-inv3.2%
mul-1-neg3.2%
distribute-rgt-neg-in3.2%
sub-neg3.2%
distribute-neg-in3.2%
metadata-eval3.2%
remove-double-neg3.2%
remove-double-neg3.2%
+-commutative3.2%
sub-neg3.2%
metadata-eval3.2%
+-commutative3.2%
Simplified3.2%
Taylor expanded in eps around 0 35.8%
Taylor expanded in eps around inf 35.8%
neg-mul-135.8%
Simplified35.8%
if -1.35e67 < x < -2.9999999999999999e-193Initial program 67.7%
Simplified67.7%
Taylor expanded in x around 0 55.6%
mul-1-neg55.6%
distribute-lft-neg-in55.6%
cancel-sign-sub-inv55.6%
mul-1-neg55.6%
distribute-rgt-neg-in55.6%
sub-neg55.6%
distribute-neg-in55.6%
metadata-eval55.6%
remove-double-neg55.6%
remove-double-neg55.6%
+-commutative55.6%
sub-neg55.6%
metadata-eval55.6%
+-commutative55.6%
Simplified55.6%
distribute-lft-in55.6%
flip-+56.8%
Applied egg-rr56.8%
if -2.9999999999999999e-193 < x < 2.64999999999999989e-216Initial program 55.8%
Simplified55.8%
Taylor expanded in x around 0 98.6%
if 2.64999999999999989e-216 < x < 5.0000000000000003e-124Initial program 59.0%
Simplified59.0%
Taylor expanded in x around 0 66.5%
mul-1-neg66.5%
distribute-lft-neg-in66.5%
cancel-sign-sub-inv66.5%
mul-1-neg66.5%
distribute-rgt-neg-in66.5%
sub-neg66.5%
distribute-neg-in66.5%
metadata-eval66.5%
remove-double-neg66.5%
remove-double-neg66.5%
+-commutative66.5%
sub-neg66.5%
metadata-eval66.5%
+-commutative66.5%
Simplified66.5%
Taylor expanded in eps around 0 66.2%
distribute-lft-in66.2%
flip-+58.3%
Applied egg-rr58.3%
Taylor expanded in eps around inf 66.2%
if 5.0000000000000003e-124 < x < 1.12e17Initial program 48.9%
Simplified48.9%
Taylor expanded in x around 0 62.3%
mul-1-neg62.3%
distribute-lft-neg-in62.3%
cancel-sign-sub-inv62.3%
mul-1-neg62.3%
distribute-rgt-neg-in62.3%
sub-neg62.3%
distribute-neg-in62.3%
metadata-eval62.3%
remove-double-neg62.3%
remove-double-neg62.3%
+-commutative62.3%
sub-neg62.3%
metadata-eval62.3%
+-commutative62.3%
Simplified62.3%
Taylor expanded in eps around 0 61.9%
Taylor expanded in eps around 0 61.9%
if 1.12e17 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 56.3%
distribute-lft-out56.3%
cancel-sign-sub-inv56.3%
metadata-eval56.3%
distribute-rgt1-in56.3%
metadata-eval56.3%
distribute-rgt1-in56.3%
*-commutative56.3%
mul-1-neg56.3%
Simplified56.3%
Taylor expanded in x around inf 56.3%
exp-neg56.3%
associate-*r/56.3%
*-rgt-identity56.3%
Simplified56.3%
Final simplification64.8%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (+ -1.0 (/ -1.0 eps_m))) (t_1 (* eps_m t_0)))
(if (<= eps_m 1.0)
(/ (* 2.0 (* (exp (- x)) (+ x 1.0))) 2.0)
(if (<= eps_m 9.5e+205)
(/ (* 2.0 (* (+ x 1.0) (exp x))) 2.0)
(if (or (<= eps_m 4.8e+249)
(and (not (<= eps_m 8.5e+295)) (<= eps_m 3.5e+304)))
(/
(+
2.0
(*
x
(+
(* (- 1.0 eps_m) t_0)
(/
(+ -1.0 (* (+ 1.0 eps_m) (+ 1.0 eps_m)))
(- (- -1.0 eps_m) (/ (+ 1.0 eps_m) eps_m))))))
2.0)
(/
(+ 2.0 (* x (+ (/ 1.0 eps_m) (/ (- 1.0 (* t_1 t_1)) (+ t_0 t_1)))))
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 = eps_m * t_0;
double tmp;
if (eps_m <= 1.0) {
tmp = (2.0 * (exp(-x) * (x + 1.0))) / 2.0;
} else if (eps_m <= 9.5e+205) {
tmp = (2.0 * ((x + 1.0) * exp(x))) / 2.0;
} else if ((eps_m <= 4.8e+249) || (!(eps_m <= 8.5e+295) && (eps_m <= 3.5e+304))) {
tmp = (2.0 + (x * (((1.0 - eps_m) * t_0) + ((-1.0 + ((1.0 + eps_m) * (1.0 + eps_m))) / ((-1.0 - eps_m) - ((1.0 + eps_m) / eps_m)))))) / 2.0;
} else {
tmp = (2.0 + (x * ((1.0 / eps_m) + ((1.0 - (t_1 * t_1)) / (t_0 + t_1))))) / 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 = eps_m * t_0
if (eps_m <= 1.0d0) then
tmp = (2.0d0 * (exp(-x) * (x + 1.0d0))) / 2.0d0
else if (eps_m <= 9.5d+205) then
tmp = (2.0d0 * ((x + 1.0d0) * exp(x))) / 2.0d0
else if ((eps_m <= 4.8d+249) .or. (.not. (eps_m <= 8.5d+295)) .and. (eps_m <= 3.5d+304)) then
tmp = (2.0d0 + (x * (((1.0d0 - eps_m) * t_0) + (((-1.0d0) + ((1.0d0 + eps_m) * (1.0d0 + eps_m))) / (((-1.0d0) - eps_m) - ((1.0d0 + eps_m) / eps_m)))))) / 2.0d0
else
tmp = (2.0d0 + (x * ((1.0d0 / eps_m) + ((1.0d0 - (t_1 * t_1)) / (t_0 + t_1))))) / 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 = eps_m * t_0;
double tmp;
if (eps_m <= 1.0) {
tmp = (2.0 * (Math.exp(-x) * (x + 1.0))) / 2.0;
} else if (eps_m <= 9.5e+205) {
tmp = (2.0 * ((x + 1.0) * Math.exp(x))) / 2.0;
} else if ((eps_m <= 4.8e+249) || (!(eps_m <= 8.5e+295) && (eps_m <= 3.5e+304))) {
tmp = (2.0 + (x * (((1.0 - eps_m) * t_0) + ((-1.0 + ((1.0 + eps_m) * (1.0 + eps_m))) / ((-1.0 - eps_m) - ((1.0 + eps_m) / eps_m)))))) / 2.0;
} else {
tmp = (2.0 + (x * ((1.0 / eps_m) + ((1.0 - (t_1 * t_1)) / (t_0 + t_1))))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = -1.0 + (-1.0 / eps_m) t_1 = eps_m * t_0 tmp = 0 if eps_m <= 1.0: tmp = (2.0 * (math.exp(-x) * (x + 1.0))) / 2.0 elif eps_m <= 9.5e+205: tmp = (2.0 * ((x + 1.0) * math.exp(x))) / 2.0 elif (eps_m <= 4.8e+249) or (not (eps_m <= 8.5e+295) and (eps_m <= 3.5e+304)): tmp = (2.0 + (x * (((1.0 - eps_m) * t_0) + ((-1.0 + ((1.0 + eps_m) * (1.0 + eps_m))) / ((-1.0 - eps_m) - ((1.0 + eps_m) / eps_m)))))) / 2.0 else: tmp = (2.0 + (x * ((1.0 / eps_m) + ((1.0 - (t_1 * t_1)) / (t_0 + t_1))))) / 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(eps_m * t_0) tmp = 0.0 if (eps_m <= 1.0) tmp = Float64(Float64(2.0 * Float64(exp(Float64(-x)) * Float64(x + 1.0))) / 2.0); elseif (eps_m <= 9.5e+205) tmp = Float64(Float64(2.0 * Float64(Float64(x + 1.0) * exp(x))) / 2.0); elseif ((eps_m <= 4.8e+249) || (!(eps_m <= 8.5e+295) && (eps_m <= 3.5e+304))) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(1.0 - eps_m) * t_0) + Float64(Float64(-1.0 + Float64(Float64(1.0 + eps_m) * Float64(1.0 + eps_m))) / Float64(Float64(-1.0 - eps_m) - Float64(Float64(1.0 + eps_m) / eps_m)))))) / 2.0); else tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(1.0 / eps_m) + Float64(Float64(1.0 - Float64(t_1 * t_1)) / Float64(t_0 + t_1))))) / 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 = eps_m * t_0; tmp = 0.0; if (eps_m <= 1.0) tmp = (2.0 * (exp(-x) * (x + 1.0))) / 2.0; elseif (eps_m <= 9.5e+205) tmp = (2.0 * ((x + 1.0) * exp(x))) / 2.0; elseif ((eps_m <= 4.8e+249) || (~((eps_m <= 8.5e+295)) && (eps_m <= 3.5e+304))) tmp = (2.0 + (x * (((1.0 - eps_m) * t_0) + ((-1.0 + ((1.0 + eps_m) * (1.0 + eps_m))) / ((-1.0 - eps_m) - ((1.0 + eps_m) / eps_m)))))) / 2.0; else tmp = (2.0 + (x * ((1.0 / eps_m) + ((1.0 - (t_1 * t_1)) / (t_0 + t_1))))) / 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[(eps$95$m * t$95$0), $MachinePrecision]}, If[LessEqual[eps$95$m, 1.0], N[(N[(2.0 * N[(N[Exp[(-x)], $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps$95$m, 9.5e+205], N[(N[(2.0 * N[(N[(x + 1.0), $MachinePrecision] * N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[eps$95$m, 4.8e+249], And[N[Not[LessEqual[eps$95$m, 8.5e+295]], $MachinePrecision], LessEqual[eps$95$m, 3.5e+304]]], N[(N[(2.0 + N[(x * N[(N[(N[(1.0 - eps$95$m), $MachinePrecision] * t$95$0), $MachinePrecision] + N[(N[(-1.0 + N[(N[(1.0 + eps$95$m), $MachinePrecision] * N[(1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(-1.0 - eps$95$m), $MachinePrecision] - N[(N[(1.0 + eps$95$m), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(N[(1.0 - N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 + t$95$1), $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 := eps\_m \cdot t\_0\\
\mathbf{if}\;eps\_m \leq 1:\\
\;\;\;\;\frac{2 \cdot \left(e^{-x} \cdot \left(x + 1\right)\right)}{2}\\
\mathbf{elif}\;eps\_m \leq 9.5 \cdot 10^{+205}:\\
\;\;\;\;\frac{2 \cdot \left(\left(x + 1\right) \cdot e^{x}\right)}{2}\\
\mathbf{elif}\;eps\_m \leq 4.8 \cdot 10^{+249} \lor \neg \left(eps\_m \leq 8.5 \cdot 10^{+295}\right) \land eps\_m \leq 3.5 \cdot 10^{+304}:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(1 - eps\_m\right) \cdot t\_0 + \frac{-1 + \left(1 + eps\_m\right) \cdot \left(1 + eps\_m\right)}{\left(-1 - eps\_m\right) - \frac{1 + eps\_m}{eps\_m}}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(\frac{1}{eps\_m} + \frac{1 - t\_1 \cdot t\_1}{t\_0 + t\_1}\right)}{2}\\
\end{array}
\end{array}
if eps < 1Initial program 61.5%
Simplified61.5%
Taylor expanded in eps around 0 71.9%
distribute-lft-out71.9%
cancel-sign-sub-inv71.9%
metadata-eval71.9%
distribute-rgt1-in71.9%
metadata-eval71.9%
distribute-rgt1-in71.9%
*-commutative71.9%
mul-1-neg71.9%
Simplified71.9%
if 1 < eps < 9.4999999999999997e205Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 38.6%
distribute-lft-out38.6%
cancel-sign-sub-inv38.6%
metadata-eval38.6%
distribute-rgt1-in38.6%
metadata-eval38.6%
distribute-rgt1-in38.6%
*-commutative38.6%
mul-1-neg38.6%
Simplified38.6%
+-commutative38.6%
distribute-rgt-in38.6%
*-un-lft-identity38.6%
add-sqr-sqrt24.2%
sqrt-unprod58.3%
sqr-neg58.3%
sqrt-unprod34.1%
add-sqr-sqrt58.3%
add-sqr-sqrt24.3%
sqrt-unprod58.3%
sqr-neg58.3%
sqrt-unprod34.1%
add-sqr-sqrt58.8%
Applied egg-rr58.8%
distribute-rgt1-in58.8%
+-commutative58.8%
Simplified58.8%
if 9.4999999999999997e205 < eps < 4.8e249 or 8.5000000000000003e295 < eps < 3.4999999999999998e304Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 16.0%
mul-1-neg16.0%
distribute-lft-neg-in16.0%
cancel-sign-sub-inv16.0%
mul-1-neg16.0%
distribute-rgt-neg-in16.0%
sub-neg16.0%
distribute-neg-in16.0%
metadata-eval16.0%
remove-double-neg16.0%
remove-double-neg16.0%
+-commutative16.0%
sub-neg16.0%
metadata-eval16.0%
+-commutative16.0%
Simplified16.0%
distribute-lft-in16.0%
flip-+60.3%
Applied egg-rr60.3%
Taylor expanded in eps around inf 60.3%
if 4.8e249 < eps < 8.5000000000000003e295 or 3.4999999999999998e304 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 12.8%
mul-1-neg12.8%
distribute-lft-neg-in12.8%
cancel-sign-sub-inv12.8%
mul-1-neg12.8%
distribute-rgt-neg-in12.8%
sub-neg12.8%
distribute-neg-in12.8%
metadata-eval12.8%
remove-double-neg12.8%
remove-double-neg12.8%
+-commutative12.8%
sub-neg12.8%
metadata-eval12.8%
+-commutative12.8%
Simplified12.8%
Taylor expanded in eps around 0 38.3%
distribute-lft-in38.3%
flip-+70.3%
Applied egg-rr70.3%
Taylor expanded in eps around inf 70.3%
Final simplification68.6%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (+ -1.0 (/ -1.0 eps_m)))
(t_1 (* eps_m t_0))
(t_2 (+ t_0 t_1))
(t_3 (/ (+ 1.0 eps_m) eps_m))
(t_4 (* t_1 t_1))
(t_5 (+ 1.0 (/ 1.0 eps_m))))
(if (<= x -1.35e+67)
(/ (+ 2.0 (* x (- (/ -1.0 eps_m) eps_m))) 2.0)
(if (<= x -5.6e-191)
(/
(+
2.0
(*
x
(+
(* (- 1.0 eps_m) t_0)
(/
(+
(* (+ 1.0 eps_m) (+ 1.0 eps_m))
(* t_3 (/ (- -1.0 eps_m) eps_m)))
(- (- -1.0 eps_m) t_3)))))
2.0)
(if (<= x 6.8e-217)
1.0
(if (<= x 1.45e-124)
(/ (+ 2.0 (* x (+ (/ 1.0 eps_m) (/ (- 1.0 t_4) t_2)))) 2.0)
(if (<= x 2.9e-8)
(/ (+ 2.0 (* x eps_m)) 2.0)
(/
(+ 2.0 (* x (+ (/ 1.0 eps_m) (/ (- (* t_5 t_5) t_4) t_2))))
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 = eps_m * t_0;
double t_2 = t_0 + t_1;
double t_3 = (1.0 + eps_m) / eps_m;
double t_4 = t_1 * t_1;
double t_5 = 1.0 + (1.0 / eps_m);
double tmp;
if (x <= -1.35e+67) {
tmp = (2.0 + (x * ((-1.0 / eps_m) - eps_m))) / 2.0;
} else if (x <= -5.6e-191) {
tmp = (2.0 + (x * (((1.0 - eps_m) * t_0) + ((((1.0 + eps_m) * (1.0 + eps_m)) + (t_3 * ((-1.0 - eps_m) / eps_m))) / ((-1.0 - eps_m) - t_3))))) / 2.0;
} else if (x <= 6.8e-217) {
tmp = 1.0;
} else if (x <= 1.45e-124) {
tmp = (2.0 + (x * ((1.0 / eps_m) + ((1.0 - t_4) / t_2)))) / 2.0;
} else if (x <= 2.9e-8) {
tmp = (2.0 + (x * eps_m)) / 2.0;
} else {
tmp = (2.0 + (x * ((1.0 / eps_m) + (((t_5 * t_5) - t_4) / t_2)))) / 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) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_0 = (-1.0d0) + ((-1.0d0) / eps_m)
t_1 = eps_m * t_0
t_2 = t_0 + t_1
t_3 = (1.0d0 + eps_m) / eps_m
t_4 = t_1 * t_1
t_5 = 1.0d0 + (1.0d0 / eps_m)
if (x <= (-1.35d+67)) then
tmp = (2.0d0 + (x * (((-1.0d0) / eps_m) - eps_m))) / 2.0d0
else if (x <= (-5.6d-191)) then
tmp = (2.0d0 + (x * (((1.0d0 - eps_m) * t_0) + ((((1.0d0 + eps_m) * (1.0d0 + eps_m)) + (t_3 * (((-1.0d0) - eps_m) / eps_m))) / (((-1.0d0) - eps_m) - t_3))))) / 2.0d0
else if (x <= 6.8d-217) then
tmp = 1.0d0
else if (x <= 1.45d-124) then
tmp = (2.0d0 + (x * ((1.0d0 / eps_m) + ((1.0d0 - t_4) / t_2)))) / 2.0d0
else if (x <= 2.9d-8) then
tmp = (2.0d0 + (x * eps_m)) / 2.0d0
else
tmp = (2.0d0 + (x * ((1.0d0 / eps_m) + (((t_5 * t_5) - t_4) / t_2)))) / 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 = eps_m * t_0;
double t_2 = t_0 + t_1;
double t_3 = (1.0 + eps_m) / eps_m;
double t_4 = t_1 * t_1;
double t_5 = 1.0 + (1.0 / eps_m);
double tmp;
if (x <= -1.35e+67) {
tmp = (2.0 + (x * ((-1.0 / eps_m) - eps_m))) / 2.0;
} else if (x <= -5.6e-191) {
tmp = (2.0 + (x * (((1.0 - eps_m) * t_0) + ((((1.0 + eps_m) * (1.0 + eps_m)) + (t_3 * ((-1.0 - eps_m) / eps_m))) / ((-1.0 - eps_m) - t_3))))) / 2.0;
} else if (x <= 6.8e-217) {
tmp = 1.0;
} else if (x <= 1.45e-124) {
tmp = (2.0 + (x * ((1.0 / eps_m) + ((1.0 - t_4) / t_2)))) / 2.0;
} else if (x <= 2.9e-8) {
tmp = (2.0 + (x * eps_m)) / 2.0;
} else {
tmp = (2.0 + (x * ((1.0 / eps_m) + (((t_5 * t_5) - t_4) / t_2)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = -1.0 + (-1.0 / eps_m) t_1 = eps_m * t_0 t_2 = t_0 + t_1 t_3 = (1.0 + eps_m) / eps_m t_4 = t_1 * t_1 t_5 = 1.0 + (1.0 / eps_m) tmp = 0 if x <= -1.35e+67: tmp = (2.0 + (x * ((-1.0 / eps_m) - eps_m))) / 2.0 elif x <= -5.6e-191: tmp = (2.0 + (x * (((1.0 - eps_m) * t_0) + ((((1.0 + eps_m) * (1.0 + eps_m)) + (t_3 * ((-1.0 - eps_m) / eps_m))) / ((-1.0 - eps_m) - t_3))))) / 2.0 elif x <= 6.8e-217: tmp = 1.0 elif x <= 1.45e-124: tmp = (2.0 + (x * ((1.0 / eps_m) + ((1.0 - t_4) / t_2)))) / 2.0 elif x <= 2.9e-8: tmp = (2.0 + (x * eps_m)) / 2.0 else: tmp = (2.0 + (x * ((1.0 / eps_m) + (((t_5 * t_5) - t_4) / t_2)))) / 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(eps_m * t_0) t_2 = Float64(t_0 + t_1) t_3 = Float64(Float64(1.0 + eps_m) / eps_m) t_4 = Float64(t_1 * t_1) t_5 = Float64(1.0 + Float64(1.0 / eps_m)) tmp = 0.0 if (x <= -1.35e+67) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(-1.0 / eps_m) - eps_m))) / 2.0); elseif (x <= -5.6e-191) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(1.0 - eps_m) * t_0) + Float64(Float64(Float64(Float64(1.0 + eps_m) * Float64(1.0 + eps_m)) + Float64(t_3 * Float64(Float64(-1.0 - eps_m) / eps_m))) / Float64(Float64(-1.0 - eps_m) - t_3))))) / 2.0); elseif (x <= 6.8e-217) tmp = 1.0; elseif (x <= 1.45e-124) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(1.0 / eps_m) + Float64(Float64(1.0 - t_4) / t_2)))) / 2.0); elseif (x <= 2.9e-8) tmp = Float64(Float64(2.0 + Float64(x * eps_m)) / 2.0); else tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(1.0 / eps_m) + Float64(Float64(Float64(t_5 * t_5) - t_4) / t_2)))) / 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 = eps_m * t_0; t_2 = t_0 + t_1; t_3 = (1.0 + eps_m) / eps_m; t_4 = t_1 * t_1; t_5 = 1.0 + (1.0 / eps_m); tmp = 0.0; if (x <= -1.35e+67) tmp = (2.0 + (x * ((-1.0 / eps_m) - eps_m))) / 2.0; elseif (x <= -5.6e-191) tmp = (2.0 + (x * (((1.0 - eps_m) * t_0) + ((((1.0 + eps_m) * (1.0 + eps_m)) + (t_3 * ((-1.0 - eps_m) / eps_m))) / ((-1.0 - eps_m) - t_3))))) / 2.0; elseif (x <= 6.8e-217) tmp = 1.0; elseif (x <= 1.45e-124) tmp = (2.0 + (x * ((1.0 / eps_m) + ((1.0 - t_4) / t_2)))) / 2.0; elseif (x <= 2.9e-8) tmp = (2.0 + (x * eps_m)) / 2.0; else tmp = (2.0 + (x * ((1.0 / eps_m) + (((t_5 * t_5) - t_4) / t_2)))) / 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[(eps$95$m * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 + t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(1.0 + eps$95$m), $MachinePrecision] / eps$95$m), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 * t$95$1), $MachinePrecision]}, Block[{t$95$5 = N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.35e+67], N[(N[(2.0 + N[(x * N[(N[(-1.0 / eps$95$m), $MachinePrecision] - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -5.6e-191], N[(N[(2.0 + N[(x * N[(N[(N[(1.0 - eps$95$m), $MachinePrecision] * t$95$0), $MachinePrecision] + N[(N[(N[(N[(1.0 + eps$95$m), $MachinePrecision] * N[(1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 * N[(N[(-1.0 - eps$95$m), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(-1.0 - eps$95$m), $MachinePrecision] - t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 6.8e-217], 1.0, If[LessEqual[x, 1.45e-124], N[(N[(2.0 + N[(x * N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(N[(1.0 - t$95$4), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.9e-8], N[(N[(2.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(N[(N[(t$95$5 * t$95$5), $MachinePrecision] - t$95$4), $MachinePrecision] / t$95$2), $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 := eps\_m \cdot t\_0\\
t_2 := t\_0 + t\_1\\
t_3 := \frac{1 + eps\_m}{eps\_m}\\
t_4 := t\_1 \cdot t\_1\\
t_5 := 1 + \frac{1}{eps\_m}\\
\mathbf{if}\;x \leq -1.35 \cdot 10^{+67}:\\
\;\;\;\;\frac{2 + x \cdot \left(\frac{-1}{eps\_m} - eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq -5.6 \cdot 10^{-191}:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(1 - eps\_m\right) \cdot t\_0 + \frac{\left(1 + eps\_m\right) \cdot \left(1 + eps\_m\right) + t\_3 \cdot \frac{-1 - eps\_m}{eps\_m}}{\left(-1 - eps\_m\right) - t\_3}\right)}{2}\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{-217}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{-124}:\\
\;\;\;\;\frac{2 + x \cdot \left(\frac{1}{eps\_m} + \frac{1 - t\_4}{t\_2}\right)}{2}\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{-8}:\\
\;\;\;\;\frac{2 + x \cdot eps\_m}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(\frac{1}{eps\_m} + \frac{t\_5 \cdot t\_5 - t\_4}{t\_2}\right)}{2}\\
\end{array}
\end{array}
if x < -1.35e67Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 3.2%
mul-1-neg3.2%
distribute-lft-neg-in3.2%
cancel-sign-sub-inv3.2%
mul-1-neg3.2%
distribute-rgt-neg-in3.2%
sub-neg3.2%
distribute-neg-in3.2%
metadata-eval3.2%
remove-double-neg3.2%
remove-double-neg3.2%
+-commutative3.2%
sub-neg3.2%
metadata-eval3.2%
+-commutative3.2%
Simplified3.2%
Taylor expanded in eps around 0 35.8%
Taylor expanded in eps around inf 35.8%
neg-mul-135.8%
Simplified35.8%
if -1.35e67 < x < -5.60000000000000023e-191Initial program 67.7%
Simplified67.7%
Taylor expanded in x around 0 55.6%
mul-1-neg55.6%
distribute-lft-neg-in55.6%
cancel-sign-sub-inv55.6%
mul-1-neg55.6%
distribute-rgt-neg-in55.6%
sub-neg55.6%
distribute-neg-in55.6%
metadata-eval55.6%
remove-double-neg55.6%
remove-double-neg55.6%
+-commutative55.6%
sub-neg55.6%
metadata-eval55.6%
+-commutative55.6%
Simplified55.6%
distribute-lft-in55.6%
flip-+56.8%
Applied egg-rr56.8%
if -5.60000000000000023e-191 < x < 6.80000000000000032e-217Initial program 55.8%
Simplified55.8%
Taylor expanded in x around 0 98.6%
if 6.80000000000000032e-217 < x < 1.4500000000000001e-124Initial program 59.0%
Simplified59.0%
Taylor expanded in x around 0 66.5%
mul-1-neg66.5%
distribute-lft-neg-in66.5%
cancel-sign-sub-inv66.5%
mul-1-neg66.5%
distribute-rgt-neg-in66.5%
sub-neg66.5%
distribute-neg-in66.5%
metadata-eval66.5%
remove-double-neg66.5%
remove-double-neg66.5%
+-commutative66.5%
sub-neg66.5%
metadata-eval66.5%
+-commutative66.5%
Simplified66.5%
Taylor expanded in eps around 0 66.2%
distribute-lft-in66.2%
flip-+58.3%
Applied egg-rr58.3%
Taylor expanded in eps around inf 66.2%
if 1.4500000000000001e-124 < x < 2.9000000000000002e-8Initial program 42.5%
Simplified42.5%
Taylor expanded in x around 0 69.7%
mul-1-neg69.7%
distribute-lft-neg-in69.7%
cancel-sign-sub-inv69.7%
mul-1-neg69.7%
distribute-rgt-neg-in69.7%
sub-neg69.7%
distribute-neg-in69.7%
metadata-eval69.7%
remove-double-neg69.7%
remove-double-neg69.7%
+-commutative69.7%
sub-neg69.7%
metadata-eval69.7%
+-commutative69.7%
Simplified69.7%
Taylor expanded in eps around 0 69.4%
Taylor expanded in eps around 0 69.4%
if 2.9000000000000002e-8 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 3.1%
mul-1-neg3.1%
distribute-lft-neg-in3.1%
cancel-sign-sub-inv3.1%
mul-1-neg3.1%
distribute-rgt-neg-in3.1%
sub-neg3.1%
distribute-neg-in3.1%
metadata-eval3.1%
remove-double-neg3.1%
remove-double-neg3.1%
+-commutative3.1%
sub-neg3.1%
metadata-eval3.1%
+-commutative3.1%
Simplified3.1%
Taylor expanded in eps around 0 16.0%
distribute-lft-in16.0%
flip-+18.8%
Applied egg-rr18.8%
Final simplification57.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (+ -1.0 (/ -1.0 eps_m))) (t_1 (* eps_m t_0)))
(if (<= x -1.1e-123)
(/ (- 2.0 (* x eps_m)) 2.0)
(if (<= x -1e-190)
(/
(+
2.0
(*
x
(+
(* (- 1.0 eps_m) t_0)
(/
(+ -1.0 (* (+ 1.0 eps_m) (+ 1.0 eps_m)))
(- (- -1.0 eps_m) (/ (+ 1.0 eps_m) eps_m))))))
2.0)
(if (<= x 1.6e-216)
1.0
(if (or (<= x 3.35e-124) (not (<= x 4.3e-7)))
(/
(+ 2.0 (* x (+ (/ 1.0 eps_m) (/ (- 1.0 (* t_1 t_1)) (+ t_0 t_1)))))
2.0)
(/ (+ 2.0 (* x eps_m)) 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 = eps_m * t_0;
double tmp;
if (x <= -1.1e-123) {
tmp = (2.0 - (x * eps_m)) / 2.0;
} else if (x <= -1e-190) {
tmp = (2.0 + (x * (((1.0 - eps_m) * t_0) + ((-1.0 + ((1.0 + eps_m) * (1.0 + eps_m))) / ((-1.0 - eps_m) - ((1.0 + eps_m) / eps_m)))))) / 2.0;
} else if (x <= 1.6e-216) {
tmp = 1.0;
} else if ((x <= 3.35e-124) || !(x <= 4.3e-7)) {
tmp = (2.0 + (x * ((1.0 / eps_m) + ((1.0 - (t_1 * t_1)) / (t_0 + t_1))))) / 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (-1.0d0) + ((-1.0d0) / eps_m)
t_1 = eps_m * t_0
if (x <= (-1.1d-123)) then
tmp = (2.0d0 - (x * eps_m)) / 2.0d0
else if (x <= (-1d-190)) then
tmp = (2.0d0 + (x * (((1.0d0 - eps_m) * t_0) + (((-1.0d0) + ((1.0d0 + eps_m) * (1.0d0 + eps_m))) / (((-1.0d0) - eps_m) - ((1.0d0 + eps_m) / eps_m)))))) / 2.0d0
else if (x <= 1.6d-216) then
tmp = 1.0d0
else if ((x <= 3.35d-124) .or. (.not. (x <= 4.3d-7))) then
tmp = (2.0d0 + (x * ((1.0d0 / eps_m) + ((1.0d0 - (t_1 * t_1)) / (t_0 + t_1))))) / 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 t_0 = -1.0 + (-1.0 / eps_m);
double t_1 = eps_m * t_0;
double tmp;
if (x <= -1.1e-123) {
tmp = (2.0 - (x * eps_m)) / 2.0;
} else if (x <= -1e-190) {
tmp = (2.0 + (x * (((1.0 - eps_m) * t_0) + ((-1.0 + ((1.0 + eps_m) * (1.0 + eps_m))) / ((-1.0 - eps_m) - ((1.0 + eps_m) / eps_m)))))) / 2.0;
} else if (x <= 1.6e-216) {
tmp = 1.0;
} else if ((x <= 3.35e-124) || !(x <= 4.3e-7)) {
tmp = (2.0 + (x * ((1.0 / eps_m) + ((1.0 - (t_1 * t_1)) / (t_0 + t_1))))) / 2.0;
} else {
tmp = (2.0 + (x * eps_m)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = -1.0 + (-1.0 / eps_m) t_1 = eps_m * t_0 tmp = 0 if x <= -1.1e-123: tmp = (2.0 - (x * eps_m)) / 2.0 elif x <= -1e-190: tmp = (2.0 + (x * (((1.0 - eps_m) * t_0) + ((-1.0 + ((1.0 + eps_m) * (1.0 + eps_m))) / ((-1.0 - eps_m) - ((1.0 + eps_m) / eps_m)))))) / 2.0 elif x <= 1.6e-216: tmp = 1.0 elif (x <= 3.35e-124) or not (x <= 4.3e-7): tmp = (2.0 + (x * ((1.0 / eps_m) + ((1.0 - (t_1 * t_1)) / (t_0 + t_1))))) / 2.0 else: tmp = (2.0 + (x * eps_m)) / 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(eps_m * t_0) tmp = 0.0 if (x <= -1.1e-123) tmp = Float64(Float64(2.0 - Float64(x * eps_m)) / 2.0); elseif (x <= -1e-190) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(1.0 - eps_m) * t_0) + Float64(Float64(-1.0 + Float64(Float64(1.0 + eps_m) * Float64(1.0 + eps_m))) / Float64(Float64(-1.0 - eps_m) - Float64(Float64(1.0 + eps_m) / eps_m)))))) / 2.0); elseif (x <= 1.6e-216) tmp = 1.0; elseif ((x <= 3.35e-124) || !(x <= 4.3e-7)) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(1.0 / eps_m) + Float64(Float64(1.0 - Float64(t_1 * t_1)) / Float64(t_0 + t_1))))) / 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) t_0 = -1.0 + (-1.0 / eps_m); t_1 = eps_m * t_0; tmp = 0.0; if (x <= -1.1e-123) tmp = (2.0 - (x * eps_m)) / 2.0; elseif (x <= -1e-190) tmp = (2.0 + (x * (((1.0 - eps_m) * t_0) + ((-1.0 + ((1.0 + eps_m) * (1.0 + eps_m))) / ((-1.0 - eps_m) - ((1.0 + eps_m) / eps_m)))))) / 2.0; elseif (x <= 1.6e-216) tmp = 1.0; elseif ((x <= 3.35e-124) || ~((x <= 4.3e-7))) tmp = (2.0 + (x * ((1.0 / eps_m) + ((1.0 - (t_1 * t_1)) / (t_0 + t_1))))) / 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_] := Block[{t$95$0 = N[(-1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(eps$95$m * t$95$0), $MachinePrecision]}, If[LessEqual[x, -1.1e-123], N[(N[(2.0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -1e-190], N[(N[(2.0 + N[(x * N[(N[(N[(1.0 - eps$95$m), $MachinePrecision] * t$95$0), $MachinePrecision] + N[(N[(-1.0 + N[(N[(1.0 + eps$95$m), $MachinePrecision] * N[(1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(-1.0 - eps$95$m), $MachinePrecision] - N[(N[(1.0 + eps$95$m), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.6e-216], 1.0, If[Or[LessEqual[x, 3.35e-124], N[Not[LessEqual[x, 4.3e-7]], $MachinePrecision]], N[(N[(2.0 + N[(x * N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(N[(1.0 - N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 + t$95$1), $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}
t_0 := -1 + \frac{-1}{eps\_m}\\
t_1 := eps\_m \cdot t\_0\\
\mathbf{if}\;x \leq -1.1 \cdot 10^{-123}:\\
\;\;\;\;\frac{2 - x \cdot eps\_m}{2}\\
\mathbf{elif}\;x \leq -1 \cdot 10^{-190}:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(1 - eps\_m\right) \cdot t\_0 + \frac{-1 + \left(1 + eps\_m\right) \cdot \left(1 + eps\_m\right)}{\left(-1 - eps\_m\right) - \frac{1 + eps\_m}{eps\_m}}\right)}{2}\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{-216}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 3.35 \cdot 10^{-124} \lor \neg \left(x \leq 4.3 \cdot 10^{-7}\right):\\
\;\;\;\;\frac{2 + x \cdot \left(\frac{1}{eps\_m} + \frac{1 - t\_1 \cdot t\_1}{t\_0 + t\_1}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < -1.10000000000000003e-123Initial program 82.6%
Simplified82.6%
Taylor expanded in x around 0 27.7%
mul-1-neg27.7%
distribute-lft-neg-in27.7%
cancel-sign-sub-inv27.7%
mul-1-neg27.7%
distribute-rgt-neg-in27.7%
sub-neg27.7%
distribute-neg-in27.7%
metadata-eval27.7%
remove-double-neg27.7%
remove-double-neg27.7%
+-commutative27.7%
sub-neg27.7%
metadata-eval27.7%
+-commutative27.7%
Simplified27.7%
Taylor expanded in eps around 0 44.8%
Taylor expanded in eps around 0 44.8%
neg-mul-144.8%
Simplified44.8%
if -1.10000000000000003e-123 < x < -1e-190Initial program 75.8%
Simplified75.8%
Taylor expanded in x around 0 57.6%
mul-1-neg57.6%
distribute-lft-neg-in57.6%
cancel-sign-sub-inv57.6%
mul-1-neg57.6%
distribute-rgt-neg-in57.6%
sub-neg57.6%
distribute-neg-in57.6%
metadata-eval57.6%
remove-double-neg57.6%
remove-double-neg57.6%
+-commutative57.6%
sub-neg57.6%
metadata-eval57.6%
+-commutative57.6%
Simplified57.6%
distribute-lft-in57.6%
flip-+68.8%
Applied egg-rr68.8%
Taylor expanded in eps around inf 68.8%
if -1e-190 < x < 1.60000000000000013e-216Initial program 55.8%
Simplified55.8%
Taylor expanded in x around 0 98.6%
if 1.60000000000000013e-216 < x < 3.35e-124 or 4.3000000000000001e-7 < x Initial program 87.3%
Simplified87.3%
Taylor expanded in x around 0 22.7%
mul-1-neg22.7%
distribute-lft-neg-in22.7%
cancel-sign-sub-inv22.7%
mul-1-neg22.7%
distribute-rgt-neg-in22.7%
sub-neg22.7%
distribute-neg-in22.7%
metadata-eval22.7%
remove-double-neg22.7%
remove-double-neg22.7%
+-commutative22.7%
sub-neg22.7%
metadata-eval22.7%
+-commutative22.7%
Simplified22.7%
Taylor expanded in eps around 0 31.5%
distribute-lft-in31.5%
flip-+31.0%
Applied egg-rr31.0%
Taylor expanded in eps around inf 33.3%
if 3.35e-124 < x < 4.3000000000000001e-7Initial program 42.5%
Simplified42.5%
Taylor expanded in x around 0 69.7%
mul-1-neg69.7%
distribute-lft-neg-in69.7%
cancel-sign-sub-inv69.7%
mul-1-neg69.7%
distribute-rgt-neg-in69.7%
sub-neg69.7%
distribute-neg-in69.7%
metadata-eval69.7%
remove-double-neg69.7%
remove-double-neg69.7%
+-commutative69.7%
sub-neg69.7%
metadata-eval69.7%
+-commutative69.7%
Simplified69.7%
Taylor expanded in eps around 0 69.4%
Taylor expanded in eps around 0 69.4%
Final simplification57.6%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (+ -1.0 (/ -1.0 eps_m)))
(t_1 (* eps_m t_0))
(t_2 (/ (+ 1.0 eps_m) eps_m)))
(if (<= x -1.35e+67)
(/ (+ 2.0 (* x (- (/ -1.0 eps_m) eps_m))) 2.0)
(if (<= x -3.9e-193)
(/
(+
2.0
(*
x
(+
(* (- 1.0 eps_m) t_0)
(/
(+
(* (+ 1.0 eps_m) (+ 1.0 eps_m))
(* t_2 (/ (- -1.0 eps_m) eps_m)))
(- (- -1.0 eps_m) t_2)))))
2.0)
(if (<= x 3.5e-217)
1.0
(if (or (<= x 3.9e-125) (not (<= x 5.4e-6)))
(/
(+ 2.0 (* x (+ (/ 1.0 eps_m) (/ (- 1.0 (* t_1 t_1)) (+ t_0 t_1)))))
2.0)
(/ (+ 2.0 (* x eps_m)) 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 = eps_m * t_0;
double t_2 = (1.0 + eps_m) / eps_m;
double tmp;
if (x <= -1.35e+67) {
tmp = (2.0 + (x * ((-1.0 / eps_m) - eps_m))) / 2.0;
} else if (x <= -3.9e-193) {
tmp = (2.0 + (x * (((1.0 - eps_m) * t_0) + ((((1.0 + eps_m) * (1.0 + eps_m)) + (t_2 * ((-1.0 - eps_m) / eps_m))) / ((-1.0 - eps_m) - t_2))))) / 2.0;
} else if (x <= 3.5e-217) {
tmp = 1.0;
} else if ((x <= 3.9e-125) || !(x <= 5.4e-6)) {
tmp = (2.0 + (x * ((1.0 / eps_m) + ((1.0 - (t_1 * t_1)) / (t_0 + t_1))))) / 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) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (-1.0d0) + ((-1.0d0) / eps_m)
t_1 = eps_m * t_0
t_2 = (1.0d0 + eps_m) / eps_m
if (x <= (-1.35d+67)) then
tmp = (2.0d0 + (x * (((-1.0d0) / eps_m) - eps_m))) / 2.0d0
else if (x <= (-3.9d-193)) then
tmp = (2.0d0 + (x * (((1.0d0 - eps_m) * t_0) + ((((1.0d0 + eps_m) * (1.0d0 + eps_m)) + (t_2 * (((-1.0d0) - eps_m) / eps_m))) / (((-1.0d0) - eps_m) - t_2))))) / 2.0d0
else if (x <= 3.5d-217) then
tmp = 1.0d0
else if ((x <= 3.9d-125) .or. (.not. (x <= 5.4d-6))) then
tmp = (2.0d0 + (x * ((1.0d0 / eps_m) + ((1.0d0 - (t_1 * t_1)) / (t_0 + t_1))))) / 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 t_0 = -1.0 + (-1.0 / eps_m);
double t_1 = eps_m * t_0;
double t_2 = (1.0 + eps_m) / eps_m;
double tmp;
if (x <= -1.35e+67) {
tmp = (2.0 + (x * ((-1.0 / eps_m) - eps_m))) / 2.0;
} else if (x <= -3.9e-193) {
tmp = (2.0 + (x * (((1.0 - eps_m) * t_0) + ((((1.0 + eps_m) * (1.0 + eps_m)) + (t_2 * ((-1.0 - eps_m) / eps_m))) / ((-1.0 - eps_m) - t_2))))) / 2.0;
} else if (x <= 3.5e-217) {
tmp = 1.0;
} else if ((x <= 3.9e-125) || !(x <= 5.4e-6)) {
tmp = (2.0 + (x * ((1.0 / eps_m) + ((1.0 - (t_1 * t_1)) / (t_0 + t_1))))) / 2.0;
} else {
tmp = (2.0 + (x * eps_m)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = -1.0 + (-1.0 / eps_m) t_1 = eps_m * t_0 t_2 = (1.0 + eps_m) / eps_m tmp = 0 if x <= -1.35e+67: tmp = (2.0 + (x * ((-1.0 / eps_m) - eps_m))) / 2.0 elif x <= -3.9e-193: tmp = (2.0 + (x * (((1.0 - eps_m) * t_0) + ((((1.0 + eps_m) * (1.0 + eps_m)) + (t_2 * ((-1.0 - eps_m) / eps_m))) / ((-1.0 - eps_m) - t_2))))) / 2.0 elif x <= 3.5e-217: tmp = 1.0 elif (x <= 3.9e-125) or not (x <= 5.4e-6): tmp = (2.0 + (x * ((1.0 / eps_m) + ((1.0 - (t_1 * t_1)) / (t_0 + t_1))))) / 2.0 else: tmp = (2.0 + (x * eps_m)) / 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(eps_m * t_0) t_2 = Float64(Float64(1.0 + eps_m) / eps_m) tmp = 0.0 if (x <= -1.35e+67) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(-1.0 / eps_m) - eps_m))) / 2.0); elseif (x <= -3.9e-193) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(1.0 - eps_m) * t_0) + Float64(Float64(Float64(Float64(1.0 + eps_m) * Float64(1.0 + eps_m)) + Float64(t_2 * Float64(Float64(-1.0 - eps_m) / eps_m))) / Float64(Float64(-1.0 - eps_m) - t_2))))) / 2.0); elseif (x <= 3.5e-217) tmp = 1.0; elseif ((x <= 3.9e-125) || !(x <= 5.4e-6)) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(1.0 / eps_m) + Float64(Float64(1.0 - Float64(t_1 * t_1)) / Float64(t_0 + t_1))))) / 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) t_0 = -1.0 + (-1.0 / eps_m); t_1 = eps_m * t_0; t_2 = (1.0 + eps_m) / eps_m; tmp = 0.0; if (x <= -1.35e+67) tmp = (2.0 + (x * ((-1.0 / eps_m) - eps_m))) / 2.0; elseif (x <= -3.9e-193) tmp = (2.0 + (x * (((1.0 - eps_m) * t_0) + ((((1.0 + eps_m) * (1.0 + eps_m)) + (t_2 * ((-1.0 - eps_m) / eps_m))) / ((-1.0 - eps_m) - t_2))))) / 2.0; elseif (x <= 3.5e-217) tmp = 1.0; elseif ((x <= 3.9e-125) || ~((x <= 5.4e-6))) tmp = (2.0 + (x * ((1.0 / eps_m) + ((1.0 - (t_1 * t_1)) / (t_0 + t_1))))) / 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_] := Block[{t$95$0 = N[(-1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(eps$95$m * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(1.0 + eps$95$m), $MachinePrecision] / eps$95$m), $MachinePrecision]}, If[LessEqual[x, -1.35e+67], N[(N[(2.0 + N[(x * N[(N[(-1.0 / eps$95$m), $MachinePrecision] - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -3.9e-193], N[(N[(2.0 + N[(x * N[(N[(N[(1.0 - eps$95$m), $MachinePrecision] * t$95$0), $MachinePrecision] + N[(N[(N[(N[(1.0 + eps$95$m), $MachinePrecision] * N[(1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 * N[(N[(-1.0 - eps$95$m), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(-1.0 - eps$95$m), $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 3.5e-217], 1.0, If[Or[LessEqual[x, 3.9e-125], N[Not[LessEqual[x, 5.4e-6]], $MachinePrecision]], N[(N[(2.0 + N[(x * N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(N[(1.0 - N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 + t$95$1), $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}
t_0 := -1 + \frac{-1}{eps\_m}\\
t_1 := eps\_m \cdot t\_0\\
t_2 := \frac{1 + eps\_m}{eps\_m}\\
\mathbf{if}\;x \leq -1.35 \cdot 10^{+67}:\\
\;\;\;\;\frac{2 + x \cdot \left(\frac{-1}{eps\_m} - eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq -3.9 \cdot 10^{-193}:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(1 - eps\_m\right) \cdot t\_0 + \frac{\left(1 + eps\_m\right) \cdot \left(1 + eps\_m\right) + t\_2 \cdot \frac{-1 - eps\_m}{eps\_m}}{\left(-1 - eps\_m\right) - t\_2}\right)}{2}\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-217}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 3.9 \cdot 10^{-125} \lor \neg \left(x \leq 5.4 \cdot 10^{-6}\right):\\
\;\;\;\;\frac{2 + x \cdot \left(\frac{1}{eps\_m} + \frac{1 - t\_1 \cdot t\_1}{t\_0 + t\_1}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < -1.35e67Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 3.2%
mul-1-neg3.2%
distribute-lft-neg-in3.2%
cancel-sign-sub-inv3.2%
mul-1-neg3.2%
distribute-rgt-neg-in3.2%
sub-neg3.2%
distribute-neg-in3.2%
metadata-eval3.2%
remove-double-neg3.2%
remove-double-neg3.2%
+-commutative3.2%
sub-neg3.2%
metadata-eval3.2%
+-commutative3.2%
Simplified3.2%
Taylor expanded in eps around 0 35.8%
Taylor expanded in eps around inf 35.8%
neg-mul-135.8%
Simplified35.8%
if -1.35e67 < x < -3.8999999999999999e-193Initial program 67.7%
Simplified67.7%
Taylor expanded in x around 0 55.6%
mul-1-neg55.6%
distribute-lft-neg-in55.6%
cancel-sign-sub-inv55.6%
mul-1-neg55.6%
distribute-rgt-neg-in55.6%
sub-neg55.6%
distribute-neg-in55.6%
metadata-eval55.6%
remove-double-neg55.6%
remove-double-neg55.6%
+-commutative55.6%
sub-neg55.6%
metadata-eval55.6%
+-commutative55.6%
Simplified55.6%
distribute-lft-in55.6%
flip-+56.8%
Applied egg-rr56.8%
if -3.8999999999999999e-193 < x < 3.5e-217Initial program 55.8%
Simplified55.8%
Taylor expanded in x around 0 98.6%
if 3.5e-217 < x < 3.89999999999999982e-125 or 5.39999999999999997e-6 < x Initial program 87.3%
Simplified87.3%
Taylor expanded in x around 0 22.7%
mul-1-neg22.7%
distribute-lft-neg-in22.7%
cancel-sign-sub-inv22.7%
mul-1-neg22.7%
distribute-rgt-neg-in22.7%
sub-neg22.7%
distribute-neg-in22.7%
metadata-eval22.7%
remove-double-neg22.7%
remove-double-neg22.7%
+-commutative22.7%
sub-neg22.7%
metadata-eval22.7%
+-commutative22.7%
Simplified22.7%
Taylor expanded in eps around 0 31.5%
distribute-lft-in31.5%
flip-+31.0%
Applied egg-rr31.0%
Taylor expanded in eps around inf 33.3%
if 3.89999999999999982e-125 < x < 5.39999999999999997e-6Initial program 42.5%
Simplified42.5%
Taylor expanded in x around 0 69.7%
mul-1-neg69.7%
distribute-lft-neg-in69.7%
cancel-sign-sub-inv69.7%
mul-1-neg69.7%
distribute-rgt-neg-in69.7%
sub-neg69.7%
distribute-neg-in69.7%
metadata-eval69.7%
remove-double-neg69.7%
remove-double-neg69.7%
+-commutative69.7%
sub-neg69.7%
metadata-eval69.7%
+-commutative69.7%
Simplified69.7%
Taylor expanded in eps around 0 69.4%
Taylor expanded in eps around 0 69.4%
Final simplification57.1%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (* (- 1.0 eps_m) (+ -1.0 (/ -1.0 eps_m)))))
(if (<= x -1.6e-123)
(/ (- 2.0 (* x eps_m)) 2.0)
(if (<= x -1.05e-194)
(/
(+
2.0
(*
x
(+
t_0
(/
(+ -1.0 (* (+ 1.0 eps_m) (+ 1.0 eps_m)))
(- (- -1.0 eps_m) (/ (+ 1.0 eps_m) eps_m))))))
2.0)
(/ (+ 2.0 (* x (+ (/ 1.0 eps_m) t_0))) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = (1.0 - eps_m) * (-1.0 + (-1.0 / eps_m));
double tmp;
if (x <= -1.6e-123) {
tmp = (2.0 - (x * eps_m)) / 2.0;
} else if (x <= -1.05e-194) {
tmp = (2.0 + (x * (t_0 + ((-1.0 + ((1.0 + eps_m) * (1.0 + eps_m))) / ((-1.0 - eps_m) - ((1.0 + eps_m) / eps_m)))))) / 2.0;
} else {
tmp = (2.0 + (x * ((1.0 / eps_m) + t_0))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: tmp
t_0 = (1.0d0 - eps_m) * ((-1.0d0) + ((-1.0d0) / eps_m))
if (x <= (-1.6d-123)) then
tmp = (2.0d0 - (x * eps_m)) / 2.0d0
else if (x <= (-1.05d-194)) then
tmp = (2.0d0 + (x * (t_0 + (((-1.0d0) + ((1.0d0 + eps_m) * (1.0d0 + eps_m))) / (((-1.0d0) - eps_m) - ((1.0d0 + eps_m) / eps_m)))))) / 2.0d0
else
tmp = (2.0d0 + (x * ((1.0d0 / eps_m) + t_0))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = (1.0 - eps_m) * (-1.0 + (-1.0 / eps_m));
double tmp;
if (x <= -1.6e-123) {
tmp = (2.0 - (x * eps_m)) / 2.0;
} else if (x <= -1.05e-194) {
tmp = (2.0 + (x * (t_0 + ((-1.0 + ((1.0 + eps_m) * (1.0 + eps_m))) / ((-1.0 - eps_m) - ((1.0 + eps_m) / eps_m)))))) / 2.0;
} else {
tmp = (2.0 + (x * ((1.0 / eps_m) + t_0))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = (1.0 - eps_m) * (-1.0 + (-1.0 / eps_m)) tmp = 0 if x <= -1.6e-123: tmp = (2.0 - (x * eps_m)) / 2.0 elif x <= -1.05e-194: tmp = (2.0 + (x * (t_0 + ((-1.0 + ((1.0 + eps_m) * (1.0 + eps_m))) / ((-1.0 - eps_m) - ((1.0 + eps_m) / eps_m)))))) / 2.0 else: tmp = (2.0 + (x * ((1.0 / eps_m) + t_0))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(Float64(1.0 - eps_m) * Float64(-1.0 + Float64(-1.0 / eps_m))) tmp = 0.0 if (x <= -1.6e-123) tmp = Float64(Float64(2.0 - Float64(x * eps_m)) / 2.0); elseif (x <= -1.05e-194) tmp = Float64(Float64(2.0 + Float64(x * Float64(t_0 + Float64(Float64(-1.0 + Float64(Float64(1.0 + eps_m) * Float64(1.0 + eps_m))) / Float64(Float64(-1.0 - eps_m) - Float64(Float64(1.0 + eps_m) / eps_m)))))) / 2.0); else tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(1.0 / eps_m) + t_0))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = (1.0 - eps_m) * (-1.0 + (-1.0 / eps_m)); tmp = 0.0; if (x <= -1.6e-123) tmp = (2.0 - (x * eps_m)) / 2.0; elseif (x <= -1.05e-194) tmp = (2.0 + (x * (t_0 + ((-1.0 + ((1.0 + eps_m) * (1.0 + eps_m))) / ((-1.0 - eps_m) - ((1.0 + eps_m) / eps_m)))))) / 2.0; else tmp = (2.0 + (x * ((1.0 / eps_m) + t_0))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(N[(1.0 - eps$95$m), $MachinePrecision] * N[(-1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.6e-123], N[(N[(2.0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -1.05e-194], N[(N[(2.0 + N[(x * N[(t$95$0 + N[(N[(-1.0 + N[(N[(1.0 + eps$95$m), $MachinePrecision] * N[(1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(-1.0 - eps$95$m), $MachinePrecision] - N[(N[(1.0 + eps$95$m), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * N[(N[(1.0 / eps$95$m), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := \left(1 - eps\_m\right) \cdot \left(-1 + \frac{-1}{eps\_m}\right)\\
\mathbf{if}\;x \leq -1.6 \cdot 10^{-123}:\\
\;\;\;\;\frac{2 - x \cdot eps\_m}{2}\\
\mathbf{elif}\;x \leq -1.05 \cdot 10^{-194}:\\
\;\;\;\;\frac{2 + x \cdot \left(t\_0 + \frac{-1 + \left(1 + eps\_m\right) \cdot \left(1 + eps\_m\right)}{\left(-1 - eps\_m\right) - \frac{1 + eps\_m}{eps\_m}}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(\frac{1}{eps\_m} + t\_0\right)}{2}\\
\end{array}
\end{array}
if x < -1.59999999999999989e-123Initial program 82.6%
Simplified82.6%
Taylor expanded in x around 0 27.7%
mul-1-neg27.7%
distribute-lft-neg-in27.7%
cancel-sign-sub-inv27.7%
mul-1-neg27.7%
distribute-rgt-neg-in27.7%
sub-neg27.7%
distribute-neg-in27.7%
metadata-eval27.7%
remove-double-neg27.7%
remove-double-neg27.7%
+-commutative27.7%
sub-neg27.7%
metadata-eval27.7%
+-commutative27.7%
Simplified27.7%
Taylor expanded in eps around 0 44.8%
Taylor expanded in eps around 0 44.8%
neg-mul-144.8%
Simplified44.8%
if -1.59999999999999989e-123 < x < -1.05e-194Initial program 75.8%
Simplified75.8%
Taylor expanded in x around 0 57.6%
mul-1-neg57.6%
distribute-lft-neg-in57.6%
cancel-sign-sub-inv57.6%
mul-1-neg57.6%
distribute-rgt-neg-in57.6%
sub-neg57.6%
distribute-neg-in57.6%
metadata-eval57.6%
remove-double-neg57.6%
remove-double-neg57.6%
+-commutative57.6%
sub-neg57.6%
metadata-eval57.6%
+-commutative57.6%
Simplified57.6%
distribute-lft-in57.6%
flip-+68.8%
Applied egg-rr68.8%
Taylor expanded in eps around inf 68.8%
if -1.05e-194 < x Initial program 68.6%
Simplified68.6%
Taylor expanded in x around 0 56.4%
mul-1-neg56.4%
distribute-lft-neg-in56.4%
cancel-sign-sub-inv56.4%
mul-1-neg56.4%
distribute-rgt-neg-in56.4%
sub-neg56.4%
distribute-neg-in56.4%
metadata-eval56.4%
remove-double-neg56.4%
remove-double-neg56.4%
+-commutative56.4%
sub-neg56.4%
metadata-eval56.4%
+-commutative56.4%
Simplified56.4%
Taylor expanded in eps around 0 60.1%
Final simplification56.6%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1.5e-242)
(/ (- 2.0 (* x eps_m)) 2.0)
(/
(+ 2.0 (* x (+ (/ 1.0 eps_m) (* (- 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 <= -1.5e-242) {
tmp = (2.0 - (x * eps_m)) / 2.0;
} else {
tmp = (2.0 + (x * ((1.0 / eps_m) + ((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 <= (-1.5d-242)) then
tmp = (2.0d0 - (x * eps_m)) / 2.0d0
else
tmp = (2.0d0 + (x * ((1.0d0 / eps_m) + ((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 <= -1.5e-242) {
tmp = (2.0 - (x * eps_m)) / 2.0;
} else {
tmp = (2.0 + (x * ((1.0 / eps_m) + ((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 <= -1.5e-242: tmp = (2.0 - (x * eps_m)) / 2.0 else: tmp = (2.0 + (x * ((1.0 / eps_m) + ((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 <= -1.5e-242) tmp = Float64(Float64(2.0 - Float64(x * eps_m)) / 2.0); else tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(1.0 / eps_m) + Float64(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 <= -1.5e-242) tmp = (2.0 - (x * eps_m)) / 2.0; else tmp = (2.0 + (x * ((1.0 / eps_m) + ((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, -1.5e-242], N[(N[(2.0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * 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]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{-242}:\\
\;\;\;\;\frac{2 - x \cdot eps\_m}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(\frac{1}{eps\_m} + \left(1 - eps\_m\right) \cdot \left(-1 + \frac{-1}{eps\_m}\right)\right)}{2}\\
\end{array}
\end{array}
if x < -1.5e-242Initial program 76.8%
Simplified76.8%
Taylor expanded in x around 0 44.0%
mul-1-neg44.0%
distribute-lft-neg-in44.0%
cancel-sign-sub-inv44.0%
mul-1-neg44.0%
distribute-rgt-neg-in44.0%
sub-neg44.0%
distribute-neg-in44.0%
metadata-eval44.0%
remove-double-neg44.0%
remove-double-neg44.0%
+-commutative44.0%
sub-neg44.0%
metadata-eval44.0%
+-commutative44.0%
Simplified44.0%
Taylor expanded in eps around 0 54.9%
Taylor expanded in eps around 0 54.9%
neg-mul-154.9%
Simplified54.9%
if -1.5e-242 < x Initial program 70.2%
Simplified70.2%
Taylor expanded in x around 0 52.2%
mul-1-neg52.2%
distribute-lft-neg-in52.2%
cancel-sign-sub-inv52.2%
mul-1-neg52.2%
distribute-rgt-neg-in52.2%
sub-neg52.2%
distribute-neg-in52.2%
metadata-eval52.2%
remove-double-neg52.2%
remove-double-neg52.2%
+-commutative52.2%
sub-neg52.2%
metadata-eval52.2%
+-commutative52.2%
Simplified52.2%
Taylor expanded in eps around 0 56.5%
Final simplification55.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.5e-242) (/ (- 2.0 (* x 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 <= -1.5e-242) {
tmp = (2.0 - (x * 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 <= (-1.5d-242)) then
tmp = (2.0d0 - (x * 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 <= -1.5e-242) {
tmp = (2.0 - (x * 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 <= -1.5e-242: tmp = (2.0 - (x * 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 <= -1.5e-242) tmp = Float64(Float64(2.0 - Float64(x * 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 <= -1.5e-242) tmp = (2.0 - (x * 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, -1.5e-242], N[(N[(2.0 - N[(x * 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 -1.5 \cdot 10^{-242}:\\
\;\;\;\;\frac{2 - x \cdot eps\_m}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < -1.5e-242Initial program 76.8%
Simplified76.8%
Taylor expanded in x around 0 44.0%
mul-1-neg44.0%
distribute-lft-neg-in44.0%
cancel-sign-sub-inv44.0%
mul-1-neg44.0%
distribute-rgt-neg-in44.0%
sub-neg44.0%
distribute-neg-in44.0%
metadata-eval44.0%
remove-double-neg44.0%
remove-double-neg44.0%
+-commutative44.0%
sub-neg44.0%
metadata-eval44.0%
+-commutative44.0%
Simplified44.0%
Taylor expanded in eps around 0 54.9%
Taylor expanded in eps around 0 54.9%
neg-mul-154.9%
Simplified54.9%
if -1.5e-242 < x Initial program 70.2%
Simplified70.2%
Taylor expanded in x around 0 52.2%
mul-1-neg52.2%
distribute-lft-neg-in52.2%
cancel-sign-sub-inv52.2%
mul-1-neg52.2%
distribute-rgt-neg-in52.2%
sub-neg52.2%
distribute-neg-in52.2%
metadata-eval52.2%
remove-double-neg52.2%
remove-double-neg52.2%
+-commutative52.2%
sub-neg52.2%
metadata-eval52.2%
+-commutative52.2%
Simplified52.2%
Taylor expanded in eps around 0 56.5%
Taylor expanded in eps around 0 56.4%
Final simplification55.8%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ 2.0 (* x eps_m)) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (2.0 + (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 = (2.0d0 + (x * eps_m)) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return (2.0 + (x * eps_m)) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (2.0 + (x * eps_m)) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(2.0 + Float64(x * eps_m)) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (2.0 + (x * eps_m)) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(2.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\frac{2 + x \cdot eps\_m}{2}
\end{array}
Initial program 72.8%
Simplified72.8%
Taylor expanded in x around 0 49.0%
mul-1-neg49.0%
distribute-lft-neg-in49.0%
cancel-sign-sub-inv49.0%
mul-1-neg49.0%
distribute-rgt-neg-in49.0%
sub-neg49.0%
distribute-neg-in49.0%
metadata-eval49.0%
remove-double-neg49.0%
remove-double-neg49.0%
+-commutative49.0%
sub-neg49.0%
metadata-eval49.0%
+-commutative49.0%
Simplified49.0%
Taylor expanded in eps around 0 55.4%
Taylor expanded in eps around 0 55.3%
Final simplification55.3%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 1.0)
eps_m = fabs(eps);
double code(double x, double eps_m) {
return 1.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = 1.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return 1.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return 1.0
eps_m = abs(eps) function code(x, eps_m) return 1.0 end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = 1.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := 1.0
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
1
\end{array}
Initial program 72.8%
Simplified72.8%
Taylor expanded in x around 0 49.0%
Final simplification49.0%
herbie shell --seed 2024048
(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))