
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 20 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (* (+ x 1.0) (exp (- x)))))
(if (<= eps_m 4e-64)
(/ (+ t_0 t_0) 2.0)
(/ (+ (exp (* x (+ -1.0 eps_m))) (exp (* x (- eps_m)))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = (x + 1.0) * exp(-x);
double tmp;
if (eps_m <= 4e-64) {
tmp = (t_0 + t_0) / 2.0;
} else {
tmp = (exp((x * (-1.0 + 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) :: t_0
real(8) :: tmp
t_0 = (x + 1.0d0) * exp(-x)
if (eps_m <= 4d-64) then
tmp = (t_0 + t_0) / 2.0d0
else
tmp = (exp((x * ((-1.0d0) + 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 t_0 = (x + 1.0) * Math.exp(-x);
double tmp;
if (eps_m <= 4e-64) {
tmp = (t_0 + t_0) / 2.0;
} else {
tmp = (Math.exp((x * (-1.0 + eps_m))) + Math.exp((x * -eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = (x + 1.0) * math.exp(-x) tmp = 0 if eps_m <= 4e-64: tmp = (t_0 + t_0) / 2.0 else: tmp = (math.exp((x * (-1.0 + eps_m))) + math.exp((x * -eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(Float64(x + 1.0) * exp(Float64(-x))) tmp = 0.0 if (eps_m <= 4e-64) tmp = Float64(Float64(t_0 + t_0) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(-1.0 + eps_m))) + exp(Float64(x * Float64(-eps_m)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = (x + 1.0) * exp(-x); tmp = 0.0; if (eps_m <= 4e-64) tmp = (t_0 + t_0) / 2.0; else tmp = (exp((x * (-1.0 + eps_m))) + exp((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[(N[(x + 1.0), $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps$95$m, 4e-64], N[(N[(t$95$0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := \left(x + 1\right) \cdot e^{-x}\\
\mathbf{if}\;eps_m \leq 4 \cdot 10^{-64}:\\
\;\;\;\;\frac{t_0 + t_0}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(-1 + eps_m\right)} + e^{x \cdot \left(-eps_m\right)}}{2}\\
\end{array}
\end{array}
if eps < 3.99999999999999986e-64Initial program 55.1%
fma-neg55.2%
/-rgt-identity55.2%
fma-neg55.1%
/-rgt-identity55.1%
distribute-rgt-neg-in55.1%
sub-neg55.1%
metadata-eval55.1%
distribute-rgt-neg-in55.1%
Simplified55.1%
Taylor expanded in eps around 0 76.1%
Simplified76.6%
if 3.99999999999999986e-64 < eps Initial program 94.1%
fma-neg94.1%
/-rgt-identity94.1%
fma-neg94.1%
/-rgt-identity94.1%
distribute-rgt-neg-in94.1%
sub-neg94.1%
metadata-eval94.1%
distribute-rgt-neg-in94.1%
Simplified94.1%
Taylor expanded in eps around inf 99.9%
Taylor expanded in eps around inf 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 99.9%
*-commutative99.9%
sub-neg99.9%
neg-mul-199.9%
*-commutative99.9%
associate-*r*99.9%
neg-mul-199.9%
neg-mul-199.9%
sub-neg99.9%
mul-1-neg99.9%
associate-*r*99.9%
neg-mul-199.9%
Simplified99.9%
Final simplification84.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (pow (exp -1.0) (* x (- 1.0 eps_m))) (exp (* x (- -1.0 eps_m)))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (pow(exp(-1.0), (x * (1.0 - eps_m))) + exp((x * (-1.0 - eps_m)))) / 2.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = ((exp((-1.0d0)) ** (x * (1.0d0 - eps_m))) + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return (Math.pow(Math.exp(-1.0), (x * (1.0 - eps_m))) + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.pow(math.exp(-1.0), (x * (1.0 - eps_m))) + math.exp((x * (-1.0 - eps_m)))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64((exp(-1.0) ^ Float64(x * Float64(1.0 - eps_m))) + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = ((exp(-1.0) ^ (x * (1.0 - eps_m))) + exp((x * (-1.0 - eps_m)))) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(N[Power[N[Exp[-1.0], $MachinePrecision], N[(x * N[(1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\frac{{\left(e^{-1}\right)}^{\left(x \cdot \left(1 - eps_m\right)\right)} + e^{x \cdot \left(-1 - eps_m\right)}}{2}
\end{array}
Initial program 67.8%
fma-neg67.8%
/-rgt-identity67.8%
fma-neg67.8%
/-rgt-identity67.8%
distribute-rgt-neg-in67.8%
sub-neg67.8%
metadata-eval67.8%
distribute-rgt-neg-in67.8%
Simplified67.8%
Taylor expanded in eps around inf 99.2%
exp-prod99.2%
Applied egg-rr99.2%
Final simplification99.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (* x (+ -1.0 eps_m)))) (t_1 (exp (* x (- eps_m)))))
(if (<= x 1.8)
(/ (+ t_1 (exp (* x eps_m))) 2.0)
(if (<= x 8.2e+192)
(/
(+ (* t_0 (+ 1.0 (/ 1.0 eps_m))) (- x (+ (* x eps_m) (+ -1.0 x))))
2.0)
(/ (+ t_0 t_1) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * (-1.0 + eps_m)));
double t_1 = exp((x * -eps_m));
double tmp;
if (x <= 1.8) {
tmp = (t_1 + exp((x * eps_m))) / 2.0;
} else if (x <= 8.2e+192) {
tmp = ((t_0 * (1.0 + (1.0 / eps_m))) + (x - ((x * eps_m) + (-1.0 + x)))) / 2.0;
} else {
tmp = (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 = exp((x * ((-1.0d0) + eps_m)))
t_1 = exp((x * -eps_m))
if (x <= 1.8d0) then
tmp = (t_1 + exp((x * eps_m))) / 2.0d0
else if (x <= 8.2d+192) then
tmp = ((t_0 * (1.0d0 + (1.0d0 / eps_m))) + (x - ((x * eps_m) + ((-1.0d0) + x)))) / 2.0d0
else
tmp = (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 = Math.exp((x * (-1.0 + eps_m)));
double t_1 = Math.exp((x * -eps_m));
double tmp;
if (x <= 1.8) {
tmp = (t_1 + Math.exp((x * eps_m))) / 2.0;
} else if (x <= 8.2e+192) {
tmp = ((t_0 * (1.0 + (1.0 / eps_m))) + (x - ((x * eps_m) + (-1.0 + x)))) / 2.0;
} else {
tmp = (t_0 + t_1) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * (-1.0 + eps_m))) t_1 = math.exp((x * -eps_m)) tmp = 0 if x <= 1.8: tmp = (t_1 + math.exp((x * eps_m))) / 2.0 elif x <= 8.2e+192: tmp = ((t_0 * (1.0 + (1.0 / eps_m))) + (x - ((x * eps_m) + (-1.0 + x)))) / 2.0 else: tmp = (t_0 + t_1) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * Float64(-1.0 + eps_m))) t_1 = exp(Float64(x * Float64(-eps_m))) tmp = 0.0 if (x <= 1.8) tmp = Float64(Float64(t_1 + exp(Float64(x * eps_m))) / 2.0); elseif (x <= 8.2e+192) tmp = Float64(Float64(Float64(t_0 * Float64(1.0 + Float64(1.0 / eps_m))) + Float64(x - Float64(Float64(x * eps_m) + Float64(-1.0 + x)))) / 2.0); else tmp = Float64(Float64(t_0 + t_1) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp((x * (-1.0 + eps_m))); t_1 = exp((x * -eps_m)); tmp = 0.0; if (x <= 1.8) tmp = (t_1 + exp((x * eps_m))) / 2.0; elseif (x <= 8.2e+192) tmp = ((t_0 * (1.0 + (1.0 / eps_m))) + (x - ((x * eps_m) + (-1.0 + x)))) / 2.0; else tmp = (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[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 1.8], N[(N[(t$95$1 + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 8.2e+192], N[(N[(N[(t$95$0 * N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x - N[(N[(x * eps$95$m), $MachinePrecision] + N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(t$95$0 + t$95$1), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(-1 + eps_m\right)}\\
t_1 := e^{x \cdot \left(-eps_m\right)}\\
\mathbf{if}\;x \leq 1.8:\\
\;\;\;\;\frac{t_1 + e^{x \cdot eps_m}}{2}\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{+192}:\\
\;\;\;\;\frac{t_0 \cdot \left(1 + \frac{1}{eps_m}\right) + \left(x - \left(x \cdot eps_m + \left(-1 + x\right)\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0 + t_1}{2}\\
\end{array}
\end{array}
if x < 1.80000000000000004Initial program 56.3%
fma-neg56.4%
/-rgt-identity56.4%
fma-neg56.3%
/-rgt-identity56.3%
distribute-rgt-neg-in56.3%
sub-neg56.3%
metadata-eval56.3%
distribute-rgt-neg-in56.3%
Simplified56.3%
Taylor expanded in eps around inf 98.8%
Taylor expanded in eps around inf 98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in x around inf 98.9%
*-commutative98.9%
sub-neg98.9%
neg-mul-198.9%
*-commutative98.9%
associate-*r*98.9%
neg-mul-198.9%
neg-mul-198.9%
sub-neg98.9%
mul-1-neg98.9%
associate-*r*98.9%
neg-mul-198.9%
Simplified98.9%
Taylor expanded in eps around inf 99.2%
if 1.80000000000000004 < x < 8.20000000000000006e192Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 38.5%
Taylor expanded in eps around inf 91.8%
+-commutative91.8%
neg-mul-191.8%
unsub-neg91.8%
+-commutative91.8%
mul-1-neg91.8%
unsub-neg91.8%
*-commutative91.8%
neg-mul-191.8%
unsub-neg91.8%
Simplified91.8%
if 8.20000000000000006e192 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 85.9%
*-commutative85.9%
Simplified85.9%
Taylor expanded in x around inf 85.9%
*-commutative85.9%
sub-neg85.9%
neg-mul-185.9%
*-commutative85.9%
associate-*r*85.9%
neg-mul-185.9%
neg-mul-185.9%
sub-neg85.9%
mul-1-neg85.9%
associate-*r*85.9%
neg-mul-185.9%
Simplified85.9%
Final simplification96.8%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 4e-64) (/ (+ (* (+ x 1.0) (exp (- x))) (/ (+ x 1.0) (exp x))) 2.0) (/ (+ (exp (* x (+ -1.0 eps_m))) (exp (* x (- eps_m)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 4e-64) {
tmp = (((x + 1.0) * exp(-x)) + ((x + 1.0) / exp(x))) / 2.0;
} else {
tmp = (exp((x * (-1.0 + 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 <= 4d-64) then
tmp = (((x + 1.0d0) * exp(-x)) + ((x + 1.0d0) / exp(x))) / 2.0d0
else
tmp = (exp((x * ((-1.0d0) + 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 <= 4e-64) {
tmp = (((x + 1.0) * Math.exp(-x)) + ((x + 1.0) / Math.exp(x))) / 2.0;
} else {
tmp = (Math.exp((x * (-1.0 + 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 <= 4e-64: tmp = (((x + 1.0) * math.exp(-x)) + ((x + 1.0) / math.exp(x))) / 2.0 else: tmp = (math.exp((x * (-1.0 + 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 <= 4e-64) tmp = Float64(Float64(Float64(Float64(x + 1.0) * exp(Float64(-x))) + Float64(Float64(x + 1.0) / exp(x))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(-1.0 + eps_m))) + exp(Float64(x * Float64(-eps_m)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 4e-64) tmp = (((x + 1.0) * exp(-x)) + ((x + 1.0) / exp(x))) / 2.0; else tmp = (exp((x * (-1.0 + 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, 4e-64], N[(N[(N[(N[(x + 1.0), $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] + N[(N[(x + 1.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps_m \leq 4 \cdot 10^{-64}:\\
\;\;\;\;\frac{\left(x + 1\right) \cdot e^{-x} + \frac{x + 1}{e^{x}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(-1 + eps_m\right)} + e^{x \cdot \left(-eps_m\right)}}{2}\\
\end{array}
\end{array}
if eps < 3.99999999999999986e-64Initial program 55.1%
fma-neg55.2%
/-rgt-identity55.2%
fma-neg55.1%
/-rgt-identity55.1%
distribute-rgt-neg-in55.1%
sub-neg55.1%
metadata-eval55.1%
distribute-rgt-neg-in55.1%
Simplified55.1%
Taylor expanded in eps around 0 76.1%
Simplified76.6%
exp-neg76.6%
un-div-inv76.6%
Applied egg-rr76.6%
if 3.99999999999999986e-64 < eps Initial program 94.1%
fma-neg94.1%
/-rgt-identity94.1%
fma-neg94.1%
/-rgt-identity94.1%
distribute-rgt-neg-in94.1%
sub-neg94.1%
metadata-eval94.1%
distribute-rgt-neg-in94.1%
Simplified94.1%
Taylor expanded in eps around inf 99.9%
Taylor expanded in eps around inf 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 99.9%
*-commutative99.9%
sub-neg99.9%
neg-mul-199.9%
*-commutative99.9%
associate-*r*99.9%
neg-mul-199.9%
neg-mul-199.9%
sub-neg99.9%
mul-1-neg99.9%
associate-*r*99.9%
neg-mul-199.9%
Simplified99.9%
Final simplification84.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 1.8)
(/ (+ (exp (* x (- eps_m))) (exp (* x eps_m))) 2.0)
(/
(+
(* (exp (* x (+ -1.0 eps_m))) (+ 1.0 (/ 1.0 eps_m)))
(- x (+ (* x eps_m) (+ -1.0 x))))
2.0)))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1.8) {
tmp = (exp((x * -eps_m)) + exp((x * eps_m))) / 2.0;
} else {
tmp = ((exp((x * (-1.0 + eps_m))) * (1.0 + (1.0 / eps_m))) + (x - ((x * eps_m) + (-1.0 + x)))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 1.8d0) then
tmp = (exp((x * -eps_m)) + exp((x * eps_m))) / 2.0d0
else
tmp = ((exp((x * ((-1.0d0) + eps_m))) * (1.0d0 + (1.0d0 / eps_m))) + (x - ((x * eps_m) + ((-1.0d0) + x)))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 1.8) {
tmp = (Math.exp((x * -eps_m)) + Math.exp((x * eps_m))) / 2.0;
} else {
tmp = ((Math.exp((x * (-1.0 + eps_m))) * (1.0 + (1.0 / eps_m))) + (x - ((x * eps_m) + (-1.0 + x)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1.8: tmp = (math.exp((x * -eps_m)) + math.exp((x * eps_m))) / 2.0 else: tmp = ((math.exp((x * (-1.0 + eps_m))) * (1.0 + (1.0 / eps_m))) + (x - ((x * eps_m) + (-1.0 + x)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1.8) tmp = Float64(Float64(exp(Float64(x * Float64(-eps_m))) + exp(Float64(x * eps_m))) / 2.0); else tmp = Float64(Float64(Float64(exp(Float64(x * Float64(-1.0 + eps_m))) * Float64(1.0 + Float64(1.0 / eps_m))) + Float64(x - Float64(Float64(x * eps_m) + Float64(-1.0 + x)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 1.8) tmp = (exp((x * -eps_m)) + exp((x * eps_m))) / 2.0; else tmp = ((exp((x * (-1.0 + eps_m))) * (1.0 + (1.0 / eps_m))) + (x - ((x * eps_m) + (-1.0 + x)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 1.8], N[(N[(N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x - N[(N[(x * eps$95$m), $MachinePrecision] + N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.8:\\
\;\;\;\;\frac{e^{x \cdot \left(-eps_m\right)} + e^{x \cdot eps_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(-1 + eps_m\right)} \cdot \left(1 + \frac{1}{eps_m}\right) + \left(x - \left(x \cdot eps_m + \left(-1 + x\right)\right)\right)}{2}\\
\end{array}
\end{array}
if x < 1.80000000000000004Initial program 56.3%
fma-neg56.4%
/-rgt-identity56.4%
fma-neg56.3%
/-rgt-identity56.3%
distribute-rgt-neg-in56.3%
sub-neg56.3%
metadata-eval56.3%
distribute-rgt-neg-in56.3%
Simplified56.3%
Taylor expanded in eps around inf 98.8%
Taylor expanded in eps around inf 98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in x around inf 98.9%
*-commutative98.9%
sub-neg98.9%
neg-mul-198.9%
*-commutative98.9%
associate-*r*98.9%
neg-mul-198.9%
neg-mul-198.9%
sub-neg98.9%
mul-1-neg98.9%
associate-*r*98.9%
neg-mul-198.9%
Simplified98.9%
Taylor expanded in eps around inf 99.2%
if 1.80000000000000004 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 34.4%
Taylor expanded in eps around inf 85.7%
+-commutative85.7%
neg-mul-185.7%
unsub-neg85.7%
+-commutative85.7%
mul-1-neg85.7%
unsub-neg85.7%
*-commutative85.7%
neg-mul-185.7%
unsub-neg85.7%
Simplified85.7%
Final simplification95.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* x (- -1.0 eps_m))) (exp (* x (+ -1.0 eps_m)))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * (-1.0 - eps_m))) + exp((x * (-1.0 + eps_m)))) / 2.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = (exp((x * ((-1.0d0) - eps_m))) + exp((x * ((-1.0d0) + eps_m)))) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return (Math.exp((x * (-1.0 - eps_m))) + Math.exp((x * (-1.0 + eps_m)))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.exp((x * (-1.0 - eps_m))) + math.exp((x * (-1.0 + eps_m)))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(exp(Float64(x * Float64(-1.0 - eps_m))) + exp(Float64(x * Float64(-1.0 + eps_m)))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((x * (-1.0 - eps_m))) + exp((x * (-1.0 + eps_m)))) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\frac{e^{x \cdot \left(-1 - eps_m\right)} + e^{x \cdot \left(-1 + eps_m\right)}}{2}
\end{array}
Initial program 67.8%
fma-neg67.8%
/-rgt-identity67.8%
fma-neg67.8%
/-rgt-identity67.8%
distribute-rgt-neg-in67.8%
sub-neg67.8%
metadata-eval67.8%
distribute-rgt-neg-in67.8%
Simplified67.8%
Taylor expanded in eps around inf 99.2%
Final simplification99.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (* x (+ -1.0 eps_m)))))
(if (<= x -1e-279)
(/ (- (exp (* x (- 1.0 eps_m))) -1.0) 2.0)
(if (<= x 1.8)
(/ (+ (- t_0 (* x eps_m)) (- x (+ -1.0 x))) 2.0)
(/
(+ (* t_0 (+ 1.0 (/ 1.0 eps_m))) (- x (+ (* x eps_m) (+ -1.0 x))))
2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * (-1.0 + eps_m)));
double tmp;
if (x <= -1e-279) {
tmp = (exp((x * (1.0 - eps_m))) - -1.0) / 2.0;
} else if (x <= 1.8) {
tmp = ((t_0 - (x * eps_m)) + (x - (-1.0 + x))) / 2.0;
} else {
tmp = ((t_0 * (1.0 + (1.0 / eps_m))) + (x - ((x * eps_m) + (-1.0 + 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) :: tmp
t_0 = exp((x * ((-1.0d0) + eps_m)))
if (x <= (-1d-279)) then
tmp = (exp((x * (1.0d0 - eps_m))) - (-1.0d0)) / 2.0d0
else if (x <= 1.8d0) then
tmp = ((t_0 - (x * eps_m)) + (x - ((-1.0d0) + x))) / 2.0d0
else
tmp = ((t_0 * (1.0d0 + (1.0d0 / eps_m))) + (x - ((x * eps_m) + ((-1.0d0) + 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 = Math.exp((x * (-1.0 + eps_m)));
double tmp;
if (x <= -1e-279) {
tmp = (Math.exp((x * (1.0 - eps_m))) - -1.0) / 2.0;
} else if (x <= 1.8) {
tmp = ((t_0 - (x * eps_m)) + (x - (-1.0 + x))) / 2.0;
} else {
tmp = ((t_0 * (1.0 + (1.0 / eps_m))) + (x - ((x * eps_m) + (-1.0 + x)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * (-1.0 + eps_m))) tmp = 0 if x <= -1e-279: tmp = (math.exp((x * (1.0 - eps_m))) - -1.0) / 2.0 elif x <= 1.8: tmp = ((t_0 - (x * eps_m)) + (x - (-1.0 + x))) / 2.0 else: tmp = ((t_0 * (1.0 + (1.0 / eps_m))) + (x - ((x * eps_m) + (-1.0 + x)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * Float64(-1.0 + eps_m))) tmp = 0.0 if (x <= -1e-279) tmp = Float64(Float64(exp(Float64(x * Float64(1.0 - eps_m))) - -1.0) / 2.0); elseif (x <= 1.8) tmp = Float64(Float64(Float64(t_0 - Float64(x * eps_m)) + Float64(x - Float64(-1.0 + x))) / 2.0); else tmp = Float64(Float64(Float64(t_0 * Float64(1.0 + Float64(1.0 / eps_m))) + Float64(x - Float64(Float64(x * eps_m) + Float64(-1.0 + x)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp((x * (-1.0 + eps_m))); tmp = 0.0; if (x <= -1e-279) tmp = (exp((x * (1.0 - eps_m))) - -1.0) / 2.0; elseif (x <= 1.8) tmp = ((t_0 - (x * eps_m)) + (x - (-1.0 + x))) / 2.0; else tmp = ((t_0 * (1.0 + (1.0 / eps_m))) + (x - ((x * eps_m) + (-1.0 + x)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -1e-279], N[(N[(N[Exp[N[(x * N[(1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.8], N[(N[(N[(t$95$0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(x - N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(t$95$0 * N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x - N[(N[(x * eps$95$m), $MachinePrecision] + N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(-1 + eps_m\right)}\\
\mathbf{if}\;x \leq -1 \cdot 10^{-279}:\\
\;\;\;\;\frac{e^{x \cdot \left(1 - eps_m\right)} - -1}{2}\\
\mathbf{elif}\;x \leq 1.8:\\
\;\;\;\;\frac{\left(t_0 - x \cdot eps_m\right) + \left(x - \left(-1 + x\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0 \cdot \left(1 + \frac{1}{eps_m}\right) + \left(x - \left(x \cdot eps_m + \left(-1 + x\right)\right)\right)}{2}\\
\end{array}
\end{array}
if x < -1.00000000000000006e-279Initial program 59.8%
fma-neg59.8%
/-rgt-identity59.8%
fma-neg59.8%
/-rgt-identity59.8%
distribute-rgt-neg-in59.8%
sub-neg59.8%
metadata-eval59.8%
distribute-rgt-neg-in59.8%
Simplified59.8%
Taylor expanded in eps around inf 99.0%
exp-prod99.0%
Applied egg-rr99.0%
Taylor expanded in x around 0 71.0%
pow-exp71.0%
add-sqr-sqrt63.3%
sqrt-unprod98.8%
mul-1-neg98.8%
mul-1-neg98.8%
sqr-neg98.8%
sqrt-unprod35.5%
add-sqr-sqrt83.0%
Applied egg-rr83.0%
if -1.00000000000000006e-279 < x < 1.80000000000000004Initial program 52.0%
fma-neg52.1%
/-rgt-identity52.1%
fma-neg52.0%
/-rgt-identity52.0%
distribute-rgt-neg-in52.0%
sub-neg52.0%
metadata-eval52.0%
distribute-rgt-neg-in52.0%
Simplified52.0%
Taylor expanded in x around 0 40.7%
Taylor expanded in eps around inf 87.4%
+-commutative87.4%
associate-*r*87.4%
sub-neg87.4%
neg-mul-187.4%
associate-*r*87.4%
neg-mul-187.4%
distribute-lft-neg-in87.4%
*-commutative87.4%
associate-*r*87.4%
neg-mul-187.4%
sub-neg87.4%
neg-mul-187.4%
distribute-lft-out87.4%
neg-mul-187.4%
Simplified87.4%
if 1.80000000000000004 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 34.4%
Taylor expanded in eps around inf 85.7%
+-commutative85.7%
neg-mul-185.7%
unsub-neg85.7%
+-commutative85.7%
mul-1-neg85.7%
unsub-neg85.7%
*-commutative85.7%
neg-mul-185.7%
unsub-neg85.7%
Simplified85.7%
Final simplification85.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (* x eps_m))))
(if (<= x -8.2e-280)
(/ (- (exp (* x (- 1.0 eps_m))) -1.0) 2.0)
(if (<= x 1.8)
(/ (+ 1.0 t_0) 2.0)
(/ (+ (* t_0 (+ 1.0 (/ 1.0 eps_m))) (- (/ -1.0 eps_m) -1.0)) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * eps_m));
double tmp;
if (x <= -8.2e-280) {
tmp = (exp((x * (1.0 - eps_m))) - -1.0) / 2.0;
} else if (x <= 1.8) {
tmp = (1.0 + t_0) / 2.0;
} else {
tmp = ((t_0 * (1.0 + (1.0 / eps_m))) + ((-1.0 / eps_m) - -1.0)) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: tmp
t_0 = exp((x * eps_m))
if (x <= (-8.2d-280)) then
tmp = (exp((x * (1.0d0 - eps_m))) - (-1.0d0)) / 2.0d0
else if (x <= 1.8d0) then
tmp = (1.0d0 + t_0) / 2.0d0
else
tmp = ((t_0 * (1.0d0 + (1.0d0 / eps_m))) + (((-1.0d0) / eps_m) - (-1.0d0))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = Math.exp((x * eps_m));
double tmp;
if (x <= -8.2e-280) {
tmp = (Math.exp((x * (1.0 - eps_m))) - -1.0) / 2.0;
} else if (x <= 1.8) {
tmp = (1.0 + t_0) / 2.0;
} else {
tmp = ((t_0 * (1.0 + (1.0 / eps_m))) + ((-1.0 / eps_m) - -1.0)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * eps_m)) tmp = 0 if x <= -8.2e-280: tmp = (math.exp((x * (1.0 - eps_m))) - -1.0) / 2.0 elif x <= 1.8: tmp = (1.0 + t_0) / 2.0 else: tmp = ((t_0 * (1.0 + (1.0 / eps_m))) + ((-1.0 / eps_m) - -1.0)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * eps_m)) tmp = 0.0 if (x <= -8.2e-280) tmp = Float64(Float64(exp(Float64(x * Float64(1.0 - eps_m))) - -1.0) / 2.0); elseif (x <= 1.8) tmp = Float64(Float64(1.0 + t_0) / 2.0); else tmp = Float64(Float64(Float64(t_0 * Float64(1.0 + Float64(1.0 / eps_m))) + Float64(Float64(-1.0 / eps_m) - -1.0)) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp((x * eps_m)); tmp = 0.0; if (x <= -8.2e-280) tmp = (exp((x * (1.0 - eps_m))) - -1.0) / 2.0; elseif (x <= 1.8) tmp = (1.0 + t_0) / 2.0; else tmp = ((t_0 * (1.0 + (1.0 / eps_m))) + ((-1.0 / eps_m) - -1.0)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -8.2e-280], N[(N[(N[Exp[N[(x * N[(1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.8], N[(N[(1.0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(t$95$0 * N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 / eps$95$m), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot eps_m}\\
\mathbf{if}\;x \leq -8.2 \cdot 10^{-280}:\\
\;\;\;\;\frac{e^{x \cdot \left(1 - eps_m\right)} - -1}{2}\\
\mathbf{elif}\;x \leq 1.8:\\
\;\;\;\;\frac{1 + t_0}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0 \cdot \left(1 + \frac{1}{eps_m}\right) + \left(\frac{-1}{eps_m} - -1\right)}{2}\\
\end{array}
\end{array}
if x < -8.2000000000000003e-280Initial program 59.8%
fma-neg59.8%
/-rgt-identity59.8%
fma-neg59.8%
/-rgt-identity59.8%
distribute-rgt-neg-in59.8%
sub-neg59.8%
metadata-eval59.8%
distribute-rgt-neg-in59.8%
Simplified59.8%
Taylor expanded in eps around inf 99.0%
exp-prod99.0%
Applied egg-rr99.0%
Taylor expanded in x around 0 71.0%
pow-exp71.0%
add-sqr-sqrt63.3%
sqrt-unprod98.8%
mul-1-neg98.8%
mul-1-neg98.8%
sqr-neg98.8%
sqrt-unprod35.5%
add-sqr-sqrt83.0%
Applied egg-rr83.0%
if -8.2000000000000003e-280 < x < 1.80000000000000004Initial program 52.0%
fma-neg52.1%
/-rgt-identity52.1%
fma-neg52.0%
/-rgt-identity52.0%
distribute-rgt-neg-in52.0%
sub-neg52.0%
metadata-eval52.0%
distribute-rgt-neg-in52.0%
Simplified52.0%
Taylor expanded in x around 0 40.7%
Taylor expanded in eps around inf 40.7%
Taylor expanded in x around 0 39.7%
Taylor expanded in eps around inf 87.1%
if 1.80000000000000004 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 34.4%
Taylor expanded in eps around inf 34.3%
Taylor expanded in x around 0 44.6%
Final simplification74.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -2e-279)
(/ (- (exp (* x (- 1.0 eps_m))) -1.0) 2.0)
(if (<= x 1.8)
(/ (+ (- (exp (* x (+ -1.0 eps_m))) (* x eps_m)) (- x (+ -1.0 x))) 2.0)
(/
(+ (* (exp (* x eps_m)) (+ 1.0 (/ 1.0 eps_m))) (- (/ -1.0 eps_m) -1.0))
2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -2e-279) {
tmp = (exp((x * (1.0 - eps_m))) - -1.0) / 2.0;
} else if (x <= 1.8) {
tmp = ((exp((x * (-1.0 + eps_m))) - (x * eps_m)) + (x - (-1.0 + x))) / 2.0;
} else {
tmp = ((exp((x * eps_m)) * (1.0 + (1.0 / eps_m))) + ((-1.0 / eps_m) - -1.0)) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-2d-279)) then
tmp = (exp((x * (1.0d0 - eps_m))) - (-1.0d0)) / 2.0d0
else if (x <= 1.8d0) then
tmp = ((exp((x * ((-1.0d0) + eps_m))) - (x * eps_m)) + (x - ((-1.0d0) + x))) / 2.0d0
else
tmp = ((exp((x * eps_m)) * (1.0d0 + (1.0d0 / eps_m))) + (((-1.0d0) / eps_m) - (-1.0d0))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -2e-279) {
tmp = (Math.exp((x * (1.0 - eps_m))) - -1.0) / 2.0;
} else if (x <= 1.8) {
tmp = ((Math.exp((x * (-1.0 + eps_m))) - (x * eps_m)) + (x - (-1.0 + x))) / 2.0;
} else {
tmp = ((Math.exp((x * eps_m)) * (1.0 + (1.0 / eps_m))) + ((-1.0 / eps_m) - -1.0)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -2e-279: tmp = (math.exp((x * (1.0 - eps_m))) - -1.0) / 2.0 elif x <= 1.8: tmp = ((math.exp((x * (-1.0 + eps_m))) - (x * eps_m)) + (x - (-1.0 + x))) / 2.0 else: tmp = ((math.exp((x * eps_m)) * (1.0 + (1.0 / eps_m))) + ((-1.0 / eps_m) - -1.0)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -2e-279) tmp = Float64(Float64(exp(Float64(x * Float64(1.0 - eps_m))) - -1.0) / 2.0); elseif (x <= 1.8) tmp = Float64(Float64(Float64(exp(Float64(x * Float64(-1.0 + eps_m))) - Float64(x * eps_m)) + Float64(x - Float64(-1.0 + x))) / 2.0); else tmp = Float64(Float64(Float64(exp(Float64(x * eps_m)) * Float64(1.0 + Float64(1.0 / eps_m))) + Float64(Float64(-1.0 / eps_m) - -1.0)) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -2e-279) tmp = (exp((x * (1.0 - eps_m))) - -1.0) / 2.0; elseif (x <= 1.8) tmp = ((exp((x * (-1.0 + eps_m))) - (x * eps_m)) + (x - (-1.0 + x))) / 2.0; else tmp = ((exp((x * eps_m)) * (1.0 + (1.0 / eps_m))) + ((-1.0 / eps_m) - -1.0)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -2e-279], N[(N[(N[Exp[N[(x * N[(1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.8], N[(N[(N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(x - N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 / eps$95$m), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-279}:\\
\;\;\;\;\frac{e^{x \cdot \left(1 - eps_m\right)} - -1}{2}\\
\mathbf{elif}\;x \leq 1.8:\\
\;\;\;\;\frac{\left(e^{x \cdot \left(-1 + eps_m\right)} - x \cdot eps_m\right) + \left(x - \left(-1 + x\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot eps_m} \cdot \left(1 + \frac{1}{eps_m}\right) + \left(\frac{-1}{eps_m} - -1\right)}{2}\\
\end{array}
\end{array}
if x < -2.00000000000000011e-279Initial program 59.8%
fma-neg59.8%
/-rgt-identity59.8%
fma-neg59.8%
/-rgt-identity59.8%
distribute-rgt-neg-in59.8%
sub-neg59.8%
metadata-eval59.8%
distribute-rgt-neg-in59.8%
Simplified59.8%
Taylor expanded in eps around inf 99.0%
exp-prod99.0%
Applied egg-rr99.0%
Taylor expanded in x around 0 71.0%
pow-exp71.0%
add-sqr-sqrt63.3%
sqrt-unprod98.8%
mul-1-neg98.8%
mul-1-neg98.8%
sqr-neg98.8%
sqrt-unprod35.5%
add-sqr-sqrt83.0%
Applied egg-rr83.0%
if -2.00000000000000011e-279 < x < 1.80000000000000004Initial program 52.0%
fma-neg52.1%
/-rgt-identity52.1%
fma-neg52.0%
/-rgt-identity52.0%
distribute-rgt-neg-in52.0%
sub-neg52.0%
metadata-eval52.0%
distribute-rgt-neg-in52.0%
Simplified52.0%
Taylor expanded in x around 0 40.7%
Taylor expanded in eps around inf 87.4%
+-commutative87.4%
associate-*r*87.4%
sub-neg87.4%
neg-mul-187.4%
associate-*r*87.4%
neg-mul-187.4%
distribute-lft-neg-in87.4%
*-commutative87.4%
associate-*r*87.4%
neg-mul-187.4%
sub-neg87.4%
neg-mul-187.4%
distribute-lft-out87.4%
neg-mul-187.4%
Simplified87.4%
if 1.80000000000000004 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 34.4%
Taylor expanded in eps around inf 34.3%
Taylor expanded in x around 0 44.6%
Final simplification74.4%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (* x (+ -1.0 eps_m))))
(if (<= x -1e-279)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (<= x 1.1e+55)
(/ (+ 1.0 (exp (* x eps_m))) 2.0)
(if (<= x 1.35e+146)
(/
(+
(* (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 t_0))
(* (+ -1.0 (/ 1.0 eps_m)) (+ -1.0 (* x (+ 1.0 eps_m)))))
2.0)
(/ (+ 1.0 (exp t_0)) 2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = x * (-1.0 + eps_m);
double tmp;
if (x <= -1e-279) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 1.1e+55) {
tmp = (1.0 + exp((x * eps_m))) / 2.0;
} else if (x <= 1.35e+146) {
tmp = (((1.0 + (1.0 / eps_m)) * (1.0 + t_0)) + ((-1.0 + (1.0 / eps_m)) * (-1.0 + (x * (1.0 + eps_m))))) / 2.0;
} else {
tmp = (1.0 + exp(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 = x * ((-1.0d0) + eps_m)
if (x <= (-1d-279)) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= 1.1d+55) then
tmp = (1.0d0 + exp((x * eps_m))) / 2.0d0
else if (x <= 1.35d+146) then
tmp = (((1.0d0 + (1.0d0 / eps_m)) * (1.0d0 + t_0)) + (((-1.0d0) + (1.0d0 / eps_m)) * ((-1.0d0) + (x * (1.0d0 + eps_m))))) / 2.0d0
else
tmp = (1.0d0 + exp(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 = x * (-1.0 + eps_m);
double tmp;
if (x <= -1e-279) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 1.1e+55) {
tmp = (1.0 + Math.exp((x * eps_m))) / 2.0;
} else if (x <= 1.35e+146) {
tmp = (((1.0 + (1.0 / eps_m)) * (1.0 + t_0)) + ((-1.0 + (1.0 / eps_m)) * (-1.0 + (x * (1.0 + eps_m))))) / 2.0;
} else {
tmp = (1.0 + Math.exp(t_0)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = x * (-1.0 + eps_m) tmp = 0 if x <= -1e-279: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 1.1e+55: tmp = (1.0 + math.exp((x * eps_m))) / 2.0 elif x <= 1.35e+146: tmp = (((1.0 + (1.0 / eps_m)) * (1.0 + t_0)) + ((-1.0 + (1.0 / eps_m)) * (-1.0 + (x * (1.0 + eps_m))))) / 2.0 else: tmp = (1.0 + math.exp(t_0)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(x * Float64(-1.0 + eps_m)) tmp = 0.0 if (x <= -1e-279) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 1.1e+55) tmp = Float64(Float64(1.0 + exp(Float64(x * eps_m))) / 2.0); elseif (x <= 1.35e+146) tmp = Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) * Float64(1.0 + t_0)) + Float64(Float64(-1.0 + Float64(1.0 / eps_m)) * Float64(-1.0 + Float64(x * Float64(1.0 + eps_m))))) / 2.0); else tmp = Float64(Float64(1.0 + exp(t_0)) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = x * (-1.0 + eps_m); tmp = 0.0; if (x <= -1e-279) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= 1.1e+55) tmp = (1.0 + exp((x * eps_m))) / 2.0; elseif (x <= 1.35e+146) tmp = (((1.0 + (1.0 / eps_m)) * (1.0 + t_0)) + ((-1.0 + (1.0 / eps_m)) * (-1.0 + (x * (1.0 + eps_m))))) / 2.0; else tmp = (1.0 + exp(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[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1e-279], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.1e+55], N[(N[(1.0 + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.35e+146], N[(N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(x * N[(1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[t$95$0], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := x \cdot \left(-1 + eps_m\right)\\
\mathbf{if}\;x \leq -1 \cdot 10^{-279}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{+55}:\\
\;\;\;\;\frac{1 + e^{x \cdot eps_m}}{2}\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{+146}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps_m}\right) \cdot \left(1 + t_0\right) + \left(-1 + \frac{1}{eps_m}\right) \cdot \left(-1 + x \cdot \left(1 + eps_m\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{t_0}}{2}\\
\end{array}
\end{array}
if x < -1.00000000000000006e-279Initial program 59.8%
fma-neg59.8%
/-rgt-identity59.8%
fma-neg59.8%
/-rgt-identity59.8%
distribute-rgt-neg-in59.8%
sub-neg59.8%
metadata-eval59.8%
distribute-rgt-neg-in59.8%
Simplified59.8%
Taylor expanded in eps around inf 99.0%
Taylor expanded in x around 0 71.0%
Taylor expanded in eps around 0 82.3%
neg-mul-182.3%
Simplified82.3%
if -1.00000000000000006e-279 < x < 1.10000000000000005e55Initial program 58.8%
fma-neg58.9%
/-rgt-identity58.9%
fma-neg58.8%
/-rgt-identity58.8%
distribute-rgt-neg-in58.8%
sub-neg58.8%
metadata-eval58.8%
distribute-rgt-neg-in58.8%
Simplified58.8%
Taylor expanded in x around 0 42.3%
Taylor expanded in eps around inf 42.3%
Taylor expanded in x around 0 43.3%
Taylor expanded in eps around inf 81.1%
if 1.10000000000000005e55 < x < 1.34999999999999994e146Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 32.9%
Taylor expanded in x around 0 63.5%
if 1.34999999999999994e146 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 23.1%
Taylor expanded in x around inf 23.1%
*-commutative23.1%
sub-neg23.1%
neg-mul-123.1%
*-commutative23.1%
associate-*r*23.1%
neg-mul-123.1%
neg-mul-123.1%
sub-neg23.1%
Simplified23.1%
Final simplification72.6%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (* x (+ -1.0 eps_m))))
(if (<= x -2e-279)
(/ (- (exp (* x (- 1.0 eps_m))) -1.0) 2.0)
(if (<= x 1.15e+55)
(/ (+ 1.0 (exp (* x eps_m))) 2.0)
(if (<= x 1.35e+146)
(/
(+
(* (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 t_0))
(* (+ -1.0 (/ 1.0 eps_m)) (+ -1.0 (* x (+ 1.0 eps_m)))))
2.0)
(/ (+ 1.0 (exp t_0)) 2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = x * (-1.0 + eps_m);
double tmp;
if (x <= -2e-279) {
tmp = (exp((x * (1.0 - eps_m))) - -1.0) / 2.0;
} else if (x <= 1.15e+55) {
tmp = (1.0 + exp((x * eps_m))) / 2.0;
} else if (x <= 1.35e+146) {
tmp = (((1.0 + (1.0 / eps_m)) * (1.0 + t_0)) + ((-1.0 + (1.0 / eps_m)) * (-1.0 + (x * (1.0 + eps_m))))) / 2.0;
} else {
tmp = (1.0 + exp(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 = x * ((-1.0d0) + eps_m)
if (x <= (-2d-279)) then
tmp = (exp((x * (1.0d0 - eps_m))) - (-1.0d0)) / 2.0d0
else if (x <= 1.15d+55) then
tmp = (1.0d0 + exp((x * eps_m))) / 2.0d0
else if (x <= 1.35d+146) then
tmp = (((1.0d0 + (1.0d0 / eps_m)) * (1.0d0 + t_0)) + (((-1.0d0) + (1.0d0 / eps_m)) * ((-1.0d0) + (x * (1.0d0 + eps_m))))) / 2.0d0
else
tmp = (1.0d0 + exp(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 = x * (-1.0 + eps_m);
double tmp;
if (x <= -2e-279) {
tmp = (Math.exp((x * (1.0 - eps_m))) - -1.0) / 2.0;
} else if (x <= 1.15e+55) {
tmp = (1.0 + Math.exp((x * eps_m))) / 2.0;
} else if (x <= 1.35e+146) {
tmp = (((1.0 + (1.0 / eps_m)) * (1.0 + t_0)) + ((-1.0 + (1.0 / eps_m)) * (-1.0 + (x * (1.0 + eps_m))))) / 2.0;
} else {
tmp = (1.0 + Math.exp(t_0)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = x * (-1.0 + eps_m) tmp = 0 if x <= -2e-279: tmp = (math.exp((x * (1.0 - eps_m))) - -1.0) / 2.0 elif x <= 1.15e+55: tmp = (1.0 + math.exp((x * eps_m))) / 2.0 elif x <= 1.35e+146: tmp = (((1.0 + (1.0 / eps_m)) * (1.0 + t_0)) + ((-1.0 + (1.0 / eps_m)) * (-1.0 + (x * (1.0 + eps_m))))) / 2.0 else: tmp = (1.0 + math.exp(t_0)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(x * Float64(-1.0 + eps_m)) tmp = 0.0 if (x <= -2e-279) tmp = Float64(Float64(exp(Float64(x * Float64(1.0 - eps_m))) - -1.0) / 2.0); elseif (x <= 1.15e+55) tmp = Float64(Float64(1.0 + exp(Float64(x * eps_m))) / 2.0); elseif (x <= 1.35e+146) tmp = Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) * Float64(1.0 + t_0)) + Float64(Float64(-1.0 + Float64(1.0 / eps_m)) * Float64(-1.0 + Float64(x * Float64(1.0 + eps_m))))) / 2.0); else tmp = Float64(Float64(1.0 + exp(t_0)) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = x * (-1.0 + eps_m); tmp = 0.0; if (x <= -2e-279) tmp = (exp((x * (1.0 - eps_m))) - -1.0) / 2.0; elseif (x <= 1.15e+55) tmp = (1.0 + exp((x * eps_m))) / 2.0; elseif (x <= 1.35e+146) tmp = (((1.0 + (1.0 / eps_m)) * (1.0 + t_0)) + ((-1.0 + (1.0 / eps_m)) * (-1.0 + (x * (1.0 + eps_m))))) / 2.0; else tmp = (1.0 + exp(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[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2e-279], N[(N[(N[Exp[N[(x * N[(1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.15e+55], N[(N[(1.0 + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.35e+146], N[(N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(x * N[(1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[t$95$0], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := x \cdot \left(-1 + eps_m\right)\\
\mathbf{if}\;x \leq -2 \cdot 10^{-279}:\\
\;\;\;\;\frac{e^{x \cdot \left(1 - eps_m\right)} - -1}{2}\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{+55}:\\
\;\;\;\;\frac{1 + e^{x \cdot eps_m}}{2}\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{+146}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps_m}\right) \cdot \left(1 + t_0\right) + \left(-1 + \frac{1}{eps_m}\right) \cdot \left(-1 + x \cdot \left(1 + eps_m\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{t_0}}{2}\\
\end{array}
\end{array}
if x < -2.00000000000000011e-279Initial program 59.8%
fma-neg59.8%
/-rgt-identity59.8%
fma-neg59.8%
/-rgt-identity59.8%
distribute-rgt-neg-in59.8%
sub-neg59.8%
metadata-eval59.8%
distribute-rgt-neg-in59.8%
Simplified59.8%
Taylor expanded in eps around inf 99.0%
exp-prod99.0%
Applied egg-rr99.0%
Taylor expanded in x around 0 71.0%
pow-exp71.0%
add-sqr-sqrt63.3%
sqrt-unprod98.8%
mul-1-neg98.8%
mul-1-neg98.8%
sqr-neg98.8%
sqrt-unprod35.5%
add-sqr-sqrt83.0%
Applied egg-rr83.0%
if -2.00000000000000011e-279 < x < 1.14999999999999994e55Initial program 58.8%
fma-neg58.9%
/-rgt-identity58.9%
fma-neg58.8%
/-rgt-identity58.8%
distribute-rgt-neg-in58.8%
sub-neg58.8%
metadata-eval58.8%
distribute-rgt-neg-in58.8%
Simplified58.8%
Taylor expanded in x around 0 42.3%
Taylor expanded in eps around inf 42.3%
Taylor expanded in x around 0 43.3%
Taylor expanded in eps around inf 81.1%
if 1.14999999999999994e55 < x < 1.34999999999999994e146Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 32.9%
Taylor expanded in x around 0 63.5%
if 1.34999999999999994e146 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 23.1%
Taylor expanded in x around inf 23.1%
*-commutative23.1%
sub-neg23.1%
neg-mul-123.1%
*-commutative23.1%
associate-*r*23.1%
neg-mul-123.1%
neg-mul-123.1%
sub-neg23.1%
Simplified23.1%
Final simplification72.9%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -9e-280)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (or (<= x 1.15e+55) (not (<= x 1.45e+146)))
(/ (+ 1.0 (exp (* x eps_m))) 2.0)
(/
(+
(* (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (* x (+ -1.0 eps_m))))
(* (+ -1.0 (/ 1.0 eps_m)) (+ -1.0 (* x (+ 1.0 eps_m)))))
2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -9e-280) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if ((x <= 1.15e+55) || !(x <= 1.45e+146)) {
tmp = (1.0 + exp((x * eps_m))) / 2.0;
} else {
tmp = (((1.0 + (1.0 / eps_m)) * (1.0 + (x * (-1.0 + eps_m)))) + ((-1.0 + (1.0 / eps_m)) * (-1.0 + (x * (1.0 + eps_m))))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-9d-280)) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if ((x <= 1.15d+55) .or. (.not. (x <= 1.45d+146))) then
tmp = (1.0d0 + exp((x * eps_m))) / 2.0d0
else
tmp = (((1.0d0 + (1.0d0 / eps_m)) * (1.0d0 + (x * ((-1.0d0) + eps_m)))) + (((-1.0d0) + (1.0d0 / eps_m)) * ((-1.0d0) + (x * (1.0d0 + eps_m))))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -9e-280) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if ((x <= 1.15e+55) || !(x <= 1.45e+146)) {
tmp = (1.0 + Math.exp((x * eps_m))) / 2.0;
} else {
tmp = (((1.0 + (1.0 / eps_m)) * (1.0 + (x * (-1.0 + eps_m)))) + ((-1.0 + (1.0 / eps_m)) * (-1.0 + (x * (1.0 + eps_m))))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -9e-280: tmp = (1.0 + math.exp(-x)) / 2.0 elif (x <= 1.15e+55) or not (x <= 1.45e+146): tmp = (1.0 + math.exp((x * eps_m))) / 2.0 else: tmp = (((1.0 + (1.0 / eps_m)) * (1.0 + (x * (-1.0 + eps_m)))) + ((-1.0 + (1.0 / eps_m)) * (-1.0 + (x * (1.0 + eps_m))))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -9e-280) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif ((x <= 1.15e+55) || !(x <= 1.45e+146)) tmp = Float64(Float64(1.0 + exp(Float64(x * eps_m))) / 2.0); else tmp = Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) * Float64(1.0 + Float64(x * Float64(-1.0 + eps_m)))) + Float64(Float64(-1.0 + Float64(1.0 / eps_m)) * Float64(-1.0 + Float64(x * Float64(1.0 + eps_m))))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -9e-280) tmp = (1.0 + exp(-x)) / 2.0; elseif ((x <= 1.15e+55) || ~((x <= 1.45e+146))) tmp = (1.0 + exp((x * eps_m))) / 2.0; else tmp = (((1.0 + (1.0 / eps_m)) * (1.0 + (x * (-1.0 + eps_m)))) + ((-1.0 + (1.0 / eps_m)) * (-1.0 + (x * (1.0 + eps_m))))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -9e-280], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 1.15e+55], N[Not[LessEqual[x, 1.45e+146]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(x * N[(1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{-280}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{+55} \lor \neg \left(x \leq 1.45 \cdot 10^{+146}\right):\\
\;\;\;\;\frac{1 + e^{x \cdot eps_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps_m}\right) \cdot \left(1 + x \cdot \left(-1 + eps_m\right)\right) + \left(-1 + \frac{1}{eps_m}\right) \cdot \left(-1 + x \cdot \left(1 + eps_m\right)\right)}{2}\\
\end{array}
\end{array}
if x < -8.9999999999999991e-280Initial program 59.8%
fma-neg59.8%
/-rgt-identity59.8%
fma-neg59.8%
/-rgt-identity59.8%
distribute-rgt-neg-in59.8%
sub-neg59.8%
metadata-eval59.8%
distribute-rgt-neg-in59.8%
Simplified59.8%
Taylor expanded in eps around inf 99.0%
Taylor expanded in x around 0 71.0%
Taylor expanded in eps around 0 82.3%
neg-mul-182.3%
Simplified82.3%
if -8.9999999999999991e-280 < x < 1.14999999999999994e55 or 1.4499999999999999e146 < x Initial program 69.4%
fma-neg69.4%
/-rgt-identity69.4%
fma-neg69.4%
/-rgt-identity69.4%
distribute-rgt-neg-in69.4%
sub-neg69.4%
metadata-eval69.4%
distribute-rgt-neg-in69.4%
Simplified69.4%
Taylor expanded in x around 0 38.6%
Taylor expanded in eps around inf 38.6%
Taylor expanded in x around 0 40.9%
Taylor expanded in eps around inf 66.2%
if 1.14999999999999994e55 < x < 1.4499999999999999e146Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 32.9%
Taylor expanded in x around 0 63.5%
Final simplification72.5%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (+ 1.0 (/ 1.0 eps_m))))
(if (<= x 2.4e+40)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (<= x 2.3e+156)
(/
(+
(* t_0 (+ 1.0 (* x (+ -1.0 eps_m))))
(* (+ -1.0 (/ 1.0 eps_m)) (+ -1.0 (* x (+ 1.0 eps_m)))))
2.0)
(/ (+ (* t_0 (+ 1.0 (* x eps_m))) (- (/ -1.0 eps_m) -1.0)) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = 1.0 + (1.0 / eps_m);
double tmp;
if (x <= 2.4e+40) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 2.3e+156) {
tmp = ((t_0 * (1.0 + (x * (-1.0 + eps_m)))) + ((-1.0 + (1.0 / eps_m)) * (-1.0 + (x * (1.0 + eps_m))))) / 2.0;
} else {
tmp = ((t_0 * (1.0 + (x * eps_m))) + ((-1.0 / eps_m) - -1.0)) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (1.0d0 / eps_m)
if (x <= 2.4d+40) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= 2.3d+156) then
tmp = ((t_0 * (1.0d0 + (x * ((-1.0d0) + eps_m)))) + (((-1.0d0) + (1.0d0 / eps_m)) * ((-1.0d0) + (x * (1.0d0 + eps_m))))) / 2.0d0
else
tmp = ((t_0 * (1.0d0 + (x * eps_m))) + (((-1.0d0) / eps_m) - (-1.0d0))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = 1.0 + (1.0 / eps_m);
double tmp;
if (x <= 2.4e+40) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 2.3e+156) {
tmp = ((t_0 * (1.0 + (x * (-1.0 + eps_m)))) + ((-1.0 + (1.0 / eps_m)) * (-1.0 + (x * (1.0 + eps_m))))) / 2.0;
} else {
tmp = ((t_0 * (1.0 + (x * eps_m))) + ((-1.0 / eps_m) - -1.0)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = 1.0 + (1.0 / eps_m) tmp = 0 if x <= 2.4e+40: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 2.3e+156: tmp = ((t_0 * (1.0 + (x * (-1.0 + eps_m)))) + ((-1.0 + (1.0 / eps_m)) * (-1.0 + (x * (1.0 + eps_m))))) / 2.0 else: tmp = ((t_0 * (1.0 + (x * eps_m))) + ((-1.0 / eps_m) - -1.0)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(1.0 + Float64(1.0 / eps_m)) tmp = 0.0 if (x <= 2.4e+40) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 2.3e+156) tmp = Float64(Float64(Float64(t_0 * Float64(1.0 + Float64(x * Float64(-1.0 + eps_m)))) + Float64(Float64(-1.0 + Float64(1.0 / eps_m)) * Float64(-1.0 + Float64(x * Float64(1.0 + eps_m))))) / 2.0); else tmp = Float64(Float64(Float64(t_0 * Float64(1.0 + Float64(x * eps_m))) + Float64(Float64(-1.0 / eps_m) - -1.0)) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = 1.0 + (1.0 / eps_m); tmp = 0.0; if (x <= 2.4e+40) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= 2.3e+156) tmp = ((t_0 * (1.0 + (x * (-1.0 + eps_m)))) + ((-1.0 + (1.0 / eps_m)) * (-1.0 + (x * (1.0 + eps_m))))) / 2.0; else tmp = ((t_0 * (1.0 + (x * eps_m))) + ((-1.0 / eps_m) - -1.0)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 2.4e+40], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.3e+156], N[(N[(N[(t$95$0 * N[(1.0 + N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(x * N[(1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(t$95$0 * N[(1.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 / eps$95$m), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := 1 + \frac{1}{eps_m}\\
\mathbf{if}\;x \leq 2.4 \cdot 10^{+40}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{+156}:\\
\;\;\;\;\frac{t_0 \cdot \left(1 + x \cdot \left(-1 + eps_m\right)\right) + \left(-1 + \frac{1}{eps_m}\right) \cdot \left(-1 + x \cdot \left(1 + eps_m\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0 \cdot \left(1 + x \cdot eps_m\right) + \left(\frac{-1}{eps_m} - -1\right)}{2}\\
\end{array}
\end{array}
if x < 2.4e40Initial program 57.7%
fma-neg57.7%
/-rgt-identity57.7%
fma-neg57.7%
/-rgt-identity57.7%
distribute-rgt-neg-in57.7%
sub-neg57.7%
metadata-eval57.7%
distribute-rgt-neg-in57.7%
Simplified57.7%
Taylor expanded in eps around inf 98.9%
Taylor expanded in x around 0 77.6%
Taylor expanded in eps around 0 79.0%
neg-mul-179.0%
Simplified79.0%
if 2.4e40 < x < 2.2999999999999999e156Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 34.9%
Taylor expanded in x around 0 57.1%
if 2.2999999999999999e156 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 27.2%
Taylor expanded in eps around inf 27.2%
Taylor expanded in x around 0 33.8%
Taylor expanded in eps around 0 24.1%
*-commutative24.1%
Simplified24.1%
Final simplification69.8%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (+ 1.0 (/ 1.0 eps_m))) (t_1 (+ -1.0 (/ 1.0 eps_m))))
(if (<= x -7.6e-19)
(/ (* x (* (+ 1.0 eps_m) t_1)) 2.0)
(if (<= x 2.4e+40)
1.0
(if (<= x 2.6e+156)
(/
(+
(* t_0 (+ 1.0 (* x (+ -1.0 eps_m))))
(* t_1 (+ -1.0 (* x (+ 1.0 eps_m)))))
2.0)
(/ (+ (* t_0 (+ 1.0 (* x eps_m))) (- (/ -1.0 eps_m) -1.0)) 2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = 1.0 + (1.0 / eps_m);
double t_1 = -1.0 + (1.0 / eps_m);
double tmp;
if (x <= -7.6e-19) {
tmp = (x * ((1.0 + eps_m) * t_1)) / 2.0;
} else if (x <= 2.4e+40) {
tmp = 1.0;
} else if (x <= 2.6e+156) {
tmp = ((t_0 * (1.0 + (x * (-1.0 + eps_m)))) + (t_1 * (-1.0 + (x * (1.0 + eps_m))))) / 2.0;
} else {
tmp = ((t_0 * (1.0 + (x * eps_m))) + ((-1.0 / eps_m) - -1.0)) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + (1.0d0 / eps_m)
t_1 = (-1.0d0) + (1.0d0 / eps_m)
if (x <= (-7.6d-19)) then
tmp = (x * ((1.0d0 + eps_m) * t_1)) / 2.0d0
else if (x <= 2.4d+40) then
tmp = 1.0d0
else if (x <= 2.6d+156) then
tmp = ((t_0 * (1.0d0 + (x * ((-1.0d0) + eps_m)))) + (t_1 * ((-1.0d0) + (x * (1.0d0 + eps_m))))) / 2.0d0
else
tmp = ((t_0 * (1.0d0 + (x * eps_m))) + (((-1.0d0) / eps_m) - (-1.0d0))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = 1.0 + (1.0 / eps_m);
double t_1 = -1.0 + (1.0 / eps_m);
double tmp;
if (x <= -7.6e-19) {
tmp = (x * ((1.0 + eps_m) * t_1)) / 2.0;
} else if (x <= 2.4e+40) {
tmp = 1.0;
} else if (x <= 2.6e+156) {
tmp = ((t_0 * (1.0 + (x * (-1.0 + eps_m)))) + (t_1 * (-1.0 + (x * (1.0 + eps_m))))) / 2.0;
} else {
tmp = ((t_0 * (1.0 + (x * eps_m))) + ((-1.0 / eps_m) - -1.0)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = 1.0 + (1.0 / eps_m) t_1 = -1.0 + (1.0 / eps_m) tmp = 0 if x <= -7.6e-19: tmp = (x * ((1.0 + eps_m) * t_1)) / 2.0 elif x <= 2.4e+40: tmp = 1.0 elif x <= 2.6e+156: tmp = ((t_0 * (1.0 + (x * (-1.0 + eps_m)))) + (t_1 * (-1.0 + (x * (1.0 + eps_m))))) / 2.0 else: tmp = ((t_0 * (1.0 + (x * eps_m))) + ((-1.0 / eps_m) - -1.0)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(1.0 + Float64(1.0 / eps_m)) t_1 = Float64(-1.0 + Float64(1.0 / eps_m)) tmp = 0.0 if (x <= -7.6e-19) tmp = Float64(Float64(x * Float64(Float64(1.0 + eps_m) * t_1)) / 2.0); elseif (x <= 2.4e+40) tmp = 1.0; elseif (x <= 2.6e+156) tmp = Float64(Float64(Float64(t_0 * Float64(1.0 + Float64(x * Float64(-1.0 + eps_m)))) + Float64(t_1 * Float64(-1.0 + Float64(x * Float64(1.0 + eps_m))))) / 2.0); else tmp = Float64(Float64(Float64(t_0 * Float64(1.0 + Float64(x * eps_m))) + Float64(Float64(-1.0 / eps_m) - -1.0)) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = 1.0 + (1.0 / eps_m); t_1 = -1.0 + (1.0 / eps_m); tmp = 0.0; if (x <= -7.6e-19) tmp = (x * ((1.0 + eps_m) * t_1)) / 2.0; elseif (x <= 2.4e+40) tmp = 1.0; elseif (x <= 2.6e+156) tmp = ((t_0 * (1.0 + (x * (-1.0 + eps_m)))) + (t_1 * (-1.0 + (x * (1.0 + eps_m))))) / 2.0; else tmp = ((t_0 * (1.0 + (x * eps_m))) + ((-1.0 / eps_m) - -1.0)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7.6e-19], N[(N[(x * N[(N[(1.0 + eps$95$m), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.4e+40], 1.0, If[LessEqual[x, 2.6e+156], N[(N[(N[(t$95$0 * N[(1.0 + N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * N[(-1.0 + N[(x * N[(1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(t$95$0 * N[(1.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 / eps$95$m), $MachinePrecision] - -1.0), $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 := -1 + \frac{1}{eps_m}\\
\mathbf{if}\;x \leq -7.6 \cdot 10^{-19}:\\
\;\;\;\;\frac{x \cdot \left(\left(1 + eps_m\right) \cdot t_1\right)}{2}\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{+40}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+156}:\\
\;\;\;\;\frac{t_0 \cdot \left(1 + x \cdot \left(-1 + eps_m\right)\right) + t_1 \cdot \left(-1 + x \cdot \left(1 + eps_m\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0 \cdot \left(1 + x \cdot eps_m\right) + \left(\frac{-1}{eps_m} - -1\right)}{2}\\
\end{array}
\end{array}
if x < -7.6e-19Initial program 96.8%
fma-neg96.8%
/-rgt-identity96.8%
fma-neg96.8%
/-rgt-identity96.8%
distribute-rgt-neg-in96.8%
sub-neg96.8%
metadata-eval96.8%
distribute-rgt-neg-in96.8%
Simplified96.8%
Taylor expanded in x around 0 65.9%
Taylor expanded in x around inf 43.3%
if -7.6e-19 < x < 2.4e40Initial program 50.3%
fma-neg50.3%
/-rgt-identity50.3%
fma-neg50.3%
/-rgt-identity50.3%
distribute-rgt-neg-in50.3%
sub-neg50.3%
metadata-eval50.3%
distribute-rgt-neg-in50.3%
Simplified50.3%
Taylor expanded in x around 0 76.7%
if 2.4e40 < x < 2.60000000000000019e156Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 34.9%
Taylor expanded in x around 0 57.1%
if 2.60000000000000019e156 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 27.2%
Taylor expanded in eps around inf 27.2%
Taylor expanded in x around 0 33.8%
Taylor expanded in eps around 0 24.1%
*-commutative24.1%
Simplified24.1%
Final simplification64.0%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -7.6e-19)
(/ (* x (* (+ 1.0 eps_m) (+ -1.0 (/ 1.0 eps_m)))) 2.0)
(if (<= x 1.8)
1.0
(/
(+ (* (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (* x eps_m))) (- (/ -1.0 eps_m) -1.0))
2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -7.6e-19) {
tmp = (x * ((1.0 + eps_m) * (-1.0 + (1.0 / eps_m)))) / 2.0;
} else if (x <= 1.8) {
tmp = 1.0;
} else {
tmp = (((1.0 + (1.0 / eps_m)) * (1.0 + (x * eps_m))) + ((-1.0 / eps_m) - -1.0)) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-7.6d-19)) then
tmp = (x * ((1.0d0 + eps_m) * ((-1.0d0) + (1.0d0 / eps_m)))) / 2.0d0
else if (x <= 1.8d0) then
tmp = 1.0d0
else
tmp = (((1.0d0 + (1.0d0 / eps_m)) * (1.0d0 + (x * eps_m))) + (((-1.0d0) / eps_m) - (-1.0d0))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -7.6e-19) {
tmp = (x * ((1.0 + eps_m) * (-1.0 + (1.0 / eps_m)))) / 2.0;
} else if (x <= 1.8) {
tmp = 1.0;
} else {
tmp = (((1.0 + (1.0 / eps_m)) * (1.0 + (x * eps_m))) + ((-1.0 / eps_m) - -1.0)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -7.6e-19: tmp = (x * ((1.0 + eps_m) * (-1.0 + (1.0 / eps_m)))) / 2.0 elif x <= 1.8: tmp = 1.0 else: tmp = (((1.0 + (1.0 / eps_m)) * (1.0 + (x * eps_m))) + ((-1.0 / eps_m) - -1.0)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -7.6e-19) tmp = Float64(Float64(x * Float64(Float64(1.0 + eps_m) * Float64(-1.0 + Float64(1.0 / eps_m)))) / 2.0); elseif (x <= 1.8) tmp = 1.0; else tmp = Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) * Float64(1.0 + Float64(x * eps_m))) + Float64(Float64(-1.0 / eps_m) - -1.0)) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -7.6e-19) tmp = (x * ((1.0 + eps_m) * (-1.0 + (1.0 / eps_m)))) / 2.0; elseif (x <= 1.8) tmp = 1.0; else tmp = (((1.0 + (1.0 / eps_m)) * (1.0 + (x * eps_m))) + ((-1.0 / eps_m) - -1.0)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -7.6e-19], N[(N[(x * N[(N[(1.0 + eps$95$m), $MachinePrecision] * N[(-1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.8], 1.0, N[(N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 / eps$95$m), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.6 \cdot 10^{-19}:\\
\;\;\;\;\frac{x \cdot \left(\left(1 + eps_m\right) \cdot \left(-1 + \frac{1}{eps_m}\right)\right)}{2}\\
\mathbf{elif}\;x \leq 1.8:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps_m}\right) \cdot \left(1 + x \cdot eps_m\right) + \left(\frac{-1}{eps_m} - -1\right)}{2}\\
\end{array}
\end{array}
if x < -7.6e-19Initial program 96.8%
fma-neg96.8%
/-rgt-identity96.8%
fma-neg96.8%
/-rgt-identity96.8%
distribute-rgt-neg-in96.8%
sub-neg96.8%
metadata-eval96.8%
distribute-rgt-neg-in96.8%
Simplified96.8%
Taylor expanded in x around 0 65.9%
Taylor expanded in x around inf 43.3%
if -7.6e-19 < x < 1.80000000000000004Initial program 48.4%
fma-neg48.4%
/-rgt-identity48.4%
fma-neg48.4%
/-rgt-identity48.4%
distribute-rgt-neg-in48.4%
sub-neg48.4%
metadata-eval48.4%
distribute-rgt-neg-in48.4%
Simplified48.4%
Taylor expanded in x around 0 79.5%
if 1.80000000000000004 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 34.4%
Taylor expanded in eps around inf 34.3%
Taylor expanded in x around 0 44.6%
Taylor expanded in eps around 0 24.3%
*-commutative24.3%
Simplified24.3%
Final simplification60.6%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -7.6e-19) (/ (* x (- eps_m)) 2.0) (if (<= x 1.8) 1.0 (/ (- (* x eps_m) (/ x eps_m)) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -7.6e-19) {
tmp = (x * -eps_m) / 2.0;
} else if (x <= 1.8) {
tmp = 1.0;
} else {
tmp = ((x * eps_m) - (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 <= (-7.6d-19)) then
tmp = (x * -eps_m) / 2.0d0
else if (x <= 1.8d0) then
tmp = 1.0d0
else
tmp = ((x * eps_m) - (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 <= -7.6e-19) {
tmp = (x * -eps_m) / 2.0;
} else if (x <= 1.8) {
tmp = 1.0;
} else {
tmp = ((x * eps_m) - (x / eps_m)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -7.6e-19: tmp = (x * -eps_m) / 2.0 elif x <= 1.8: tmp = 1.0 else: tmp = ((x * eps_m) - (x / eps_m)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -7.6e-19) tmp = Float64(Float64(x * Float64(-eps_m)) / 2.0); elseif (x <= 1.8) tmp = 1.0; else tmp = Float64(Float64(Float64(x * eps_m) - 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 <= -7.6e-19) tmp = (x * -eps_m) / 2.0; elseif (x <= 1.8) tmp = 1.0; else tmp = ((x * eps_m) - (x / eps_m)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -7.6e-19], N[(N[(x * (-eps$95$m)), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.8], 1.0, N[(N[(N[(x * eps$95$m), $MachinePrecision] - 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 -7.6 \cdot 10^{-19}:\\
\;\;\;\;\frac{x \cdot \left(-eps_m\right)}{2}\\
\mathbf{elif}\;x \leq 1.8:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps_m - \frac{x}{eps_m}}{2}\\
\end{array}
\end{array}
if x < -7.6e-19Initial program 96.8%
fma-neg96.8%
/-rgt-identity96.8%
fma-neg96.8%
/-rgt-identity96.8%
distribute-rgt-neg-in96.8%
sub-neg96.8%
metadata-eval96.8%
distribute-rgt-neg-in96.8%
Simplified96.8%
Taylor expanded in x around 0 65.9%
Taylor expanded in x around inf 43.3%
Taylor expanded in eps around inf 43.4%
associate-*r*43.4%
neg-mul-143.4%
Simplified43.4%
if -7.6e-19 < x < 1.80000000000000004Initial program 48.4%
fma-neg48.4%
/-rgt-identity48.4%
fma-neg48.4%
/-rgt-identity48.4%
distribute-rgt-neg-in48.4%
sub-neg48.4%
metadata-eval48.4%
distribute-rgt-neg-in48.4%
Simplified48.4%
Taylor expanded in x around 0 79.5%
if 1.80000000000000004 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 34.4%
Taylor expanded in x around inf 13.6%
sub-neg13.6%
metadata-eval13.6%
associate-*r*13.6%
add-sqr-sqrt1.0%
sqrt-unprod1.0%
sqr-neg1.0%
mul-1-neg1.0%
mul-1-neg1.0%
sqrt-unprod0.0%
add-sqr-sqrt6.6%
mul-1-neg6.6%
distribute-lft-neg-out6.6%
associate-*r*6.6%
+-commutative6.6%
Applied egg-rr6.6%
distribute-lft-neg-in6.6%
associate-*r*6.6%
*-commutative6.6%
Simplified6.6%
Taylor expanded in eps around 0 6.6%
+-commutative6.6%
mul-1-neg6.6%
unsub-neg6.6%
Simplified6.6%
Final simplification56.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -7.6e-19) (/ (* x (* (+ 1.0 eps_m) (+ -1.0 (/ 1.0 eps_m)))) 2.0) (/ (+ 2.0 (* x (+ -1.0 eps_m))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -7.6e-19) {
tmp = (x * ((1.0 + eps_m) * (-1.0 + (1.0 / eps_m)))) / 2.0;
} else {
tmp = (2.0 + (x * (-1.0 + eps_m))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-7.6d-19)) then
tmp = (x * ((1.0d0 + eps_m) * ((-1.0d0) + (1.0d0 / eps_m)))) / 2.0d0
else
tmp = (2.0d0 + (x * ((-1.0d0) + eps_m))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -7.6e-19) {
tmp = (x * ((1.0 + eps_m) * (-1.0 + (1.0 / eps_m)))) / 2.0;
} else {
tmp = (2.0 + (x * (-1.0 + eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -7.6e-19: tmp = (x * ((1.0 + eps_m) * (-1.0 + (1.0 / eps_m)))) / 2.0 else: tmp = (2.0 + (x * (-1.0 + eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -7.6e-19) tmp = Float64(Float64(x * Float64(Float64(1.0 + eps_m) * Float64(-1.0 + Float64(1.0 / eps_m)))) / 2.0); else tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + eps_m))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -7.6e-19) tmp = (x * ((1.0 + eps_m) * (-1.0 + (1.0 / eps_m)))) / 2.0; else tmp = (2.0 + (x * (-1.0 + eps_m))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -7.6e-19], N[(N[(x * N[(N[(1.0 + eps$95$m), $MachinePrecision] * N[(-1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.6 \cdot 10^{-19}:\\
\;\;\;\;\frac{x \cdot \left(\left(1 + eps_m\right) \cdot \left(-1 + \frac{1}{eps_m}\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + eps_m\right)}{2}\\
\end{array}
\end{array}
if x < -7.6e-19Initial program 96.8%
fma-neg96.8%
/-rgt-identity96.8%
fma-neg96.8%
/-rgt-identity96.8%
distribute-rgt-neg-in96.8%
sub-neg96.8%
metadata-eval96.8%
distribute-rgt-neg-in96.8%
Simplified96.8%
Taylor expanded in x around 0 65.9%
Taylor expanded in x around inf 43.3%
if -7.6e-19 < x Initial program 63.8%
fma-neg63.8%
/-rgt-identity63.8%
fma-neg63.8%
/-rgt-identity63.8%
distribute-rgt-neg-in63.8%
sub-neg63.8%
metadata-eval63.8%
distribute-rgt-neg-in63.8%
Simplified63.8%
Taylor expanded in eps around inf 99.5%
Taylor expanded in x around 0 69.0%
Taylor expanded in x around 0 57.0%
+-commutative57.0%
mul-1-neg57.0%
distribute-lft-neg-in57.0%
Simplified57.0%
Final simplification55.3%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -7.6e-19) (/ (* x (- eps_m)) 2.0) (/ (+ 2.0 (* x (+ -1.0 eps_m))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -7.6e-19) {
tmp = (x * -eps_m) / 2.0;
} else {
tmp = (2.0 + (x * (-1.0 + eps_m))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-7.6d-19)) then
tmp = (x * -eps_m) / 2.0d0
else
tmp = (2.0d0 + (x * ((-1.0d0) + eps_m))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -7.6e-19) {
tmp = (x * -eps_m) / 2.0;
} else {
tmp = (2.0 + (x * (-1.0 + eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -7.6e-19: tmp = (x * -eps_m) / 2.0 else: tmp = (2.0 + (x * (-1.0 + eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -7.6e-19) tmp = Float64(Float64(x * Float64(-eps_m)) / 2.0); else tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + eps_m))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -7.6e-19) tmp = (x * -eps_m) / 2.0; else tmp = (2.0 + (x * (-1.0 + eps_m))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -7.6e-19], N[(N[(x * (-eps$95$m)), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.6 \cdot 10^{-19}:\\
\;\;\;\;\frac{x \cdot \left(-eps_m\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + eps_m\right)}{2}\\
\end{array}
\end{array}
if x < -7.6e-19Initial program 96.8%
fma-neg96.8%
/-rgt-identity96.8%
fma-neg96.8%
/-rgt-identity96.8%
distribute-rgt-neg-in96.8%
sub-neg96.8%
metadata-eval96.8%
distribute-rgt-neg-in96.8%
Simplified96.8%
Taylor expanded in x around 0 65.9%
Taylor expanded in x around inf 43.3%
Taylor expanded in eps around inf 43.4%
associate-*r*43.4%
neg-mul-143.4%
Simplified43.4%
if -7.6e-19 < x Initial program 63.8%
fma-neg63.8%
/-rgt-identity63.8%
fma-neg63.8%
/-rgt-identity63.8%
distribute-rgt-neg-in63.8%
sub-neg63.8%
metadata-eval63.8%
distribute-rgt-neg-in63.8%
Simplified63.8%
Taylor expanded in eps around inf 99.5%
Taylor expanded in x around 0 69.0%
Taylor expanded in x around 0 57.0%
+-commutative57.0%
mul-1-neg57.0%
distribute-lft-neg-in57.0%
Simplified57.0%
Final simplification55.3%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -7.6e-19) (/ (* x (- eps_m)) 2.0) 1.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -7.6e-19) {
tmp = (x * -eps_m) / 2.0;
} else {
tmp = 1.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-7.6d-19)) then
tmp = (x * -eps_m) / 2.0d0
else
tmp = 1.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -7.6e-19) {
tmp = (x * -eps_m) / 2.0;
} else {
tmp = 1.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -7.6e-19: tmp = (x * -eps_m) / 2.0 else: tmp = 1.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -7.6e-19) tmp = Float64(Float64(x * Float64(-eps_m)) / 2.0); else tmp = 1.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -7.6e-19) tmp = (x * -eps_m) / 2.0; else tmp = 1.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -7.6e-19], N[(N[(x * (-eps$95$m)), $MachinePrecision] / 2.0), $MachinePrecision], 1.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.6 \cdot 10^{-19}:\\
\;\;\;\;\frac{x \cdot \left(-eps_m\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -7.6e-19Initial program 96.8%
fma-neg96.8%
/-rgt-identity96.8%
fma-neg96.8%
/-rgt-identity96.8%
distribute-rgt-neg-in96.8%
sub-neg96.8%
metadata-eval96.8%
distribute-rgt-neg-in96.8%
Simplified96.8%
Taylor expanded in x around 0 65.9%
Taylor expanded in x around inf 43.3%
Taylor expanded in eps around inf 43.4%
associate-*r*43.4%
neg-mul-143.4%
Simplified43.4%
if -7.6e-19 < x Initial program 63.8%
fma-neg63.8%
/-rgt-identity63.8%
fma-neg63.8%
/-rgt-identity63.8%
distribute-rgt-neg-in63.8%
sub-neg63.8%
metadata-eval63.8%
distribute-rgt-neg-in63.8%
Simplified63.8%
Taylor expanded in x around 0 56.7%
Final simplification55.1%
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 67.8%
fma-neg67.8%
/-rgt-identity67.8%
fma-neg67.8%
/-rgt-identity67.8%
distribute-rgt-neg-in67.8%
sub-neg67.8%
metadata-eval67.8%
distribute-rgt-neg-in67.8%
Simplified67.8%
Taylor expanded in x around 0 50.2%
Final simplification50.2%
herbie shell --seed 2024019
(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))