
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
(FPCore (x eps)
:precision binary64
(let* ((t_0
(-
(* (+ 1.0 (/ 1.0 eps)) (exp (* x (+ eps -1.0))))
(* (- -1.0 (/ -1.0 eps)) (exp (* x (- -1.0 eps)))))))
(if (<= t_0 0.0)
(/ (+ (/ (+ 1.0 x) (exp x)) (* (+ 1.0 x) (exp (- x)))) 2.0)
(/ t_0 2.0))))
double code(double x, double eps) {
double t_0 = ((1.0 + (1.0 / eps)) * exp((x * (eps + -1.0)))) - ((-1.0 - (-1.0 / eps)) * exp((x * (-1.0 - eps))));
double tmp;
if (t_0 <= 0.0) {
tmp = (((1.0 + x) / exp(x)) + ((1.0 + x) * exp(-x))) / 2.0;
} else {
tmp = t_0 / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = ((1.0d0 + (1.0d0 / eps)) * exp((x * (eps + (-1.0d0))))) - (((-1.0d0) - ((-1.0d0) / eps)) * exp((x * ((-1.0d0) - eps))))
if (t_0 <= 0.0d0) then
tmp = (((1.0d0 + x) / exp(x)) + ((1.0d0 + x) * exp(-x))) / 2.0d0
else
tmp = t_0 / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = ((1.0 + (1.0 / eps)) * Math.exp((x * (eps + -1.0)))) - ((-1.0 - (-1.0 / eps)) * Math.exp((x * (-1.0 - eps))));
double tmp;
if (t_0 <= 0.0) {
tmp = (((1.0 + x) / Math.exp(x)) + ((1.0 + x) * Math.exp(-x))) / 2.0;
} else {
tmp = t_0 / 2.0;
}
return tmp;
}
def code(x, eps): t_0 = ((1.0 + (1.0 / eps)) * math.exp((x * (eps + -1.0)))) - ((-1.0 - (-1.0 / eps)) * math.exp((x * (-1.0 - eps)))) tmp = 0 if t_0 <= 0.0: tmp = (((1.0 + x) / math.exp(x)) + ((1.0 + x) * math.exp(-x))) / 2.0 else: tmp = t_0 / 2.0 return tmp
function code(x, eps) t_0 = Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(x * Float64(eps + -1.0)))) - Float64(Float64(-1.0 - Float64(-1.0 / eps)) * exp(Float64(x * Float64(-1.0 - eps))))) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(Float64(Float64(Float64(1.0 + x) / exp(x)) + Float64(Float64(1.0 + x) * exp(Float64(-x)))) / 2.0); else tmp = Float64(t_0 / 2.0); end return tmp end
function tmp_2 = code(x, eps) t_0 = ((1.0 + (1.0 / eps)) * exp((x * (eps + -1.0)))) - ((-1.0 - (-1.0 / eps)) * exp((x * (-1.0 - eps)))); tmp = 0.0; if (t_0 <= 0.0) tmp = (((1.0 + x) / exp(x)) + ((1.0 + x) * exp(-x))) / 2.0; else tmp = t_0 / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(-1.0 - N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(N[(N[(N[(1.0 + x), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + x), $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(t$95$0 / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 + \frac{1}{\varepsilon}\right) \cdot e^{x \cdot \left(\varepsilon + -1\right)} - \left(-1 - \frac{-1}{\varepsilon}\right) \cdot e^{x \cdot \left(-1 - \varepsilon\right)}\\
\mathbf{if}\;t_0 \leq 0:\\
\;\;\;\;\frac{\frac{1 + x}{e^{x}} + \left(1 + x\right) \cdot e^{-x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{2}\\
\end{array}
\end{array}
if (-.f64 (*.f64 (+.f64 1 (/.f64 1 eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 1 eps) x)))) (*.f64 (-.f64 (/.f64 1 eps) 1) (exp.f64 (neg.f64 (*.f64 (+.f64 1 eps) x))))) < 0.0Initial program 33.1%
sub-neg33.1%
neg-sub033.1%
associate-+r-33.1%
Simplified33.1%
Taylor expanded in eps around 0 100.0%
neg-mul-1100.0%
rec-exp100.0%
*-commutative100.0%
neg-mul-1100.0%
rec-exp100.0%
distribute-lft1-in100.0%
rec-exp100.0%
distribute-lft-out100.0%
mul-1-neg100.0%
neg-mul-1100.0%
rec-exp100.0%
*-commutative100.0%
neg-mul-1100.0%
rec-exp100.0%
distribute-lft1-in100.0%
rec-exp100.0%
Simplified100.0%
exp-neg100.0%
un-div-inv100.0%
Applied egg-rr100.0%
if 0.0 < (-.f64 (*.f64 (+.f64 1 (/.f64 1 eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 1 eps) x)))) (*.f64 (-.f64 (/.f64 1 eps) 1) (exp.f64 (neg.f64 (*.f64 (+.f64 1 eps) x))))) Initial program 100.0%
Final simplification100.0%
(FPCore (x eps)
:precision binary64
(if (<= x -4e-299)
(/ (+ 1.0 (exp (* x (- -1.0 eps)))) 2.0)
(if (<= x 40.0)
(/ (+ 1.0 (exp (* eps x))) 2.0)
(if (or (<= x 1.32e+46) (and (not (<= x 6.5e+88)) (<= x 1.6e+168)))
(/ (+ (/ (+ 1.0 x) (exp x)) (* (+ 1.0 x) (exp (- x)))) 2.0)
(/ (+ 1.0 (exp (* x (+ eps -1.0)))) 2.0)))))
double code(double x, double eps) {
double tmp;
if (x <= -4e-299) {
tmp = (1.0 + exp((x * (-1.0 - eps)))) / 2.0;
} else if (x <= 40.0) {
tmp = (1.0 + exp((eps * x))) / 2.0;
} else if ((x <= 1.32e+46) || (!(x <= 6.5e+88) && (x <= 1.6e+168))) {
tmp = (((1.0 + x) / exp(x)) + ((1.0 + x) * exp(-x))) / 2.0;
} else {
tmp = (1.0 + exp((x * (eps + -1.0)))) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= (-4d-299)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps)))) / 2.0d0
else if (x <= 40.0d0) then
tmp = (1.0d0 + exp((eps * x))) / 2.0d0
else if ((x <= 1.32d+46) .or. (.not. (x <= 6.5d+88)) .and. (x <= 1.6d+168)) then
tmp = (((1.0d0 + x) / exp(x)) + ((1.0d0 + x) * exp(-x))) / 2.0d0
else
tmp = (1.0d0 + exp((x * (eps + (-1.0d0))))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -4e-299) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps)))) / 2.0;
} else if (x <= 40.0) {
tmp = (1.0 + Math.exp((eps * x))) / 2.0;
} else if ((x <= 1.32e+46) || (!(x <= 6.5e+88) && (x <= 1.6e+168))) {
tmp = (((1.0 + x) / Math.exp(x)) + ((1.0 + x) * Math.exp(-x))) / 2.0;
} else {
tmp = (1.0 + Math.exp((x * (eps + -1.0)))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -4e-299: tmp = (1.0 + math.exp((x * (-1.0 - eps)))) / 2.0 elif x <= 40.0: tmp = (1.0 + math.exp((eps * x))) / 2.0 elif (x <= 1.32e+46) or (not (x <= 6.5e+88) and (x <= 1.6e+168)): tmp = (((1.0 + x) / math.exp(x)) + ((1.0 + x) * math.exp(-x))) / 2.0 else: tmp = (1.0 + math.exp((x * (eps + -1.0)))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -4e-299) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps)))) / 2.0); elseif (x <= 40.0) tmp = Float64(Float64(1.0 + exp(Float64(eps * x))) / 2.0); elseif ((x <= 1.32e+46) || (!(x <= 6.5e+88) && (x <= 1.6e+168))) tmp = Float64(Float64(Float64(Float64(1.0 + x) / exp(x)) + Float64(Float64(1.0 + x) * exp(Float64(-x)))) / 2.0); else tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps + -1.0)))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -4e-299) tmp = (1.0 + exp((x * (-1.0 - eps)))) / 2.0; elseif (x <= 40.0) tmp = (1.0 + exp((eps * x))) / 2.0; elseif ((x <= 1.32e+46) || (~((x <= 6.5e+88)) && (x <= 1.6e+168))) tmp = (((1.0 + x) / exp(x)) + ((1.0 + x) * exp(-x))) / 2.0; else tmp = (1.0 + exp((x * (eps + -1.0)))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -4e-299], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 40.0], N[(N[(1.0 + N[Exp[N[(eps * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 1.32e+46], And[N[Not[LessEqual[x, 6.5e+88]], $MachinePrecision], LessEqual[x, 1.6e+168]]], N[(N[(N[(N[(1.0 + x), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + x), $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-299}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - \varepsilon\right)}}{2}\\
\mathbf{elif}\;x \leq 40:\\
\;\;\;\;\frac{1 + e^{\varepsilon \cdot x}}{2}\\
\mathbf{elif}\;x \leq 1.32 \cdot 10^{+46} \lor \neg \left(x \leq 6.5 \cdot 10^{+88}\right) \land x \leq 1.6 \cdot 10^{+168}:\\
\;\;\;\;\frac{\frac{1 + x}{e^{x}} + \left(1 + x\right) \cdot e^{-x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(\varepsilon + -1\right)}}{2}\\
\end{array}
\end{array}
if x < -3.99999999999999997e-299Initial program 61.8%
sub-neg61.8%
neg-sub061.8%
associate-+r-61.8%
Simplified61.8%
Taylor expanded in x around 0 42.4%
Taylor expanded in eps around inf 79.7%
mul-1-neg79.7%
exp-prod79.7%
+-commutative79.7%
remove-double-neg79.7%
sub-neg79.7%
neg-mul-179.7%
exp-prod79.7%
mul-1-neg79.7%
*-commutative79.7%
sub-neg79.7%
neg-mul-179.7%
remove-double-neg79.7%
Simplified79.7%
if -3.99999999999999997e-299 < x < 40Initial program 57.9%
sub-neg57.9%
neg-sub057.9%
associate-+r-57.9%
Simplified57.9%
Taylor expanded in x around 0 41.3%
Taylor expanded in eps around inf 83.4%
exp-prod83.4%
*-commutative83.4%
sub-neg83.4%
neg-mul-183.4%
*-commutative83.4%
exp-prod83.4%
+-commutative83.4%
associate-*r*83.4%
neg-mul-183.4%
sub-neg83.4%
*-commutative83.4%
neg-mul-183.4%
Simplified83.4%
Taylor expanded in eps around inf 83.4%
if 40 < x < 1.32e46 or 6.5000000000000002e88 < x < 1.6000000000000001e168Initial program 93.6%
sub-neg93.6%
neg-sub093.6%
associate-+r-93.6%
Simplified93.6%
Taylor expanded in eps around 0 80.3%
neg-mul-180.3%
rec-exp80.3%
*-commutative80.3%
neg-mul-180.3%
rec-exp80.3%
distribute-lft1-in80.3%
rec-exp80.3%
distribute-lft-out80.3%
mul-1-neg80.3%
neg-mul-180.3%
rec-exp80.3%
*-commutative80.3%
neg-mul-180.3%
rec-exp80.3%
distribute-lft1-in80.3%
rec-exp80.3%
Simplified80.3%
exp-neg80.3%
un-div-inv80.3%
Applied egg-rr80.3%
if 1.32e46 < x < 6.5000000000000002e88 or 1.6000000000000001e168 < x Initial program 100.0%
sub-neg100.0%
neg-sub0100.0%
associate-+r-100.0%
Simplified100.0%
Taylor expanded in x around 0 40.7%
Taylor expanded in eps around inf 40.9%
exp-prod40.9%
*-commutative40.9%
sub-neg40.9%
neg-mul-140.9%
*-commutative40.9%
exp-prod40.9%
+-commutative40.9%
associate-*r*40.9%
neg-mul-140.9%
sub-neg40.9%
*-commutative40.9%
neg-mul-140.9%
Simplified40.9%
Final simplification74.7%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ 1.0 (* -0.5 (* x x))))
(t_1 (/ (+ 2.0 (* eps x)) 2.0))
(t_2
(/
(+
2.0
(*
(- -1.0 (/ -1.0 eps))
(/ x (/ (+ eps -1.0) (- 1.0 (* eps eps))))))
2.0)))
(if (<= x -440.0)
(/ (/ (expm1 (- x)) eps) 2.0)
(if (<= x 2.4e-182)
(/ (+ t_0 t_0) 2.0)
(if (<= x 1.2e-114)
t_2
(if (<= x 2.9e-62)
t_1
(if (<= x 1.75e-28)
t_2
(if (<= x 4.2)
t_1
(if (<= x 1e+43)
(/ (/ x (exp x)) 2.0)
(if (or (<= x 2e+77) (not (<= x 5e+169)))
(/ (/ (expm1 x) eps) 2.0)
0.0))))))))))
double code(double x, double eps) {
double t_0 = 1.0 + (-0.5 * (x * x));
double t_1 = (2.0 + (eps * x)) / 2.0;
double t_2 = (2.0 + ((-1.0 - (-1.0 / eps)) * (x / ((eps + -1.0) / (1.0 - (eps * eps)))))) / 2.0;
double tmp;
if (x <= -440.0) {
tmp = (expm1(-x) / eps) / 2.0;
} else if (x <= 2.4e-182) {
tmp = (t_0 + t_0) / 2.0;
} else if (x <= 1.2e-114) {
tmp = t_2;
} else if (x <= 2.9e-62) {
tmp = t_1;
} else if (x <= 1.75e-28) {
tmp = t_2;
} else if (x <= 4.2) {
tmp = t_1;
} else if (x <= 1e+43) {
tmp = (x / exp(x)) / 2.0;
} else if ((x <= 2e+77) || !(x <= 5e+169)) {
tmp = (expm1(x) / eps) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
public static double code(double x, double eps) {
double t_0 = 1.0 + (-0.5 * (x * x));
double t_1 = (2.0 + (eps * x)) / 2.0;
double t_2 = (2.0 + ((-1.0 - (-1.0 / eps)) * (x / ((eps + -1.0) / (1.0 - (eps * eps)))))) / 2.0;
double tmp;
if (x <= -440.0) {
tmp = (Math.expm1(-x) / eps) / 2.0;
} else if (x <= 2.4e-182) {
tmp = (t_0 + t_0) / 2.0;
} else if (x <= 1.2e-114) {
tmp = t_2;
} else if (x <= 2.9e-62) {
tmp = t_1;
} else if (x <= 1.75e-28) {
tmp = t_2;
} else if (x <= 4.2) {
tmp = t_1;
} else if (x <= 1e+43) {
tmp = (x / Math.exp(x)) / 2.0;
} else if ((x <= 2e+77) || !(x <= 5e+169)) {
tmp = (Math.expm1(x) / eps) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): t_0 = 1.0 + (-0.5 * (x * x)) t_1 = (2.0 + (eps * x)) / 2.0 t_2 = (2.0 + ((-1.0 - (-1.0 / eps)) * (x / ((eps + -1.0) / (1.0 - (eps * eps)))))) / 2.0 tmp = 0 if x <= -440.0: tmp = (math.expm1(-x) / eps) / 2.0 elif x <= 2.4e-182: tmp = (t_0 + t_0) / 2.0 elif x <= 1.2e-114: tmp = t_2 elif x <= 2.9e-62: tmp = t_1 elif x <= 1.75e-28: tmp = t_2 elif x <= 4.2: tmp = t_1 elif x <= 1e+43: tmp = (x / math.exp(x)) / 2.0 elif (x <= 2e+77) or not (x <= 5e+169): tmp = (math.expm1(x) / eps) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) t_0 = Float64(1.0 + Float64(-0.5 * Float64(x * x))) t_1 = Float64(Float64(2.0 + Float64(eps * x)) / 2.0) t_2 = Float64(Float64(2.0 + Float64(Float64(-1.0 - Float64(-1.0 / eps)) * Float64(x / Float64(Float64(eps + -1.0) / Float64(1.0 - Float64(eps * eps)))))) / 2.0) tmp = 0.0 if (x <= -440.0) tmp = Float64(Float64(expm1(Float64(-x)) / eps) / 2.0); elseif (x <= 2.4e-182) tmp = Float64(Float64(t_0 + t_0) / 2.0); elseif (x <= 1.2e-114) tmp = t_2; elseif (x <= 2.9e-62) tmp = t_1; elseif (x <= 1.75e-28) tmp = t_2; elseif (x <= 4.2) tmp = t_1; elseif (x <= 1e+43) tmp = Float64(Float64(x / exp(x)) / 2.0); elseif ((x <= 2e+77) || !(x <= 5e+169)) tmp = Float64(Float64(expm1(x) / eps) / 2.0); else tmp = 0.0; end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(1.0 + N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(2.0 + N[(eps * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(2.0 + N[(N[(-1.0 - N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[(x / N[(N[(eps + -1.0), $MachinePrecision] / N[(1.0 - N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, -440.0], N[(N[(N[(Exp[(-x)] - 1), $MachinePrecision] / eps), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.4e-182], N[(N[(t$95$0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.2e-114], t$95$2, If[LessEqual[x, 2.9e-62], t$95$1, If[LessEqual[x, 1.75e-28], t$95$2, If[LessEqual[x, 4.2], t$95$1, If[LessEqual[x, 1e+43], N[(N[(x / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 2e+77], N[Not[LessEqual[x, 5e+169]], $MachinePrecision]], N[(N[(N[(Exp[x] - 1), $MachinePrecision] / eps), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + -0.5 \cdot \left(x \cdot x\right)\\
t_1 := \frac{2 + \varepsilon \cdot x}{2}\\
t_2 := \frac{2 + \left(-1 - \frac{-1}{\varepsilon}\right) \cdot \frac{x}{\frac{\varepsilon + -1}{1 - \varepsilon \cdot \varepsilon}}}{2}\\
\mathbf{if}\;x \leq -440:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(-x\right)}{\varepsilon}}{2}\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{-182}:\\
\;\;\;\;\frac{t_0 + t_0}{2}\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{-114}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{-62}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{-28}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 4.2:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 10^{+43}:\\
\;\;\;\;\frac{\frac{x}{e^{x}}}{2}\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+77} \lor \neg \left(x \leq 5 \cdot 10^{+169}\right):\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(x\right)}{\varepsilon}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -440Initial program 100.0%
sub-neg100.0%
neg-sub0100.0%
associate-+r-100.0%
Simplified100.0%
Taylor expanded in x around 0 53.2%
Taylor expanded in eps around 0 48.3%
expm1-def48.3%
neg-mul-148.3%
Simplified48.3%
if -440 < x < 2.3999999999999998e-182Initial program 47.8%
sub-neg47.8%
neg-sub047.8%
associate-+r-47.8%
Simplified47.8%
Taylor expanded in eps around 0 84.8%
neg-mul-184.8%
rec-exp84.8%
*-commutative84.8%
neg-mul-184.8%
rec-exp84.8%
distribute-lft1-in84.8%
rec-exp84.8%
distribute-lft-out84.8%
mul-1-neg84.8%
neg-mul-184.8%
rec-exp84.8%
*-commutative84.8%
neg-mul-184.8%
rec-exp84.8%
distribute-lft1-in84.8%
rec-exp84.8%
Simplified84.8%
Taylor expanded in x around 0 84.6%
unpow284.6%
Simplified84.6%
Taylor expanded in x around 0 84.6%
unpow284.6%
Simplified84.6%
if 2.3999999999999998e-182 < x < 1.2000000000000001e-114 or 2.89999999999999986e-62 < x < 1.75e-28Initial program 76.9%
sub-neg76.9%
neg-sub076.9%
associate-+r-76.9%
Simplified76.9%
Taylor expanded in x around 0 49.1%
Taylor expanded in x around 0 26.0%
*-commutative26.0%
flip-+57.7%
associate-*r/57.7%
metadata-eval57.7%
add-sqr-sqrt48.4%
sqrt-unprod24.6%
sqr-neg24.6%
sqrt-unprod33.4%
add-sqr-sqrt47.8%
neg-sub047.8%
metadata-eval47.8%
associate--r-47.8%
metadata-eval47.8%
metadata-eval47.8%
Applied egg-rr47.8%
associate-/l*47.8%
+-commutative47.8%
Simplified47.8%
if 1.2000000000000001e-114 < x < 2.89999999999999986e-62 or 1.75e-28 < x < 4.20000000000000018Initial program 56.4%
sub-neg56.4%
neg-sub056.4%
associate-+r-56.4%
Simplified56.4%
Taylor expanded in x around 0 32.2%
Taylor expanded in eps around inf 75.8%
exp-prod75.8%
*-commutative75.8%
sub-neg75.8%
neg-mul-175.8%
*-commutative75.8%
exp-prod75.8%
+-commutative75.8%
associate-*r*75.8%
neg-mul-175.8%
sub-neg75.8%
*-commutative75.8%
neg-mul-175.8%
Simplified75.8%
Taylor expanded in eps around inf 75.8%
Taylor expanded in eps around 0 65.5%
if 4.20000000000000018 < x < 1.00000000000000001e43Initial program 86.2%
sub-neg86.2%
neg-sub086.2%
associate-+r-86.2%
Simplified86.2%
Taylor expanded in eps around 0 71.9%
neg-mul-171.9%
rec-exp71.9%
*-commutative71.9%
neg-mul-171.9%
rec-exp71.9%
distribute-lft1-in71.9%
rec-exp71.9%
distribute-lft-out71.9%
mul-1-neg71.9%
neg-mul-171.9%
rec-exp71.9%
*-commutative71.9%
neg-mul-171.9%
rec-exp71.9%
distribute-lft1-in71.9%
rec-exp71.9%
Simplified71.9%
Taylor expanded in x around 0 3.9%
Taylor expanded in x around inf 60.3%
exp-neg60.3%
associate-*l/60.3%
*-lft-identity60.3%
Simplified60.3%
if 1.00000000000000001e43 < x < 1.99999999999999997e77 or 5.00000000000000017e169 < x Initial program 100.0%
sub-neg100.0%
neg-sub0100.0%
associate-+r-100.0%
Simplified100.0%
Taylor expanded in x around 0 42.7%
Taylor expanded in eps around 0 1.8%
expm1-def1.8%
neg-mul-11.8%
Simplified1.8%
expm1-log1p-u1.5%
expm1-udef1.5%
add-sqr-sqrt0.0%
sqrt-unprod41.2%
sqr-neg41.2%
sqrt-unprod41.2%
add-sqr-sqrt41.2%
Applied egg-rr41.2%
expm1-def41.2%
expm1-log1p41.5%
Simplified41.5%
if 1.99999999999999997e77 < x < 5.00000000000000017e169Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 83.6%
rec-exp83.6%
div-sub83.6%
rec-exp83.6%
neg-mul-183.6%
rec-exp83.6%
neg-mul-183.6%
+-inverses83.6%
Simplified83.6%
Final simplification68.0%
(FPCore (x eps)
:precision binary64
(let* ((t_0
(/
(+
2.0
(*
(- -1.0 (/ -1.0 eps))
(/ x (/ (+ eps -1.0) (- 1.0 (* eps eps))))))
2.0)))
(if (<= x 3.6e-185)
(/ (- 2.0 (* eps x)) 2.0)
(if (<= x 2.8e-114)
t_0
(if (<= x 1.32e-62)
(/ (+ 2.0 (* eps x)) 2.0)
(if (<= x 9.5e-25)
t_0
(if (<= x 1e+46)
(/ (/ x (exp x)) 2.0)
(if (or (<= x 3e+77) (not (<= x 1.65e+168)))
(/ (/ (expm1 x) eps) 2.0)
0.0))))))))
double code(double x, double eps) {
double t_0 = (2.0 + ((-1.0 - (-1.0 / eps)) * (x / ((eps + -1.0) / (1.0 - (eps * eps)))))) / 2.0;
double tmp;
if (x <= 3.6e-185) {
tmp = (2.0 - (eps * x)) / 2.0;
} else if (x <= 2.8e-114) {
tmp = t_0;
} else if (x <= 1.32e-62) {
tmp = (2.0 + (eps * x)) / 2.0;
} else if (x <= 9.5e-25) {
tmp = t_0;
} else if (x <= 1e+46) {
tmp = (x / exp(x)) / 2.0;
} else if ((x <= 3e+77) || !(x <= 1.65e+168)) {
tmp = (expm1(x) / eps) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
public static double code(double x, double eps) {
double t_0 = (2.0 + ((-1.0 - (-1.0 / eps)) * (x / ((eps + -1.0) / (1.0 - (eps * eps)))))) / 2.0;
double tmp;
if (x <= 3.6e-185) {
tmp = (2.0 - (eps * x)) / 2.0;
} else if (x <= 2.8e-114) {
tmp = t_0;
} else if (x <= 1.32e-62) {
tmp = (2.0 + (eps * x)) / 2.0;
} else if (x <= 9.5e-25) {
tmp = t_0;
} else if (x <= 1e+46) {
tmp = (x / Math.exp(x)) / 2.0;
} else if ((x <= 3e+77) || !(x <= 1.65e+168)) {
tmp = (Math.expm1(x) / eps) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): t_0 = (2.0 + ((-1.0 - (-1.0 / eps)) * (x / ((eps + -1.0) / (1.0 - (eps * eps)))))) / 2.0 tmp = 0 if x <= 3.6e-185: tmp = (2.0 - (eps * x)) / 2.0 elif x <= 2.8e-114: tmp = t_0 elif x <= 1.32e-62: tmp = (2.0 + (eps * x)) / 2.0 elif x <= 9.5e-25: tmp = t_0 elif x <= 1e+46: tmp = (x / math.exp(x)) / 2.0 elif (x <= 3e+77) or not (x <= 1.65e+168): tmp = (math.expm1(x) / eps) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) t_0 = Float64(Float64(2.0 + Float64(Float64(-1.0 - Float64(-1.0 / eps)) * Float64(x / Float64(Float64(eps + -1.0) / Float64(1.0 - Float64(eps * eps)))))) / 2.0) tmp = 0.0 if (x <= 3.6e-185) tmp = Float64(Float64(2.0 - Float64(eps * x)) / 2.0); elseif (x <= 2.8e-114) tmp = t_0; elseif (x <= 1.32e-62) tmp = Float64(Float64(2.0 + Float64(eps * x)) / 2.0); elseif (x <= 9.5e-25) tmp = t_0; elseif (x <= 1e+46) tmp = Float64(Float64(x / exp(x)) / 2.0); elseif ((x <= 3e+77) || !(x <= 1.65e+168)) tmp = Float64(Float64(expm1(x) / eps) / 2.0); else tmp = 0.0; end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[(2.0 + N[(N[(-1.0 - N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[(x / N[(N[(eps + -1.0), $MachinePrecision] / N[(1.0 - N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, 3.6e-185], N[(N[(2.0 - N[(eps * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.8e-114], t$95$0, If[LessEqual[x, 1.32e-62], N[(N[(2.0 + N[(eps * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 9.5e-25], t$95$0, If[LessEqual[x, 1e+46], N[(N[(x / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 3e+77], N[Not[LessEqual[x, 1.65e+168]], $MachinePrecision]], N[(N[(N[(Exp[x] - 1), $MachinePrecision] / eps), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2 + \left(-1 - \frac{-1}{\varepsilon}\right) \cdot \frac{x}{\frac{\varepsilon + -1}{1 - \varepsilon \cdot \varepsilon}}}{2}\\
\mathbf{if}\;x \leq 3.6 \cdot 10^{-185}:\\
\;\;\;\;\frac{2 - \varepsilon \cdot x}{2}\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-114}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.32 \cdot 10^{-62}:\\
\;\;\;\;\frac{2 + \varepsilon \cdot x}{2}\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-25}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 10^{+46}:\\
\;\;\;\;\frac{\frac{x}{e^{x}}}{2}\\
\mathbf{elif}\;x \leq 3 \cdot 10^{+77} \lor \neg \left(x \leq 1.65 \cdot 10^{+168}\right):\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(x\right)}{\varepsilon}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 3.5999999999999998e-185Initial program 58.3%
sub-neg58.3%
neg-sub058.3%
associate-+r-58.3%
Simplified58.3%
Taylor expanded in x around 0 43.0%
Taylor expanded in x around 0 49.3%
Taylor expanded in eps around inf 73.4%
mul-1-neg73.4%
distribute-lft-neg-out73.4%
*-commutative73.4%
Simplified73.4%
if 3.5999999999999998e-185 < x < 2.8000000000000001e-114 or 1.31999999999999997e-62 < x < 9.50000000000000065e-25Initial program 76.9%
sub-neg76.9%
neg-sub076.9%
associate-+r-76.9%
Simplified76.9%
Taylor expanded in x around 0 49.1%
Taylor expanded in x around 0 26.0%
*-commutative26.0%
flip-+57.7%
associate-*r/57.7%
metadata-eval57.7%
add-sqr-sqrt48.4%
sqrt-unprod24.6%
sqr-neg24.6%
sqrt-unprod33.4%
add-sqr-sqrt47.8%
neg-sub047.8%
metadata-eval47.8%
associate--r-47.8%
metadata-eval47.8%
metadata-eval47.8%
Applied egg-rr47.8%
associate-/l*47.8%
+-commutative47.8%
Simplified47.8%
if 2.8000000000000001e-114 < x < 1.31999999999999997e-62Initial program 54.4%
sub-neg54.4%
neg-sub054.4%
associate-+r-54.4%
Simplified54.4%
Taylor expanded in x around 0 31.6%
Taylor expanded in eps around inf 77.2%
exp-prod77.2%
*-commutative77.2%
sub-neg77.2%
neg-mul-177.2%
*-commutative77.2%
exp-prod77.2%
+-commutative77.2%
associate-*r*77.2%
neg-mul-177.2%
sub-neg77.2%
*-commutative77.2%
neg-mul-177.2%
Simplified77.2%
Taylor expanded in eps around inf 77.2%
Taylor expanded in eps around 0 70.9%
if 9.50000000000000065e-25 < x < 9.9999999999999999e45Initial program 82.9%
sub-neg82.9%
neg-sub082.9%
associate-+r-82.9%
Simplified82.9%
Taylor expanded in eps around 0 65.4%
neg-mul-165.4%
rec-exp65.4%
*-commutative65.4%
neg-mul-165.4%
rec-exp65.4%
distribute-lft1-in65.4%
rec-exp65.4%
distribute-lft-out65.4%
mul-1-neg65.4%
neg-mul-165.4%
rec-exp65.4%
*-commutative65.4%
neg-mul-165.4%
rec-exp65.4%
distribute-lft1-in65.4%
rec-exp65.4%
Simplified65.4%
Taylor expanded in x around 0 9.4%
Taylor expanded in x around inf 50.5%
exp-neg50.5%
associate-*l/50.5%
*-lft-identity50.5%
Simplified50.5%
if 9.9999999999999999e45 < x < 2.9999999999999998e77 or 1.6499999999999999e168 < x Initial program 100.0%
sub-neg100.0%
neg-sub0100.0%
associate-+r-100.0%
Simplified100.0%
Taylor expanded in x around 0 42.7%
Taylor expanded in eps around 0 1.8%
expm1-def1.8%
neg-mul-11.8%
Simplified1.8%
expm1-log1p-u1.5%
expm1-udef1.5%
add-sqr-sqrt0.0%
sqrt-unprod41.2%
sqr-neg41.2%
sqrt-unprod41.2%
add-sqr-sqrt41.2%
Applied egg-rr41.2%
expm1-def41.2%
expm1-log1p41.5%
Simplified41.5%
if 2.9999999999999998e77 < x < 1.6499999999999999e168Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 83.6%
rec-exp83.6%
div-sub83.6%
rec-exp83.6%
neg-mul-183.6%
rec-exp83.6%
neg-mul-183.6%
+-inverses83.6%
Simplified83.6%
Final simplification65.5%
(FPCore (x eps)
:precision binary64
(if (<= x -4e-299)
(/ (+ 1.0 (exp (- x (* eps x)))) 2.0)
(if (or (<= x 5e+14)
(not (or (<= x 3e+46) (and (not (<= x 1.4e+90)) (<= x 1e+168)))))
(/ (+ 1.0 (exp (* x (+ eps -1.0)))) 2.0)
0.0)))
double code(double x, double eps) {
double tmp;
if (x <= -4e-299) {
tmp = (1.0 + exp((x - (eps * x)))) / 2.0;
} else if ((x <= 5e+14) || !((x <= 3e+46) || (!(x <= 1.4e+90) && (x <= 1e+168)))) {
tmp = (1.0 + exp((x * (eps + -1.0)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= (-4d-299)) then
tmp = (1.0d0 + exp((x - (eps * x)))) / 2.0d0
else if ((x <= 5d+14) .or. (.not. (x <= 3d+46) .or. (.not. (x <= 1.4d+90)) .and. (x <= 1d+168))) then
tmp = (1.0d0 + exp((x * (eps + (-1.0d0))))) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -4e-299) {
tmp = (1.0 + Math.exp((x - (eps * x)))) / 2.0;
} else if ((x <= 5e+14) || !((x <= 3e+46) || (!(x <= 1.4e+90) && (x <= 1e+168)))) {
tmp = (1.0 + Math.exp((x * (eps + -1.0)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -4e-299: tmp = (1.0 + math.exp((x - (eps * x)))) / 2.0 elif (x <= 5e+14) or not ((x <= 3e+46) or (not (x <= 1.4e+90) and (x <= 1e+168))): tmp = (1.0 + math.exp((x * (eps + -1.0)))) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -4e-299) tmp = Float64(Float64(1.0 + exp(Float64(x - Float64(eps * x)))) / 2.0); elseif ((x <= 5e+14) || !((x <= 3e+46) || (!(x <= 1.4e+90) && (x <= 1e+168)))) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps + -1.0)))) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -4e-299) tmp = (1.0 + exp((x - (eps * x)))) / 2.0; elseif ((x <= 5e+14) || ~(((x <= 3e+46) || (~((x <= 1.4e+90)) && (x <= 1e+168))))) tmp = (1.0 + exp((x * (eps + -1.0)))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -4e-299], N[(N[(1.0 + N[Exp[N[(x - N[(eps * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 5e+14], N[Not[Or[LessEqual[x, 3e+46], And[N[Not[LessEqual[x, 1.4e+90]], $MachinePrecision], LessEqual[x, 1e+168]]]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-299}:\\
\;\;\;\;\frac{1 + e^{x - \varepsilon \cdot x}}{2}\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+14} \lor \neg \left(x \leq 3 \cdot 10^{+46} \lor \neg \left(x \leq 1.4 \cdot 10^{+90}\right) \land x \leq 10^{+168}\right):\\
\;\;\;\;\frac{1 + e^{x \cdot \left(\varepsilon + -1\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -3.99999999999999997e-299Initial program 61.8%
sub-neg61.8%
neg-sub061.8%
associate-+r-61.8%
Simplified61.8%
Taylor expanded in x around 0 39.0%
Taylor expanded in eps around inf 76.2%
exp-prod76.2%
*-commutative76.2%
sub-neg76.2%
neg-mul-176.2%
*-commutative76.2%
exp-prod76.2%
+-commutative76.2%
associate-*r*76.2%
neg-mul-176.2%
sub-neg76.2%
*-commutative76.2%
neg-mul-176.2%
Simplified76.2%
add-sqr-sqrt9.0%
sqrt-unprod54.9%
sqr-neg54.9%
sqrt-unprod48.5%
add-sqr-sqrt79.7%
sub-neg79.7%
distribute-lft-in79.7%
*-rgt-identity79.7%
Applied egg-rr79.7%
distribute-rgt-neg-out79.7%
unsub-neg79.7%
*-commutative79.7%
Simplified79.7%
if -3.99999999999999997e-299 < x < 5e14 or 3.00000000000000023e46 < x < 1.4e90 or 9.9999999999999993e167 < x Initial program 72.2%
sub-neg72.2%
neg-sub072.2%
associate-+r-72.2%
Simplified72.2%
Taylor expanded in x around 0 41.1%
Taylor expanded in eps around inf 67.5%
exp-prod67.5%
*-commutative67.5%
sub-neg67.5%
neg-mul-167.5%
*-commutative67.5%
exp-prod67.5%
+-commutative67.5%
associate-*r*67.5%
neg-mul-167.5%
sub-neg67.5%
*-commutative67.5%
neg-mul-167.5%
Simplified67.5%
if 5e14 < x < 3.00000000000000023e46 or 1.4e90 < x < 9.9999999999999993e167Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 84.3%
rec-exp84.3%
div-sub84.3%
rec-exp84.3%
neg-mul-184.3%
rec-exp84.3%
neg-mul-184.3%
+-inverses84.3%
Simplified84.3%
Final simplification74.3%
(FPCore (x eps)
:precision binary64
(if (<= x -4e-299)
(/ (+ 1.0 (exp (* x (- -1.0 eps)))) 2.0)
(if (or (<= x 48000000000000.0)
(and (not (<= x 1.02e+43))
(or (<= x 2.7e+90) (not (<= x 1.05e+168)))))
(/ (+ 1.0 (exp (* x (+ eps -1.0)))) 2.0)
0.0)))
double code(double x, double eps) {
double tmp;
if (x <= -4e-299) {
tmp = (1.0 + exp((x * (-1.0 - eps)))) / 2.0;
} else if ((x <= 48000000000000.0) || (!(x <= 1.02e+43) && ((x <= 2.7e+90) || !(x <= 1.05e+168)))) {
tmp = (1.0 + exp((x * (eps + -1.0)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= (-4d-299)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps)))) / 2.0d0
else if ((x <= 48000000000000.0d0) .or. (.not. (x <= 1.02d+43)) .and. (x <= 2.7d+90) .or. (.not. (x <= 1.05d+168))) then
tmp = (1.0d0 + exp((x * (eps + (-1.0d0))))) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -4e-299) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps)))) / 2.0;
} else if ((x <= 48000000000000.0) || (!(x <= 1.02e+43) && ((x <= 2.7e+90) || !(x <= 1.05e+168)))) {
tmp = (1.0 + Math.exp((x * (eps + -1.0)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -4e-299: tmp = (1.0 + math.exp((x * (-1.0 - eps)))) / 2.0 elif (x <= 48000000000000.0) or (not (x <= 1.02e+43) and ((x <= 2.7e+90) or not (x <= 1.05e+168))): tmp = (1.0 + math.exp((x * (eps + -1.0)))) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -4e-299) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps)))) / 2.0); elseif ((x <= 48000000000000.0) || (!(x <= 1.02e+43) && ((x <= 2.7e+90) || !(x <= 1.05e+168)))) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps + -1.0)))) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -4e-299) tmp = (1.0 + exp((x * (-1.0 - eps)))) / 2.0; elseif ((x <= 48000000000000.0) || (~((x <= 1.02e+43)) && ((x <= 2.7e+90) || ~((x <= 1.05e+168))))) tmp = (1.0 + exp((x * (eps + -1.0)))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -4e-299], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 48000000000000.0], And[N[Not[LessEqual[x, 1.02e+43]], $MachinePrecision], Or[LessEqual[x, 2.7e+90], N[Not[LessEqual[x, 1.05e+168]], $MachinePrecision]]]], N[(N[(1.0 + N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-299}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - \varepsilon\right)}}{2}\\
\mathbf{elif}\;x \leq 48000000000000 \lor \neg \left(x \leq 1.02 \cdot 10^{+43}\right) \land \left(x \leq 2.7 \cdot 10^{+90} \lor \neg \left(x \leq 1.05 \cdot 10^{+168}\right)\right):\\
\;\;\;\;\frac{1 + e^{x \cdot \left(\varepsilon + -1\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -3.99999999999999997e-299Initial program 61.8%
sub-neg61.8%
neg-sub061.8%
associate-+r-61.8%
Simplified61.8%
Taylor expanded in x around 0 42.4%
Taylor expanded in eps around inf 79.7%
mul-1-neg79.7%
exp-prod79.7%
+-commutative79.7%
remove-double-neg79.7%
sub-neg79.7%
neg-mul-179.7%
exp-prod79.7%
mul-1-neg79.7%
*-commutative79.7%
sub-neg79.7%
neg-mul-179.7%
remove-double-neg79.7%
Simplified79.7%
if -3.99999999999999997e-299 < x < 4.8e13 or 1.02e43 < x < 2.7e90 or 1.05000000000000001e168 < x Initial program 72.2%
sub-neg72.2%
neg-sub072.2%
associate-+r-72.2%
Simplified72.2%
Taylor expanded in x around 0 41.1%
Taylor expanded in eps around inf 67.5%
exp-prod67.5%
*-commutative67.5%
sub-neg67.5%
neg-mul-167.5%
*-commutative67.5%
exp-prod67.5%
+-commutative67.5%
associate-*r*67.5%
neg-mul-167.5%
sub-neg67.5%
*-commutative67.5%
neg-mul-167.5%
Simplified67.5%
if 4.8e13 < x < 1.02e43 or 2.7e90 < x < 1.05000000000000001e168Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 84.3%
rec-exp84.3%
div-sub84.3%
rec-exp84.3%
neg-mul-184.3%
rec-exp84.3%
neg-mul-184.3%
+-inverses84.3%
Simplified84.3%
Final simplification74.3%
(FPCore (x eps)
:precision binary64
(if (<= x -350.0)
(/ (/ (expm1 (- x)) eps) 2.0)
(if (or (<= x 350000000000.0)
(and (not (<= x 1.02e+43)) (or (<= x 1.1e+91) (not (<= x 1e+168)))))
(/ (+ 1.0 (exp (* eps x))) 2.0)
0.0)))
double code(double x, double eps) {
double tmp;
if (x <= -350.0) {
tmp = (expm1(-x) / eps) / 2.0;
} else if ((x <= 350000000000.0) || (!(x <= 1.02e+43) && ((x <= 1.1e+91) || !(x <= 1e+168)))) {
tmp = (1.0 + exp((eps * x))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
public static double code(double x, double eps) {
double tmp;
if (x <= -350.0) {
tmp = (Math.expm1(-x) / eps) / 2.0;
} else if ((x <= 350000000000.0) || (!(x <= 1.02e+43) && ((x <= 1.1e+91) || !(x <= 1e+168)))) {
tmp = (1.0 + Math.exp((eps * x))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -350.0: tmp = (math.expm1(-x) / eps) / 2.0 elif (x <= 350000000000.0) or (not (x <= 1.02e+43) and ((x <= 1.1e+91) or not (x <= 1e+168))): tmp = (1.0 + math.exp((eps * x))) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -350.0) tmp = Float64(Float64(expm1(Float64(-x)) / eps) / 2.0); elseif ((x <= 350000000000.0) || (!(x <= 1.02e+43) && ((x <= 1.1e+91) || !(x <= 1e+168)))) tmp = Float64(Float64(1.0 + exp(Float64(eps * x))) / 2.0); else tmp = 0.0; end return tmp end
code[x_, eps_] := If[LessEqual[x, -350.0], N[(N[(N[(Exp[(-x)] - 1), $MachinePrecision] / eps), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 350000000000.0], And[N[Not[LessEqual[x, 1.02e+43]], $MachinePrecision], Or[LessEqual[x, 1.1e+91], N[Not[LessEqual[x, 1e+168]], $MachinePrecision]]]], N[(N[(1.0 + N[Exp[N[(eps * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -350:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(-x\right)}{\varepsilon}}{2}\\
\mathbf{elif}\;x \leq 350000000000 \lor \neg \left(x \leq 1.02 \cdot 10^{+43}\right) \land \left(x \leq 1.1 \cdot 10^{+91} \lor \neg \left(x \leq 10^{+168}\right)\right):\\
\;\;\;\;\frac{1 + e^{\varepsilon \cdot x}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -350Initial program 100.0%
sub-neg100.0%
neg-sub0100.0%
associate-+r-100.0%
Simplified100.0%
Taylor expanded in x around 0 53.2%
Taylor expanded in eps around 0 48.3%
expm1-def48.3%
neg-mul-148.3%
Simplified48.3%
if -350 < x < 3.5e11 or 1.02e43 < x < 1.1e91 or 9.9999999999999993e167 < x Initial program 62.6%
sub-neg62.6%
neg-sub062.6%
associate-+r-62.6%
Simplified62.6%
Taylor expanded in x around 0 38.2%
Taylor expanded in eps around inf 74.2%
exp-prod74.2%
*-commutative74.2%
sub-neg74.2%
neg-mul-174.2%
*-commutative74.2%
exp-prod74.2%
+-commutative74.2%
associate-*r*74.2%
neg-mul-174.2%
sub-neg74.2%
*-commutative74.2%
neg-mul-174.2%
Simplified74.2%
Taylor expanded in eps around inf 74.5%
if 3.5e11 < x < 1.02e43 or 1.1e91 < x < 9.9999999999999993e167Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 84.3%
rec-exp84.3%
div-sub84.3%
rec-exp84.3%
neg-mul-184.3%
rec-exp84.3%
neg-mul-184.3%
+-inverses84.3%
Simplified84.3%
Final simplification72.5%
(FPCore (x eps)
:precision binary64
(if (<= x -4e-299)
(/ (+ 1.0 (exp (- x (* eps x)))) 2.0)
(if (or (<= x 2.6e+14)
(and (not (<= x 6e+45)) (or (<= x 1.05e+91) (not (<= x 2.9e+168)))))
(/ (+ 1.0 (exp (* eps x))) 2.0)
0.0)))
double code(double x, double eps) {
double tmp;
if (x <= -4e-299) {
tmp = (1.0 + exp((x - (eps * x)))) / 2.0;
} else if ((x <= 2.6e+14) || (!(x <= 6e+45) && ((x <= 1.05e+91) || !(x <= 2.9e+168)))) {
tmp = (1.0 + exp((eps * x))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= (-4d-299)) then
tmp = (1.0d0 + exp((x - (eps * x)))) / 2.0d0
else if ((x <= 2.6d+14) .or. (.not. (x <= 6d+45)) .and. (x <= 1.05d+91) .or. (.not. (x <= 2.9d+168))) then
tmp = (1.0d0 + exp((eps * x))) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -4e-299) {
tmp = (1.0 + Math.exp((x - (eps * x)))) / 2.0;
} else if ((x <= 2.6e+14) || (!(x <= 6e+45) && ((x <= 1.05e+91) || !(x <= 2.9e+168)))) {
tmp = (1.0 + Math.exp((eps * x))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -4e-299: tmp = (1.0 + math.exp((x - (eps * x)))) / 2.0 elif (x <= 2.6e+14) or (not (x <= 6e+45) and ((x <= 1.05e+91) or not (x <= 2.9e+168))): tmp = (1.0 + math.exp((eps * x))) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -4e-299) tmp = Float64(Float64(1.0 + exp(Float64(x - Float64(eps * x)))) / 2.0); elseif ((x <= 2.6e+14) || (!(x <= 6e+45) && ((x <= 1.05e+91) || !(x <= 2.9e+168)))) tmp = Float64(Float64(1.0 + exp(Float64(eps * x))) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -4e-299) tmp = (1.0 + exp((x - (eps * x)))) / 2.0; elseif ((x <= 2.6e+14) || (~((x <= 6e+45)) && ((x <= 1.05e+91) || ~((x <= 2.9e+168))))) tmp = (1.0 + exp((eps * x))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -4e-299], N[(N[(1.0 + N[Exp[N[(x - N[(eps * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 2.6e+14], And[N[Not[LessEqual[x, 6e+45]], $MachinePrecision], Or[LessEqual[x, 1.05e+91], N[Not[LessEqual[x, 2.9e+168]], $MachinePrecision]]]], N[(N[(1.0 + N[Exp[N[(eps * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-299}:\\
\;\;\;\;\frac{1 + e^{x - \varepsilon \cdot x}}{2}\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+14} \lor \neg \left(x \leq 6 \cdot 10^{+45}\right) \land \left(x \leq 1.05 \cdot 10^{+91} \lor \neg \left(x \leq 2.9 \cdot 10^{+168}\right)\right):\\
\;\;\;\;\frac{1 + e^{\varepsilon \cdot x}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -3.99999999999999997e-299Initial program 61.8%
sub-neg61.8%
neg-sub061.8%
associate-+r-61.8%
Simplified61.8%
Taylor expanded in x around 0 39.0%
Taylor expanded in eps around inf 76.2%
exp-prod76.2%
*-commutative76.2%
sub-neg76.2%
neg-mul-176.2%
*-commutative76.2%
exp-prod76.2%
+-commutative76.2%
associate-*r*76.2%
neg-mul-176.2%
sub-neg76.2%
*-commutative76.2%
neg-mul-176.2%
Simplified76.2%
add-sqr-sqrt9.0%
sqrt-unprod54.9%
sqr-neg54.9%
sqrt-unprod48.5%
add-sqr-sqrt79.7%
sub-neg79.7%
distribute-lft-in79.7%
*-rgt-identity79.7%
Applied egg-rr79.7%
distribute-rgt-neg-out79.7%
unsub-neg79.7%
*-commutative79.7%
Simplified79.7%
if -3.99999999999999997e-299 < x < 2.6e14 or 6.00000000000000021e45 < x < 1.05000000000000004e91 or 2.9e168 < x Initial program 72.2%
sub-neg72.2%
neg-sub072.2%
associate-+r-72.2%
Simplified72.2%
Taylor expanded in x around 0 41.1%
Taylor expanded in eps around inf 67.5%
exp-prod67.5%
*-commutative67.5%
sub-neg67.5%
neg-mul-167.5%
*-commutative67.5%
exp-prod67.5%
+-commutative67.5%
associate-*r*67.5%
neg-mul-167.5%
sub-neg67.5%
*-commutative67.5%
neg-mul-167.5%
Simplified67.5%
Taylor expanded in eps around inf 67.5%
if 2.6e14 < x < 6.00000000000000021e45 or 1.05000000000000004e91 < x < 2.9e168Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 84.3%
rec-exp84.3%
div-sub84.3%
rec-exp84.3%
neg-mul-184.3%
rec-exp84.3%
neg-mul-184.3%
+-inverses84.3%
Simplified84.3%
Final simplification74.3%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- -1.0 (/ -1.0 eps)))
(t_1 (- 1.0 (* eps eps)))
(t_2 (/ (+ 2.0 (* t_0 (/ x (/ (+ eps -1.0) t_1)))) 2.0)))
(if (<= x 1.06e-184)
(/ (- 2.0 (* eps x)) 2.0)
(if (<= x 5.4e-111)
t_2
(if (<= x 7.2e-59)
(/ (+ 2.0 (* eps x)) 2.0)
(if (<= x 9.5e-25)
t_2
(if (<= x 8.5e+169)
(/ (/ x (exp x)) 2.0)
(/ (+ 2.0 (* t_0 (/ (* x t_1) (+ eps -1.0)))) 2.0))))))))
double code(double x, double eps) {
double t_0 = -1.0 - (-1.0 / eps);
double t_1 = 1.0 - (eps * eps);
double t_2 = (2.0 + (t_0 * (x / ((eps + -1.0) / t_1)))) / 2.0;
double tmp;
if (x <= 1.06e-184) {
tmp = (2.0 - (eps * x)) / 2.0;
} else if (x <= 5.4e-111) {
tmp = t_2;
} else if (x <= 7.2e-59) {
tmp = (2.0 + (eps * x)) / 2.0;
} else if (x <= 9.5e-25) {
tmp = t_2;
} else if (x <= 8.5e+169) {
tmp = (x / exp(x)) / 2.0;
} else {
tmp = (2.0 + (t_0 * ((x * t_1) / (eps + -1.0)))) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (-1.0d0) - ((-1.0d0) / eps)
t_1 = 1.0d0 - (eps * eps)
t_2 = (2.0d0 + (t_0 * (x / ((eps + (-1.0d0)) / t_1)))) / 2.0d0
if (x <= 1.06d-184) then
tmp = (2.0d0 - (eps * x)) / 2.0d0
else if (x <= 5.4d-111) then
tmp = t_2
else if (x <= 7.2d-59) then
tmp = (2.0d0 + (eps * x)) / 2.0d0
else if (x <= 9.5d-25) then
tmp = t_2
else if (x <= 8.5d+169) then
tmp = (x / exp(x)) / 2.0d0
else
tmp = (2.0d0 + (t_0 * ((x * t_1) / (eps + (-1.0d0))))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = -1.0 - (-1.0 / eps);
double t_1 = 1.0 - (eps * eps);
double t_2 = (2.0 + (t_0 * (x / ((eps + -1.0) / t_1)))) / 2.0;
double tmp;
if (x <= 1.06e-184) {
tmp = (2.0 - (eps * x)) / 2.0;
} else if (x <= 5.4e-111) {
tmp = t_2;
} else if (x <= 7.2e-59) {
tmp = (2.0 + (eps * x)) / 2.0;
} else if (x <= 9.5e-25) {
tmp = t_2;
} else if (x <= 8.5e+169) {
tmp = (x / Math.exp(x)) / 2.0;
} else {
tmp = (2.0 + (t_0 * ((x * t_1) / (eps + -1.0)))) / 2.0;
}
return tmp;
}
def code(x, eps): t_0 = -1.0 - (-1.0 / eps) t_1 = 1.0 - (eps * eps) t_2 = (2.0 + (t_0 * (x / ((eps + -1.0) / t_1)))) / 2.0 tmp = 0 if x <= 1.06e-184: tmp = (2.0 - (eps * x)) / 2.0 elif x <= 5.4e-111: tmp = t_2 elif x <= 7.2e-59: tmp = (2.0 + (eps * x)) / 2.0 elif x <= 9.5e-25: tmp = t_2 elif x <= 8.5e+169: tmp = (x / math.exp(x)) / 2.0 else: tmp = (2.0 + (t_0 * ((x * t_1) / (eps + -1.0)))) / 2.0 return tmp
function code(x, eps) t_0 = Float64(-1.0 - Float64(-1.0 / eps)) t_1 = Float64(1.0 - Float64(eps * eps)) t_2 = Float64(Float64(2.0 + Float64(t_0 * Float64(x / Float64(Float64(eps + -1.0) / t_1)))) / 2.0) tmp = 0.0 if (x <= 1.06e-184) tmp = Float64(Float64(2.0 - Float64(eps * x)) / 2.0); elseif (x <= 5.4e-111) tmp = t_2; elseif (x <= 7.2e-59) tmp = Float64(Float64(2.0 + Float64(eps * x)) / 2.0); elseif (x <= 9.5e-25) tmp = t_2; elseif (x <= 8.5e+169) tmp = Float64(Float64(x / exp(x)) / 2.0); else tmp = Float64(Float64(2.0 + Float64(t_0 * Float64(Float64(x * t_1) / Float64(eps + -1.0)))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) t_0 = -1.0 - (-1.0 / eps); t_1 = 1.0 - (eps * eps); t_2 = (2.0 + (t_0 * (x / ((eps + -1.0) / t_1)))) / 2.0; tmp = 0.0; if (x <= 1.06e-184) tmp = (2.0 - (eps * x)) / 2.0; elseif (x <= 5.4e-111) tmp = t_2; elseif (x <= 7.2e-59) tmp = (2.0 + (eps * x)) / 2.0; elseif (x <= 9.5e-25) tmp = t_2; elseif (x <= 8.5e+169) tmp = (x / exp(x)) / 2.0; else tmp = (2.0 + (t_0 * ((x * t_1) / (eps + -1.0)))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(-1.0 - N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(eps * eps), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(2.0 + N[(t$95$0 * N[(x / N[(N[(eps + -1.0), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, 1.06e-184], N[(N[(2.0 - N[(eps * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5.4e-111], t$95$2, If[LessEqual[x, 7.2e-59], N[(N[(2.0 + N[(eps * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 9.5e-25], t$95$2, If[LessEqual[x, 8.5e+169], N[(N[(x / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(t$95$0 * N[(N[(x * t$95$1), $MachinePrecision] / N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -1 - \frac{-1}{\varepsilon}\\
t_1 := 1 - \varepsilon \cdot \varepsilon\\
t_2 := \frac{2 + t_0 \cdot \frac{x}{\frac{\varepsilon + -1}{t_1}}}{2}\\
\mathbf{if}\;x \leq 1.06 \cdot 10^{-184}:\\
\;\;\;\;\frac{2 - \varepsilon \cdot x}{2}\\
\mathbf{elif}\;x \leq 5.4 \cdot 10^{-111}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{-59}:\\
\;\;\;\;\frac{2 + \varepsilon \cdot x}{2}\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-25}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{+169}:\\
\;\;\;\;\frac{\frac{x}{e^{x}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + t_0 \cdot \frac{x \cdot t_1}{\varepsilon + -1}}{2}\\
\end{array}
\end{array}
if x < 1.05999999999999995e-184Initial program 58.3%
sub-neg58.3%
neg-sub058.3%
associate-+r-58.3%
Simplified58.3%
Taylor expanded in x around 0 43.0%
Taylor expanded in x around 0 49.3%
Taylor expanded in eps around inf 73.4%
mul-1-neg73.4%
distribute-lft-neg-out73.4%
*-commutative73.4%
Simplified73.4%
if 1.05999999999999995e-184 < x < 5.39999999999999977e-111 or 7.20000000000000001e-59 < x < 9.50000000000000065e-25Initial program 76.9%
sub-neg76.9%
neg-sub076.9%
associate-+r-76.9%
Simplified76.9%
Taylor expanded in x around 0 49.1%
Taylor expanded in x around 0 26.0%
*-commutative26.0%
flip-+57.7%
associate-*r/57.7%
metadata-eval57.7%
add-sqr-sqrt48.4%
sqrt-unprod24.6%
sqr-neg24.6%
sqrt-unprod33.4%
add-sqr-sqrt47.8%
neg-sub047.8%
metadata-eval47.8%
associate--r-47.8%
metadata-eval47.8%
metadata-eval47.8%
Applied egg-rr47.8%
associate-/l*47.8%
+-commutative47.8%
Simplified47.8%
if 5.39999999999999977e-111 < x < 7.20000000000000001e-59Initial program 54.4%
sub-neg54.4%
neg-sub054.4%
associate-+r-54.4%
Simplified54.4%
Taylor expanded in x around 0 31.6%
Taylor expanded in eps around inf 77.2%
exp-prod77.2%
*-commutative77.2%
sub-neg77.2%
neg-mul-177.2%
*-commutative77.2%
exp-prod77.2%
+-commutative77.2%
associate-*r*77.2%
neg-mul-177.2%
sub-neg77.2%
*-commutative77.2%
neg-mul-177.2%
Simplified77.2%
Taylor expanded in eps around inf 77.2%
Taylor expanded in eps around 0 70.9%
if 9.50000000000000065e-25 < x < 8.5000000000000004e169Initial program 93.8%
sub-neg93.8%
neg-sub093.8%
associate-+r-93.8%
Simplified93.8%
Taylor expanded in eps around 0 62.4%
neg-mul-162.4%
rec-exp62.4%
*-commutative62.4%
neg-mul-162.4%
rec-exp62.4%
distribute-lft1-in62.4%
rec-exp62.4%
distribute-lft-out62.4%
mul-1-neg62.4%
neg-mul-162.4%
rec-exp62.4%
*-commutative62.4%
neg-mul-162.4%
rec-exp62.4%
distribute-lft1-in62.4%
rec-exp62.4%
Simplified62.4%
Taylor expanded in x around 0 5.4%
Taylor expanded in x around inf 57.0%
exp-neg57.0%
associate-*l/57.0%
*-lft-identity57.0%
Simplified57.0%
if 8.5000000000000004e169 < x Initial program 100.0%
sub-neg100.0%
neg-sub0100.0%
associate-+r-100.0%
Simplified100.0%
Taylor expanded in x around 0 24.4%
Taylor expanded in x around 0 19.4%
flip-+19.4%
associate-*l/22.8%
metadata-eval22.8%
add-sqr-sqrt22.8%
sqrt-unprod31.0%
sqr-neg31.0%
sqrt-unprod34.2%
add-sqr-sqrt34.7%
neg-sub034.7%
metadata-eval34.7%
associate--r-34.7%
metadata-eval34.7%
metadata-eval34.7%
Applied egg-rr34.7%
Final simplification64.0%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- -1.0 (/ -1.0 eps)))
(t_1 (- 1.0 (* eps eps)))
(t_2 (/ (+ 2.0 (* t_0 (/ x (/ (+ eps -1.0) t_1)))) 2.0)))
(if (<= x 1.25e-183)
(/ (- 2.0 (* eps x)) 2.0)
(if (<= x 1.35e-114)
t_2
(if (<= x 6e-66)
(/ (+ 2.0 (* eps x)) 2.0)
(if (<= x 45.0)
t_2
(if (<= x 3.9e+170)
0.0
(/ (+ 2.0 (* t_0 (/ (* x t_1) (+ eps -1.0)))) 2.0))))))))
double code(double x, double eps) {
double t_0 = -1.0 - (-1.0 / eps);
double t_1 = 1.0 - (eps * eps);
double t_2 = (2.0 + (t_0 * (x / ((eps + -1.0) / t_1)))) / 2.0;
double tmp;
if (x <= 1.25e-183) {
tmp = (2.0 - (eps * x)) / 2.0;
} else if (x <= 1.35e-114) {
tmp = t_2;
} else if (x <= 6e-66) {
tmp = (2.0 + (eps * x)) / 2.0;
} else if (x <= 45.0) {
tmp = t_2;
} else if (x <= 3.9e+170) {
tmp = 0.0;
} else {
tmp = (2.0 + (t_0 * ((x * t_1) / (eps + -1.0)))) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (-1.0d0) - ((-1.0d0) / eps)
t_1 = 1.0d0 - (eps * eps)
t_2 = (2.0d0 + (t_0 * (x / ((eps + (-1.0d0)) / t_1)))) / 2.0d0
if (x <= 1.25d-183) then
tmp = (2.0d0 - (eps * x)) / 2.0d0
else if (x <= 1.35d-114) then
tmp = t_2
else if (x <= 6d-66) then
tmp = (2.0d0 + (eps * x)) / 2.0d0
else if (x <= 45.0d0) then
tmp = t_2
else if (x <= 3.9d+170) then
tmp = 0.0d0
else
tmp = (2.0d0 + (t_0 * ((x * t_1) / (eps + (-1.0d0))))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = -1.0 - (-1.0 / eps);
double t_1 = 1.0 - (eps * eps);
double t_2 = (2.0 + (t_0 * (x / ((eps + -1.0) / t_1)))) / 2.0;
double tmp;
if (x <= 1.25e-183) {
tmp = (2.0 - (eps * x)) / 2.0;
} else if (x <= 1.35e-114) {
tmp = t_2;
} else if (x <= 6e-66) {
tmp = (2.0 + (eps * x)) / 2.0;
} else if (x <= 45.0) {
tmp = t_2;
} else if (x <= 3.9e+170) {
tmp = 0.0;
} else {
tmp = (2.0 + (t_0 * ((x * t_1) / (eps + -1.0)))) / 2.0;
}
return tmp;
}
def code(x, eps): t_0 = -1.0 - (-1.0 / eps) t_1 = 1.0 - (eps * eps) t_2 = (2.0 + (t_0 * (x / ((eps + -1.0) / t_1)))) / 2.0 tmp = 0 if x <= 1.25e-183: tmp = (2.0 - (eps * x)) / 2.0 elif x <= 1.35e-114: tmp = t_2 elif x <= 6e-66: tmp = (2.0 + (eps * x)) / 2.0 elif x <= 45.0: tmp = t_2 elif x <= 3.9e+170: tmp = 0.0 else: tmp = (2.0 + (t_0 * ((x * t_1) / (eps + -1.0)))) / 2.0 return tmp
function code(x, eps) t_0 = Float64(-1.0 - Float64(-1.0 / eps)) t_1 = Float64(1.0 - Float64(eps * eps)) t_2 = Float64(Float64(2.0 + Float64(t_0 * Float64(x / Float64(Float64(eps + -1.0) / t_1)))) / 2.0) tmp = 0.0 if (x <= 1.25e-183) tmp = Float64(Float64(2.0 - Float64(eps * x)) / 2.0); elseif (x <= 1.35e-114) tmp = t_2; elseif (x <= 6e-66) tmp = Float64(Float64(2.0 + Float64(eps * x)) / 2.0); elseif (x <= 45.0) tmp = t_2; elseif (x <= 3.9e+170) tmp = 0.0; else tmp = Float64(Float64(2.0 + Float64(t_0 * Float64(Float64(x * t_1) / Float64(eps + -1.0)))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) t_0 = -1.0 - (-1.0 / eps); t_1 = 1.0 - (eps * eps); t_2 = (2.0 + (t_0 * (x / ((eps + -1.0) / t_1)))) / 2.0; tmp = 0.0; if (x <= 1.25e-183) tmp = (2.0 - (eps * x)) / 2.0; elseif (x <= 1.35e-114) tmp = t_2; elseif (x <= 6e-66) tmp = (2.0 + (eps * x)) / 2.0; elseif (x <= 45.0) tmp = t_2; elseif (x <= 3.9e+170) tmp = 0.0; else tmp = (2.0 + (t_0 * ((x * t_1) / (eps + -1.0)))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(-1.0 - N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(eps * eps), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(2.0 + N[(t$95$0 * N[(x / N[(N[(eps + -1.0), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, 1.25e-183], N[(N[(2.0 - N[(eps * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.35e-114], t$95$2, If[LessEqual[x, 6e-66], N[(N[(2.0 + N[(eps * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 45.0], t$95$2, If[LessEqual[x, 3.9e+170], 0.0, N[(N[(2.0 + N[(t$95$0 * N[(N[(x * t$95$1), $MachinePrecision] / N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -1 - \frac{-1}{\varepsilon}\\
t_1 := 1 - \varepsilon \cdot \varepsilon\\
t_2 := \frac{2 + t_0 \cdot \frac{x}{\frac{\varepsilon + -1}{t_1}}}{2}\\
\mathbf{if}\;x \leq 1.25 \cdot 10^{-183}:\\
\;\;\;\;\frac{2 - \varepsilon \cdot x}{2}\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{-114}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 6 \cdot 10^{-66}:\\
\;\;\;\;\frac{2 + \varepsilon \cdot x}{2}\\
\mathbf{elif}\;x \leq 45:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 3.9 \cdot 10^{+170}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + t_0 \cdot \frac{x \cdot t_1}{\varepsilon + -1}}{2}\\
\end{array}
\end{array}
if x < 1.2500000000000001e-183Initial program 58.3%
sub-neg58.3%
neg-sub058.3%
associate-+r-58.3%
Simplified58.3%
Taylor expanded in x around 0 43.0%
Taylor expanded in x around 0 49.3%
Taylor expanded in eps around inf 73.4%
mul-1-neg73.4%
distribute-lft-neg-out73.4%
*-commutative73.4%
Simplified73.4%
if 1.2500000000000001e-183 < x < 1.35e-114 or 6.0000000000000004e-66 < x < 45Initial program 75.8%
sub-neg75.8%
neg-sub075.8%
associate-+r-75.8%
Simplified75.8%
Taylor expanded in x around 0 47.4%
Taylor expanded in x around 0 23.2%
*-commutative23.2%
flip-+50.9%
associate-*r/50.9%
metadata-eval50.9%
add-sqr-sqrt42.7%
sqrt-unprod22.0%
sqr-neg22.0%
sqrt-unprod29.4%
add-sqr-sqrt42.1%
neg-sub042.1%
metadata-eval42.1%
associate--r-42.1%
metadata-eval42.1%
metadata-eval42.1%
Applied egg-rr42.1%
associate-/l*42.1%
+-commutative42.1%
Simplified42.1%
if 1.35e-114 < x < 6.0000000000000004e-66Initial program 54.4%
sub-neg54.4%
neg-sub054.4%
associate-+r-54.4%
Simplified54.4%
Taylor expanded in x around 0 31.6%
Taylor expanded in eps around inf 77.2%
exp-prod77.2%
*-commutative77.2%
sub-neg77.2%
neg-mul-177.2%
*-commutative77.2%
exp-prod77.2%
+-commutative77.2%
associate-*r*77.2%
neg-mul-177.2%
sub-neg77.2%
*-commutative77.2%
neg-mul-177.2%
Simplified77.2%
Taylor expanded in eps around inf 77.2%
Taylor expanded in eps around 0 70.9%
if 45 < x < 3.9000000000000002e170Initial program 95.6%
Simplified95.6%
Taylor expanded in eps around 0 59.8%
rec-exp59.8%
div-sub59.8%
rec-exp59.8%
neg-mul-159.8%
rec-exp59.8%
neg-mul-159.8%
+-inverses59.8%
Simplified59.8%
if 3.9000000000000002e170 < x Initial program 100.0%
sub-neg100.0%
neg-sub0100.0%
associate-+r-100.0%
Simplified100.0%
Taylor expanded in x around 0 24.4%
Taylor expanded in x around 0 19.4%
flip-+19.4%
associate-*l/22.8%
metadata-eval22.8%
add-sqr-sqrt22.8%
sqrt-unprod31.0%
sqr-neg31.0%
sqrt-unprod34.2%
add-sqr-sqrt34.7%
neg-sub034.7%
metadata-eval34.7%
associate--r-34.7%
metadata-eval34.7%
metadata-eval34.7%
Applied egg-rr34.7%
Final simplification63.9%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (/ (+ 2.0 (* eps x)) 2.0))
(t_1
(/
(+
2.0
(*
(- -1.0 (/ -1.0 eps))
(/ x (/ (+ eps -1.0) (- 1.0 (* eps eps))))))
2.0)))
(if (<= x 1.55e-179)
(/ (- 2.0 (* eps x)) 2.0)
(if (<= x 9.5e-114)
t_1
(if (<= x 5e-62)
t_0
(if (<= x 31.5) t_1 (if (<= x 7.2e+170) 0.0 t_0)))))))
double code(double x, double eps) {
double t_0 = (2.0 + (eps * x)) / 2.0;
double t_1 = (2.0 + ((-1.0 - (-1.0 / eps)) * (x / ((eps + -1.0) / (1.0 - (eps * eps)))))) / 2.0;
double tmp;
if (x <= 1.55e-179) {
tmp = (2.0 - (eps * x)) / 2.0;
} else if (x <= 9.5e-114) {
tmp = t_1;
} else if (x <= 5e-62) {
tmp = t_0;
} else if (x <= 31.5) {
tmp = t_1;
} else if (x <= 7.2e+170) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (2.0d0 + (eps * x)) / 2.0d0
t_1 = (2.0d0 + (((-1.0d0) - ((-1.0d0) / eps)) * (x / ((eps + (-1.0d0)) / (1.0d0 - (eps * eps)))))) / 2.0d0
if (x <= 1.55d-179) then
tmp = (2.0d0 - (eps * x)) / 2.0d0
else if (x <= 9.5d-114) then
tmp = t_1
else if (x <= 5d-62) then
tmp = t_0
else if (x <= 31.5d0) then
tmp = t_1
else if (x <= 7.2d+170) then
tmp = 0.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = (2.0 + (eps * x)) / 2.0;
double t_1 = (2.0 + ((-1.0 - (-1.0 / eps)) * (x / ((eps + -1.0) / (1.0 - (eps * eps)))))) / 2.0;
double tmp;
if (x <= 1.55e-179) {
tmp = (2.0 - (eps * x)) / 2.0;
} else if (x <= 9.5e-114) {
tmp = t_1;
} else if (x <= 5e-62) {
tmp = t_0;
} else if (x <= 31.5) {
tmp = t_1;
} else if (x <= 7.2e+170) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, eps): t_0 = (2.0 + (eps * x)) / 2.0 t_1 = (2.0 + ((-1.0 - (-1.0 / eps)) * (x / ((eps + -1.0) / (1.0 - (eps * eps)))))) / 2.0 tmp = 0 if x <= 1.55e-179: tmp = (2.0 - (eps * x)) / 2.0 elif x <= 9.5e-114: tmp = t_1 elif x <= 5e-62: tmp = t_0 elif x <= 31.5: tmp = t_1 elif x <= 7.2e+170: tmp = 0.0 else: tmp = t_0 return tmp
function code(x, eps) t_0 = Float64(Float64(2.0 + Float64(eps * x)) / 2.0) t_1 = Float64(Float64(2.0 + Float64(Float64(-1.0 - Float64(-1.0 / eps)) * Float64(x / Float64(Float64(eps + -1.0) / Float64(1.0 - Float64(eps * eps)))))) / 2.0) tmp = 0.0 if (x <= 1.55e-179) tmp = Float64(Float64(2.0 - Float64(eps * x)) / 2.0); elseif (x <= 9.5e-114) tmp = t_1; elseif (x <= 5e-62) tmp = t_0; elseif (x <= 31.5) tmp = t_1; elseif (x <= 7.2e+170) tmp = 0.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, eps) t_0 = (2.0 + (eps * x)) / 2.0; t_1 = (2.0 + ((-1.0 - (-1.0 / eps)) * (x / ((eps + -1.0) / (1.0 - (eps * eps)))))) / 2.0; tmp = 0.0; if (x <= 1.55e-179) tmp = (2.0 - (eps * x)) / 2.0; elseif (x <= 9.5e-114) tmp = t_1; elseif (x <= 5e-62) tmp = t_0; elseif (x <= 31.5) tmp = t_1; elseif (x <= 7.2e+170) tmp = 0.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[(2.0 + N[(eps * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(2.0 + N[(N[(-1.0 - N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[(x / N[(N[(eps + -1.0), $MachinePrecision] / N[(1.0 - N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, 1.55e-179], N[(N[(2.0 - N[(eps * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 9.5e-114], t$95$1, If[LessEqual[x, 5e-62], t$95$0, If[LessEqual[x, 31.5], t$95$1, If[LessEqual[x, 7.2e+170], 0.0, t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2 + \varepsilon \cdot x}{2}\\
t_1 := \frac{2 + \left(-1 - \frac{-1}{\varepsilon}\right) \cdot \frac{x}{\frac{\varepsilon + -1}{1 - \varepsilon \cdot \varepsilon}}}{2}\\
\mathbf{if}\;x \leq 1.55 \cdot 10^{-179}:\\
\;\;\;\;\frac{2 - \varepsilon \cdot x}{2}\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-114}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-62}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 31.5:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{+170}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < 1.5500000000000001e-179Initial program 58.3%
sub-neg58.3%
neg-sub058.3%
associate-+r-58.3%
Simplified58.3%
Taylor expanded in x around 0 43.0%
Taylor expanded in x around 0 49.3%
Taylor expanded in eps around inf 73.4%
mul-1-neg73.4%
distribute-lft-neg-out73.4%
*-commutative73.4%
Simplified73.4%
if 1.5500000000000001e-179 < x < 9.49999999999999958e-114 or 5.0000000000000002e-62 < x < 31.5Initial program 75.8%
sub-neg75.8%
neg-sub075.8%
associate-+r-75.8%
Simplified75.8%
Taylor expanded in x around 0 47.4%
Taylor expanded in x around 0 23.2%
*-commutative23.2%
flip-+50.9%
associate-*r/50.9%
metadata-eval50.9%
add-sqr-sqrt42.7%
sqrt-unprod22.0%
sqr-neg22.0%
sqrt-unprod29.4%
add-sqr-sqrt42.1%
neg-sub042.1%
metadata-eval42.1%
associate--r-42.1%
metadata-eval42.1%
metadata-eval42.1%
Applied egg-rr42.1%
associate-/l*42.1%
+-commutative42.1%
Simplified42.1%
if 9.49999999999999958e-114 < x < 5.0000000000000002e-62 or 7.1999999999999999e170 < x Initial program 82.4%
sub-neg82.4%
neg-sub082.4%
associate-+r-82.4%
Simplified82.4%
Taylor expanded in x around 0 40.4%
Taylor expanded in eps around inf 58.2%
exp-prod58.2%
*-commutative58.2%
sub-neg58.2%
neg-mul-158.2%
*-commutative58.2%
exp-prod58.2%
+-commutative58.2%
associate-*r*58.2%
neg-mul-158.2%
sub-neg58.2%
*-commutative58.2%
neg-mul-158.2%
Simplified58.2%
Taylor expanded in eps around inf 58.1%
Taylor expanded in eps around 0 46.9%
if 31.5 < x < 7.1999999999999999e170Initial program 95.6%
Simplified95.6%
Taylor expanded in eps around 0 59.8%
rec-exp59.8%
div-sub59.8%
rec-exp59.8%
neg-mul-159.8%
rec-exp59.8%
neg-mul-159.8%
+-inverses59.8%
Simplified59.8%
Final simplification63.5%
(FPCore (x eps) :precision binary64 (if (<= x 2.0) (/ (- 2.0 x) 2.0) (if (<= x 9.6e+170) 0.0 (/ (+ 2.0 (* eps x)) 2.0))))
double code(double x, double eps) {
double tmp;
if (x <= 2.0) {
tmp = (2.0 - x) / 2.0;
} else if (x <= 9.6e+170) {
tmp = 0.0;
} else {
tmp = (2.0 + (eps * x)) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 2.0d0) then
tmp = (2.0d0 - x) / 2.0d0
else if (x <= 9.6d+170) then
tmp = 0.0d0
else
tmp = (2.0d0 + (eps * x)) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 2.0) {
tmp = (2.0 - x) / 2.0;
} else if (x <= 9.6e+170) {
tmp = 0.0;
} else {
tmp = (2.0 + (eps * x)) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 2.0: tmp = (2.0 - x) / 2.0 elif x <= 9.6e+170: tmp = 0.0 else: tmp = (2.0 + (eps * x)) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 2.0) tmp = Float64(Float64(2.0 - x) / 2.0); elseif (x <= 9.6e+170) tmp = 0.0; else tmp = Float64(Float64(2.0 + Float64(eps * x)) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 2.0) tmp = (2.0 - x) / 2.0; elseif (x <= 9.6e+170) tmp = 0.0; else tmp = (2.0 + (eps * x)) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 2.0], N[(N[(2.0 - x), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 9.6e+170], 0.0, N[(N[(2.0 + N[(eps * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2:\\
\;\;\;\;\frac{2 - x}{2}\\
\mathbf{elif}\;x \leq 9.6 \cdot 10^{+170}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \varepsilon \cdot x}{2}\\
\end{array}
\end{array}
if x < 2Initial program 60.2%
sub-neg60.2%
neg-sub060.2%
associate-+r-60.2%
Simplified60.2%
Taylor expanded in x around 0 39.9%
Taylor expanded in eps around inf 79.2%
exp-prod79.2%
*-commutative79.2%
sub-neg79.2%
neg-mul-179.2%
*-commutative79.2%
exp-prod79.2%
+-commutative79.2%
associate-*r*79.2%
neg-mul-179.2%
sub-neg79.2%
*-commutative79.2%
neg-mul-179.2%
Simplified79.2%
Taylor expanded in x around 0 67.2%
Taylor expanded in eps around 0 64.3%
neg-mul-164.3%
Simplified64.3%
if 2 < x < 9.5999999999999999e170Initial program 95.6%
Simplified95.6%
Taylor expanded in eps around 0 59.8%
rec-exp59.8%
div-sub59.8%
rec-exp59.8%
neg-mul-159.8%
rec-exp59.8%
neg-mul-159.8%
+-inverses59.8%
Simplified59.8%
if 9.5999999999999999e170 < x Initial program 100.0%
sub-neg100.0%
neg-sub0100.0%
associate-+r-100.0%
Simplified100.0%
Taylor expanded in x around 0 45.9%
Taylor expanded in eps around inf 46.2%
exp-prod46.2%
*-commutative46.2%
sub-neg46.2%
neg-mul-146.2%
*-commutative46.2%
exp-prod46.2%
+-commutative46.2%
associate-*r*46.2%
neg-mul-146.2%
sub-neg46.2%
*-commutative46.2%
neg-mul-146.2%
Simplified46.2%
Taylor expanded in eps around inf 46.1%
Taylor expanded in eps around 0 31.8%
Final simplification60.1%
(FPCore (x eps) :precision binary64 (if (<= x 230.0) (/ (- 2.0 (* eps x)) 2.0) (if (<= x 4.2e+170) 0.0 (/ (+ 2.0 (* eps x)) 2.0))))
double code(double x, double eps) {
double tmp;
if (x <= 230.0) {
tmp = (2.0 - (eps * x)) / 2.0;
} else if (x <= 4.2e+170) {
tmp = 0.0;
} else {
tmp = (2.0 + (eps * x)) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 230.0d0) then
tmp = (2.0d0 - (eps * x)) / 2.0d0
else if (x <= 4.2d+170) then
tmp = 0.0d0
else
tmp = (2.0d0 + (eps * x)) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 230.0) {
tmp = (2.0 - (eps * x)) / 2.0;
} else if (x <= 4.2e+170) {
tmp = 0.0;
} else {
tmp = (2.0 + (eps * x)) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 230.0: tmp = (2.0 - (eps * x)) / 2.0 elif x <= 4.2e+170: tmp = 0.0 else: tmp = (2.0 + (eps * x)) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 230.0) tmp = Float64(Float64(2.0 - Float64(eps * x)) / 2.0); elseif (x <= 4.2e+170) tmp = 0.0; else tmp = Float64(Float64(2.0 + Float64(eps * x)) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 230.0) tmp = (2.0 - (eps * x)) / 2.0; elseif (x <= 4.2e+170) tmp = 0.0; else tmp = (2.0 + (eps * x)) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 230.0], N[(N[(2.0 - N[(eps * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 4.2e+170], 0.0, N[(N[(2.0 + N[(eps * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 230:\\
\;\;\;\;\frac{2 - \varepsilon \cdot x}{2}\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{+170}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \varepsilon \cdot x}{2}\\
\end{array}
\end{array}
if x < 230Initial program 59.6%
sub-neg59.6%
neg-sub059.6%
associate-+r-59.6%
Simplified59.6%
Taylor expanded in x around 0 43.6%
Taylor expanded in x around 0 43.3%
Taylor expanded in eps around inf 67.6%
mul-1-neg67.6%
distribute-lft-neg-out67.6%
*-commutative67.6%
Simplified67.6%
if 230 < x < 4.19999999999999996e170Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 62.5%
rec-exp62.5%
div-sub62.5%
rec-exp62.5%
neg-mul-162.5%
rec-exp62.5%
neg-mul-162.5%
+-inverses62.5%
Simplified62.5%
if 4.19999999999999996e170 < x Initial program 100.0%
sub-neg100.0%
neg-sub0100.0%
associate-+r-100.0%
Simplified100.0%
Taylor expanded in x around 0 45.9%
Taylor expanded in eps around inf 46.2%
exp-prod46.2%
*-commutative46.2%
sub-neg46.2%
neg-mul-146.2%
*-commutative46.2%
exp-prod46.2%
+-commutative46.2%
associate-*r*46.2%
neg-mul-146.2%
sub-neg46.2%
*-commutative46.2%
neg-mul-146.2%
Simplified46.2%
Taylor expanded in eps around inf 46.1%
Taylor expanded in eps around 0 31.8%
Final simplification63.0%
(FPCore (x eps) :precision binary64 (if (<= x 2.0) (/ (- 2.0 x) 2.0) 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 2.0) {
tmp = (2.0 - x) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 2.0d0) then
tmp = (2.0d0 - x) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 2.0) {
tmp = (2.0 - x) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 2.0: tmp = (2.0 - x) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 2.0) tmp = Float64(Float64(2.0 - x) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 2.0) tmp = (2.0 - x) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 2.0], N[(N[(2.0 - x), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2:\\
\;\;\;\;\frac{2 - x}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2Initial program 60.2%
sub-neg60.2%
neg-sub060.2%
associate-+r-60.2%
Simplified60.2%
Taylor expanded in x around 0 39.9%
Taylor expanded in eps around inf 79.2%
exp-prod79.2%
*-commutative79.2%
sub-neg79.2%
neg-mul-179.2%
*-commutative79.2%
exp-prod79.2%
+-commutative79.2%
associate-*r*79.2%
neg-mul-179.2%
sub-neg79.2%
*-commutative79.2%
neg-mul-179.2%
Simplified79.2%
Taylor expanded in x around 0 67.2%
Taylor expanded in eps around 0 64.3%
neg-mul-164.3%
Simplified64.3%
if 2 < x Initial program 97.3%
Simplified97.3%
Taylor expanded in eps around 0 50.2%
rec-exp50.1%
div-sub50.1%
rec-exp50.2%
neg-mul-150.2%
rec-exp50.1%
neg-mul-150.1%
+-inverses50.1%
Simplified50.1%
Final simplification60.4%
(FPCore (x eps) :precision binary64 (if (<= x 1800.0) 1.0 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 1800.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 1800.0d0) then
tmp = 1.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 1800.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 1800.0: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 1800.0) tmp = 1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 1800.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 1800.0], 1.0, 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1800:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1800Initial program 59.8%
sub-neg59.8%
neg-sub059.8%
associate-+r-59.8%
Simplified59.8%
Taylor expanded in eps around 0 63.9%
neg-mul-163.9%
rec-exp63.9%
*-commutative63.9%
neg-mul-163.9%
rec-exp63.9%
distribute-lft1-in63.9%
rec-exp63.9%
distribute-lft-out63.9%
mul-1-neg63.9%
neg-mul-163.9%
rec-exp63.9%
*-commutative63.9%
neg-mul-163.9%
rec-exp63.9%
distribute-lft1-in64.0%
rec-exp64.0%
Simplified64.0%
Taylor expanded in x around 0 62.8%
unpow262.8%
Simplified62.8%
Taylor expanded in x around 0 63.2%
if 1800 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 52.2%
rec-exp52.2%
div-sub52.2%
rec-exp52.2%
neg-mul-152.2%
rec-exp52.2%
neg-mul-152.2%
+-inverses52.2%
Simplified52.2%
Final simplification60.3%
(FPCore (x eps) :precision binary64 1.0)
double code(double x, double eps) {
return 1.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = 1.0d0
end function
public static double code(double x, double eps) {
return 1.0;
}
def code(x, eps): return 1.0
function code(x, eps) return 1.0 end
function tmp = code(x, eps) tmp = 1.0; end
code[x_, eps_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 70.5%
sub-neg70.5%
neg-sub070.5%
associate-+r-70.5%
Simplified70.5%
Taylor expanded in eps around 0 60.8%
neg-mul-160.8%
rec-exp60.8%
*-commutative60.8%
neg-mul-160.8%
rec-exp60.8%
distribute-lft1-in60.8%
rec-exp60.8%
distribute-lft-out60.8%
mul-1-neg60.8%
neg-mul-160.8%
rec-exp60.8%
*-commutative60.8%
neg-mul-160.8%
rec-exp60.8%
distribute-lft1-in60.8%
rec-exp60.8%
Simplified60.8%
Taylor expanded in x around 0 46.4%
unpow246.4%
Simplified46.4%
Taylor expanded in x around 0 47.2%
Final simplification47.2%
herbie shell --seed 2023274
(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))