
(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 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 4.7e-92) (/ (+ (/ (+ 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 <= 4.7e-92) {
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 <= 4.7d-92) 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 <= 4.7e-92) {
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 <= 4.7e-92: 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 <= 4.7e-92) tmp = Float64(Float64(Float64(Float64(x + 1.0) / exp(x)) + Float64(Float64(x + 1.0) * exp(Float64(-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 <= 4.7e-92) 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, 4.7e-92], 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.7 \cdot 10^{-92}:\\
\;\;\;\;\frac{\frac{x + 1}{e^{x}} + \left(x + 1\right) \cdot 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 < 4.69999999999999993e-92Initial program 63.7%
fma-neg63.7%
/-rgt-identity63.7%
fma-neg63.7%
/-rgt-identity63.7%
distribute-rgt-neg-in63.7%
sub-neg63.7%
metadata-eval63.7%
distribute-rgt-neg-in63.7%
Simplified63.7%
Taylor expanded in eps around 0 68.6%
Simplified69.3%
exp-neg69.3%
un-div-inv69.3%
Applied egg-rr69.3%
if 4.69999999999999993e-92 < eps Initial program 89.8%
fma-neg89.8%
/-rgt-identity89.8%
fma-neg89.8%
/-rgt-identity89.8%
distribute-rgt-neg-in89.8%
sub-neg89.8%
metadata-eval89.8%
distribute-rgt-neg-in89.8%
Simplified89.8%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
*-commutative100.0%
sub-neg100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-*r*100.0%
neg-mul-1100.0%
neg-mul-1100.0%
sub-neg100.0%
mul-1-neg100.0%
associate-*r*100.0%
neg-mul-1100.0%
Simplified100.0%
Final simplification81.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 7.2e+66)
(/ (+ (exp (* x (- eps_m))) (exp (* x eps_m))) 2.0)
(if (<= x 8.3e+133)
(/ (/ x (exp x)) 2.0)
(/ (+ 1.0 (exp (* x (+ -1.0 eps_m)))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 7.2e+66) {
tmp = (exp((x * -eps_m)) + exp((x * eps_m))) / 2.0;
} else if (x <= 8.3e+133) {
tmp = (x / exp(x)) / 2.0;
} else {
tmp = (1.0 + exp((x * (-1.0 + eps_m)))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 7.2d+66) then
tmp = (exp((x * -eps_m)) + exp((x * eps_m))) / 2.0d0
else if (x <= 8.3d+133) then
tmp = (x / exp(x)) / 2.0d0
else
tmp = (1.0d0 + exp((x * ((-1.0d0) + eps_m)))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 7.2e+66) {
tmp = (Math.exp((x * -eps_m)) + Math.exp((x * eps_m))) / 2.0;
} else if (x <= 8.3e+133) {
tmp = (x / Math.exp(x)) / 2.0;
} else {
tmp = (1.0 + Math.exp((x * (-1.0 + eps_m)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 7.2e+66: tmp = (math.exp((x * -eps_m)) + math.exp((x * eps_m))) / 2.0 elif x <= 8.3e+133: tmp = (x / math.exp(x)) / 2.0 else: tmp = (1.0 + math.exp((x * (-1.0 + eps_m)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 7.2e+66) tmp = Float64(Float64(exp(Float64(x * Float64(-eps_m))) + exp(Float64(x * eps_m))) / 2.0); elseif (x <= 8.3e+133) tmp = Float64(Float64(x / exp(x)) / 2.0); else tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 + eps_m)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 7.2e+66) tmp = (exp((x * -eps_m)) + exp((x * eps_m))) / 2.0; elseif (x <= 8.3e+133) tmp = (x / exp(x)) / 2.0; else tmp = (1.0 + exp((x * (-1.0 + eps_m)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 7.2e+66], N[(N[(N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 8.3e+133], N[(N[(x / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7.2 \cdot 10^{+66}:\\
\;\;\;\;\frac{e^{x \cdot \left(-eps_m\right)} + e^{x \cdot eps_m}}{2}\\
\mathbf{elif}\;x \leq 8.3 \cdot 10^{+133}:\\
\;\;\;\;\frac{\frac{x}{e^{x}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 + eps_m\right)}}{2}\\
\end{array}
\end{array}
if x < 7.2e66Initial program 66.2%
fma-neg66.2%
/-rgt-identity66.2%
fma-neg66.2%
/-rgt-identity66.2%
distribute-rgt-neg-in66.2%
sub-neg66.2%
metadata-eval66.2%
distribute-rgt-neg-in66.2%
Simplified66.2%
Taylor expanded in eps around inf 98.6%
Taylor expanded in eps around inf 96.2%
*-commutative96.2%
Simplified96.2%
Taylor expanded in x around inf 96.2%
*-commutative96.2%
sub-neg96.2%
neg-mul-196.2%
*-commutative96.2%
associate-*r*96.2%
neg-mul-196.2%
neg-mul-196.2%
sub-neg96.2%
mul-1-neg96.2%
associate-*r*96.2%
neg-mul-196.2%
Simplified96.2%
Taylor expanded in eps around inf 96.6%
if 7.2e66 < x < 8.29999999999999953e133Initial 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 0 74.3%
Simplified74.3%
Taylor expanded in x around 0 3.1%
Taylor expanded in x around inf 74.3%
exp-neg74.3%
associate-*r/74.3%
*-rgt-identity74.3%
Simplified74.3%
if 8.29999999999999953e133 < 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 38.4%
Taylor expanded in eps around inf 38.8%
neg-mul-138.8%
neg-sub038.8%
sub-neg38.8%
distribute-rgt-in38.8%
*-lft-identity38.8%
cancel-sign-sub-inv38.8%
associate-+l-38.8%
neg-sub038.8%
neg-mul-138.8%
distribute-rgt-out38.8%
Simplified38.8%
Final simplification86.0%
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 74.3%
fma-neg74.3%
/-rgt-identity74.3%
fma-neg74.3%
/-rgt-identity74.3%
distribute-rgt-neg-in74.3%
sub-neg74.3%
metadata-eval74.3%
distribute-rgt-neg-in74.3%
Simplified74.3%
Taylor expanded in eps around inf 99.0%
Final simplification99.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* x (+ -1.0 eps_m))) (exp (* x (- eps_m)))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * (-1.0 + eps_m))) + exp((x * -eps_m))) / 2.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = (exp((x * ((-1.0d0) + eps_m))) + exp((x * -eps_m))) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return (Math.exp((x * (-1.0 + eps_m))) + Math.exp((x * -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 * -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(-eps_m)))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((x * (-1.0 + eps_m))) + exp((x * -eps_m))) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * (-eps$95$m)), $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(-eps_m\right)}}{2}
\end{array}
Initial program 74.3%
fma-neg74.3%
/-rgt-identity74.3%
fma-neg74.3%
/-rgt-identity74.3%
distribute-rgt-neg-in74.3%
sub-neg74.3%
metadata-eval74.3%
distribute-rgt-neg-in74.3%
Simplified74.3%
Taylor expanded in eps around inf 99.0%
Taylor expanded in eps around inf 88.0%
*-commutative88.0%
Simplified88.0%
Taylor expanded in x around inf 88.0%
*-commutative88.0%
sub-neg88.0%
neg-mul-188.0%
*-commutative88.0%
associate-*r*88.0%
neg-mul-188.0%
neg-mul-188.0%
sub-neg88.0%
mul-1-neg88.0%
associate-*r*88.0%
neg-mul-188.0%
Simplified88.0%
Final simplification88.0%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -7.4e-225)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (or (<= x 4.6e+66) (not (<= x 1.06e+134)))
(/ (+ 1.0 (exp (* x (+ -1.0 eps_m)))) 2.0)
(/ (/ x (exp x)) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -7.4e-225) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if ((x <= 4.6e+66) || !(x <= 1.06e+134)) {
tmp = (1.0 + exp((x * (-1.0 + eps_m)))) / 2.0;
} else {
tmp = (x / exp(x)) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-7.4d-225)) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if ((x <= 4.6d+66) .or. (.not. (x <= 1.06d+134))) then
tmp = (1.0d0 + exp((x * ((-1.0d0) + eps_m)))) / 2.0d0
else
tmp = (x / exp(x)) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -7.4e-225) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if ((x <= 4.6e+66) || !(x <= 1.06e+134)) {
tmp = (1.0 + Math.exp((x * (-1.0 + eps_m)))) / 2.0;
} else {
tmp = (x / Math.exp(x)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -7.4e-225: tmp = (1.0 + math.exp(-x)) / 2.0 elif (x <= 4.6e+66) or not (x <= 1.06e+134): tmp = (1.0 + math.exp((x * (-1.0 + eps_m)))) / 2.0 else: tmp = (x / math.exp(x)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -7.4e-225) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif ((x <= 4.6e+66) || !(x <= 1.06e+134)) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 + eps_m)))) / 2.0); else tmp = Float64(Float64(x / exp(x)) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -7.4e-225) tmp = (1.0 + exp(-x)) / 2.0; elseif ((x <= 4.6e+66) || ~((x <= 1.06e+134))) tmp = (1.0 + exp((x * (-1.0 + eps_m)))) / 2.0; else tmp = (x / exp(x)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -7.4e-225], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 4.6e+66], N[Not[LessEqual[x, 1.06e+134]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.4 \cdot 10^{-225}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{+66} \lor \neg \left(x \leq 1.06 \cdot 10^{+134}\right):\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 + eps_m\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{e^{x}}}{2}\\
\end{array}
\end{array}
if x < -7.39999999999999976e-225Initial program 72.8%
fma-neg72.8%
/-rgt-identity72.8%
fma-neg72.8%
/-rgt-identity72.8%
distribute-rgt-neg-in72.8%
sub-neg72.8%
metadata-eval72.8%
distribute-rgt-neg-in72.8%
Simplified72.8%
Taylor expanded in eps around inf 97.5%
Taylor expanded in eps around inf 97.5%
*-commutative97.5%
Simplified97.5%
Taylor expanded in eps around 0 81.9%
neg-mul-181.9%
Simplified81.9%
if -7.39999999999999976e-225 < x < 4.6e66 or 1.05999999999999999e134 < x Initial program 70.9%
fma-neg70.9%
/-rgt-identity70.9%
fma-neg70.9%
/-rgt-identity70.9%
distribute-rgt-neg-in70.9%
sub-neg70.9%
metadata-eval70.9%
distribute-rgt-neg-in70.9%
Simplified70.9%
Taylor expanded in x around 0 42.1%
Taylor expanded in eps around inf 71.3%
neg-mul-171.3%
neg-sub071.3%
sub-neg71.3%
distribute-rgt-in71.3%
*-lft-identity71.3%
cancel-sign-sub-inv71.3%
associate-+l-71.3%
neg-sub071.3%
neg-mul-171.3%
distribute-rgt-out71.3%
Simplified71.3%
if 4.6e66 < x < 1.05999999999999999e134Initial 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 0 74.3%
Simplified74.3%
Taylor expanded in x around 0 3.1%
Taylor expanded in x around inf 74.3%
exp-neg74.3%
associate-*r/74.3%
*-rgt-identity74.3%
Simplified74.3%
Final simplification75.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (* x (+ -1.0 eps_m)))))
(if (<= x -2500.0)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (<= x 3e+66)
(/ (+ 1.0 (- t_0 (* x eps_m))) 2.0)
(if (<= x 1e+134) (/ (/ x (exp x)) 2.0) (/ (+ 1.0 t_0) 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 <= -2500.0) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 3e+66) {
tmp = (1.0 + (t_0 - (x * eps_m))) / 2.0;
} else if (x <= 1e+134) {
tmp = (x / exp(x)) / 2.0;
} else {
tmp = (1.0 + 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 = exp((x * ((-1.0d0) + eps_m)))
if (x <= (-2500.0d0)) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= 3d+66) then
tmp = (1.0d0 + (t_0 - (x * eps_m))) / 2.0d0
else if (x <= 1d+134) then
tmp = (x / exp(x)) / 2.0d0
else
tmp = (1.0d0 + 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 = Math.exp((x * (-1.0 + eps_m)));
double tmp;
if (x <= -2500.0) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 3e+66) {
tmp = (1.0 + (t_0 - (x * eps_m))) / 2.0;
} else if (x <= 1e+134) {
tmp = (x / Math.exp(x)) / 2.0;
} else {
tmp = (1.0 + t_0) / 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 <= -2500.0: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 3e+66: tmp = (1.0 + (t_0 - (x * eps_m))) / 2.0 elif x <= 1e+134: tmp = (x / math.exp(x)) / 2.0 else: tmp = (1.0 + t_0) / 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 <= -2500.0) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 3e+66) tmp = Float64(Float64(1.0 + Float64(t_0 - Float64(x * eps_m))) / 2.0); elseif (x <= 1e+134) tmp = Float64(Float64(x / exp(x)) / 2.0); else tmp = Float64(Float64(1.0 + t_0) / 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 <= -2500.0) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= 3e+66) tmp = (1.0 + (t_0 - (x * eps_m))) / 2.0; elseif (x <= 1e+134) tmp = (x / exp(x)) / 2.0; else tmp = (1.0 + 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[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -2500.0], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 3e+66], N[(N[(1.0 + N[(t$95$0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1e+134], N[(N[(x / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + t$95$0), $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 -2500:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 3 \cdot 10^{+66}:\\
\;\;\;\;\frac{1 + \left(t_0 - x \cdot eps_m\right)}{2}\\
\mathbf{elif}\;x \leq 10^{+134}:\\
\;\;\;\;\frac{\frac{x}{e^{x}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + t_0}{2}\\
\end{array}
\end{array}
if x < -2500Initial 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 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in eps around 0 100.0%
neg-mul-1100.0%
Simplified100.0%
if -2500 < x < 3.00000000000000002e66Initial program 57.2%
fma-neg57.2%
/-rgt-identity57.2%
fma-neg57.2%
/-rgt-identity57.2%
distribute-rgt-neg-in57.2%
sub-neg57.2%
metadata-eval57.2%
distribute-rgt-neg-in57.2%
Simplified57.2%
Taylor expanded in x around 0 42.2%
Taylor expanded in eps around inf 82.7%
exp-prod82.7%
sub-neg82.7%
neg-mul-182.7%
exp-prod82.7%
exp-prod82.7%
neg-mul-182.7%
sub-neg82.7%
exp-prod82.7%
mul-1-neg82.7%
unsub-neg82.7%
Simplified82.7%
if 3.00000000000000002e66 < x < 9.99999999999999921e133Initial 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 0 74.3%
Simplified74.3%
Taylor expanded in x around 0 3.1%
Taylor expanded in x around inf 74.3%
exp-neg74.3%
associate-*r/74.3%
*-rgt-identity74.3%
Simplified74.3%
if 9.99999999999999921e133 < 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 38.4%
Taylor expanded in eps around inf 38.8%
neg-mul-138.8%
neg-sub038.8%
sub-neg38.8%
distribute-rgt-in38.8%
*-lft-identity38.8%
cancel-sign-sub-inv38.8%
associate-+l-38.8%
neg-sub038.8%
neg-mul-138.8%
distribute-rgt-out38.8%
Simplified38.8%
Final simplification78.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (* x (+ -1.0 eps_m)))))
(if (<= x -1.9e-53)
(/
(+
(+ 1.0 (/ 1.0 eps_m))
(* (exp (* x (- -1.0 eps_m))) (+ 1.0 (/ -1.0 eps_m))))
2.0)
(if (<= x 7.2e+66)
(/ (+ 1.0 (- t_0 (* x eps_m))) 2.0)
(if (<= x 8.3e+133) (/ (/ x (exp x)) 2.0) (/ (+ 1.0 t_0) 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 <= -1.9e-53) {
tmp = ((1.0 + (1.0 / eps_m)) + (exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m)))) / 2.0;
} else if (x <= 7.2e+66) {
tmp = (1.0 + (t_0 - (x * eps_m))) / 2.0;
} else if (x <= 8.3e+133) {
tmp = (x / exp(x)) / 2.0;
} else {
tmp = (1.0 + 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 = exp((x * ((-1.0d0) + eps_m)))
if (x <= (-1.9d-53)) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (exp((x * ((-1.0d0) - eps_m))) * (1.0d0 + ((-1.0d0) / eps_m)))) / 2.0d0
else if (x <= 7.2d+66) then
tmp = (1.0d0 + (t_0 - (x * eps_m))) / 2.0d0
else if (x <= 8.3d+133) then
tmp = (x / exp(x)) / 2.0d0
else
tmp = (1.0d0 + 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 = Math.exp((x * (-1.0 + eps_m)));
double tmp;
if (x <= -1.9e-53) {
tmp = ((1.0 + (1.0 / eps_m)) + (Math.exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m)))) / 2.0;
} else if (x <= 7.2e+66) {
tmp = (1.0 + (t_0 - (x * eps_m))) / 2.0;
} else if (x <= 8.3e+133) {
tmp = (x / Math.exp(x)) / 2.0;
} else {
tmp = (1.0 + t_0) / 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 <= -1.9e-53: tmp = ((1.0 + (1.0 / eps_m)) + (math.exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m)))) / 2.0 elif x <= 7.2e+66: tmp = (1.0 + (t_0 - (x * eps_m))) / 2.0 elif x <= 8.3e+133: tmp = (x / math.exp(x)) / 2.0 else: tmp = (1.0 + t_0) / 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 <= -1.9e-53) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(exp(Float64(x * Float64(-1.0 - eps_m))) * Float64(1.0 + Float64(-1.0 / eps_m)))) / 2.0); elseif (x <= 7.2e+66) tmp = Float64(Float64(1.0 + Float64(t_0 - Float64(x * eps_m))) / 2.0); elseif (x <= 8.3e+133) tmp = Float64(Float64(x / exp(x)) / 2.0); else tmp = Float64(Float64(1.0 + t_0) / 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 <= -1.9e-53) tmp = ((1.0 + (1.0 / eps_m)) + (exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m)))) / 2.0; elseif (x <= 7.2e+66) tmp = (1.0 + (t_0 - (x * eps_m))) / 2.0; elseif (x <= 8.3e+133) tmp = (x / exp(x)) / 2.0; else tmp = (1.0 + 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[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -1.9e-53], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + 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]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 7.2e+66], N[(N[(1.0 + N[(t$95$0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 8.3e+133], N[(N[(x / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + t$95$0), $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.9 \cdot 10^{-53}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps_m}\right) + e^{x \cdot \left(-1 - eps_m\right)} \cdot \left(1 + \frac{-1}{eps_m}\right)}{2}\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{+66}:\\
\;\;\;\;\frac{1 + \left(t_0 - x \cdot eps_m\right)}{2}\\
\mathbf{elif}\;x \leq 8.3 \cdot 10^{+133}:\\
\;\;\;\;\frac{\frac{x}{e^{x}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + t_0}{2}\\
\end{array}
\end{array}
if x < -1.8999999999999999e-53Initial program 89.2%
fma-neg89.2%
/-rgt-identity89.2%
fma-neg89.2%
/-rgt-identity89.2%
distribute-rgt-neg-in89.2%
sub-neg89.2%
metadata-eval89.2%
distribute-rgt-neg-in89.2%
Simplified89.2%
Taylor expanded in x around 0 46.1%
if -1.8999999999999999e-53 < x < 7.2e66Initial program 57.4%
fma-neg57.4%
/-rgt-identity57.4%
fma-neg57.4%
/-rgt-identity57.4%
distribute-rgt-neg-in57.4%
sub-neg57.4%
metadata-eval57.4%
distribute-rgt-neg-in57.4%
Simplified57.4%
Taylor expanded in x around 0 43.1%
Taylor expanded in eps around inf 85.6%
exp-prod85.6%
sub-neg85.6%
neg-mul-185.6%
exp-prod85.6%
exp-prod85.6%
neg-mul-185.6%
sub-neg85.6%
exp-prod85.6%
mul-1-neg85.6%
unsub-neg85.6%
Simplified85.6%
if 7.2e66 < x < 8.29999999999999953e133Initial 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 0 74.3%
Simplified74.3%
Taylor expanded in x around 0 3.1%
Taylor expanded in x around inf 74.3%
exp-neg74.3%
associate-*r/74.3%
*-rgt-identity74.3%
Simplified74.3%
if 8.29999999999999953e133 < 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 38.4%
Taylor expanded in eps around inf 38.8%
neg-mul-138.8%
neg-sub038.8%
sub-neg38.8%
distribute-rgt-in38.8%
*-lft-identity38.8%
cancel-sign-sub-inv38.8%
associate-+l-38.8%
neg-sub038.8%
neg-mul-138.8%
distribute-rgt-out38.8%
Simplified38.8%
Final simplification69.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 5e-6)
(/ (- 2.0 (* x eps_m)) 2.0)
(if (<= x 7.2e+229)
(/ (/ x (exp x)) 2.0)
(if (<= x 1.2e+277)
(/ (* x eps_m) 2.0)
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 5e-6) {
tmp = (2.0 - (x * eps_m)) / 2.0;
} else if (x <= 7.2e+229) {
tmp = (x / exp(x)) / 2.0;
} else if (x <= 1.2e+277) {
tmp = (x * eps_m) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 5d-6) then
tmp = (2.0d0 - (x * eps_m)) / 2.0d0
else if (x <= 7.2d+229) then
tmp = (x / exp(x)) / 2.0d0
else if (x <= 1.2d+277) then
tmp = (x * eps_m) / 2.0d0
else
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 + ((-1.0d0) / eps_m))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 5e-6) {
tmp = (2.0 - (x * eps_m)) / 2.0;
} else if (x <= 7.2e+229) {
tmp = (x / Math.exp(x)) / 2.0;
} else if (x <= 1.2e+277) {
tmp = (x * eps_m) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 5e-6: tmp = (2.0 - (x * eps_m)) / 2.0 elif x <= 7.2e+229: tmp = (x / math.exp(x)) / 2.0 elif x <= 1.2e+277: tmp = (x * eps_m) / 2.0 else: tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 5e-6) tmp = Float64(Float64(2.0 - Float64(x * eps_m)) / 2.0); elseif (x <= 7.2e+229) tmp = Float64(Float64(x / exp(x)) / 2.0); elseif (x <= 1.2e+277) tmp = Float64(Float64(x * eps_m) / 2.0); else tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 5e-6) tmp = (2.0 - (x * eps_m)) / 2.0; elseif (x <= 7.2e+229) tmp = (x / exp(x)) / 2.0; elseif (x <= 1.2e+277) tmp = (x * eps_m) / 2.0; else tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 5e-6], N[(N[(2.0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 7.2e+229], N[(N[(x / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.2e+277], N[(N[(x * eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5 \cdot 10^{-6}:\\
\;\;\;\;\frac{2 - x \cdot eps_m}{2}\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{+229}:\\
\;\;\;\;\frac{\frac{x}{e^{x}}}{2}\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{+277}:\\
\;\;\;\;\frac{x \cdot eps_m}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps_m}\right) + \left(1 + \frac{-1}{eps_m}\right)}{2}\\
\end{array}
\end{array}
if x < 5.00000000000000041e-6Initial program 63.4%
fma-neg63.4%
/-rgt-identity63.4%
fma-neg63.4%
/-rgt-identity63.4%
distribute-rgt-neg-in63.4%
sub-neg63.4%
metadata-eval63.4%
distribute-rgt-neg-in63.4%
Simplified63.4%
Taylor expanded in x around 0 42.9%
Taylor expanded in x around 0 43.8%
mul-1-neg43.8%
unsub-neg43.8%
*-commutative43.8%
associate-*r*43.8%
Simplified43.8%
Taylor expanded in eps around inf 63.3%
add-sqr-sqrt34.7%
sqrt-unprod61.2%
sqr-neg61.2%
sqrt-unprod22.5%
add-sqr-sqrt64.7%
cancel-sign-sub-inv64.7%
Applied egg-rr64.7%
if 5.00000000000000041e-6 < x < 7.19999999999999973e229Initial 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 0 54.5%
Simplified54.5%
Taylor expanded in x around 0 3.1%
Taylor expanded in x around inf 54.5%
exp-neg54.5%
associate-*r/54.5%
*-rgt-identity54.5%
Simplified54.5%
if 7.19999999999999973e229 < x < 1.19999999999999996e277Initial 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 61.0%
Taylor expanded in x around 0 51.4%
mul-1-neg51.4%
unsub-neg51.4%
*-commutative51.4%
associate-*r*51.4%
Simplified51.4%
Taylor expanded in eps around inf 51.7%
if 1.19999999999999996e277 < 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 18.7%
Taylor expanded in x around 0 59.6%
Final simplification61.8%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 620.0)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (<= x 7.2e+229)
(/ (/ x (exp x)) 2.0)
(if (<= x 1.45e+277)
(/ (* x eps_m) 2.0)
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 620.0) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 7.2e+229) {
tmp = (x / exp(x)) / 2.0;
} else if (x <= 1.45e+277) {
tmp = (x * eps_m) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 620.0d0) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= 7.2d+229) then
tmp = (x / exp(x)) / 2.0d0
else if (x <= 1.45d+277) then
tmp = (x * eps_m) / 2.0d0
else
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 + ((-1.0d0) / eps_m))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 620.0) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 7.2e+229) {
tmp = (x / Math.exp(x)) / 2.0;
} else if (x <= 1.45e+277) {
tmp = (x * eps_m) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 620.0: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 7.2e+229: tmp = (x / math.exp(x)) / 2.0 elif x <= 1.45e+277: tmp = (x * eps_m) / 2.0 else: tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 620.0) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 7.2e+229) tmp = Float64(Float64(x / exp(x)) / 2.0); elseif (x <= 1.45e+277) tmp = Float64(Float64(x * eps_m) / 2.0); else tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 620.0) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= 7.2e+229) tmp = (x / exp(x)) / 2.0; elseif (x <= 1.45e+277) tmp = (x * eps_m) / 2.0; else tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 620.0], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 7.2e+229], N[(N[(x / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.45e+277], N[(N[(x * eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 620:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{+229}:\\
\;\;\;\;\frac{\frac{x}{e^{x}}}{2}\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{+277}:\\
\;\;\;\;\frac{x \cdot eps_m}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps_m}\right) + \left(1 + \frac{-1}{eps_m}\right)}{2}\\
\end{array}
\end{array}
if x < 620Initial 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 98.5%
Taylor expanded in eps around inf 98.6%
*-commutative98.6%
Simplified98.6%
Taylor expanded in eps around 0 79.4%
neg-mul-179.4%
Simplified79.4%
if 620 < x < 7.19999999999999973e229Initial 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 0 56.5%
Simplified56.5%
Taylor expanded in x around 0 3.1%
Taylor expanded in x around inf 56.5%
exp-neg56.5%
associate-*r/56.5%
*-rgt-identity56.5%
Simplified56.5%
if 7.19999999999999973e229 < x < 1.44999999999999992e277Initial 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 61.0%
Taylor expanded in x around 0 51.4%
mul-1-neg51.4%
unsub-neg51.4%
*-commutative51.4%
associate-*r*51.4%
Simplified51.4%
Taylor expanded in eps around inf 51.7%
if 1.44999999999999992e277 < 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 18.7%
Taylor expanded in x around 0 59.6%
Final simplification72.8%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 5e-6)
(/ (- 2.0 (* x eps_m)) 2.0)
(if (or (<= x 2.2e+230) (not (<= x 9.5e+276)))
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0)
(/ (* x eps_m) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 5e-6) {
tmp = (2.0 - (x * eps_m)) / 2.0;
} else if ((x <= 2.2e+230) || !(x <= 9.5e+276)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 5d-6) then
tmp = (2.0d0 - (x * eps_m)) / 2.0d0
else if ((x <= 2.2d+230) .or. (.not. (x <= 9.5d+276))) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 + ((-1.0d0) / eps_m))) / 2.0d0
else
tmp = (x * eps_m) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 5e-6) {
tmp = (2.0 - (x * eps_m)) / 2.0;
} else if ((x <= 2.2e+230) || !(x <= 9.5e+276)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 5e-6: tmp = (2.0 - (x * eps_m)) / 2.0 elif (x <= 2.2e+230) or not (x <= 9.5e+276): tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 else: tmp = (x * eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 5e-6) tmp = Float64(Float64(2.0 - Float64(x * eps_m)) / 2.0); elseif ((x <= 2.2e+230) || !(x <= 9.5e+276)) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(x * eps_m) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 5e-6) tmp = (2.0 - (x * eps_m)) / 2.0; elseif ((x <= 2.2e+230) || ~((x <= 9.5e+276))) tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0; else tmp = (x * eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 5e-6], N[(N[(2.0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 2.2e+230], N[Not[LessEqual[x, 9.5e+276]], $MachinePrecision]], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x * eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5 \cdot 10^{-6}:\\
\;\;\;\;\frac{2 - x \cdot eps_m}{2}\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{+230} \lor \neg \left(x \leq 9.5 \cdot 10^{+276}\right):\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps_m}\right) + \left(1 + \frac{-1}{eps_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps_m}{2}\\
\end{array}
\end{array}
if x < 5.00000000000000041e-6Initial program 63.4%
fma-neg63.4%
/-rgt-identity63.4%
fma-neg63.4%
/-rgt-identity63.4%
distribute-rgt-neg-in63.4%
sub-neg63.4%
metadata-eval63.4%
distribute-rgt-neg-in63.4%
Simplified63.4%
Taylor expanded in x around 0 42.9%
Taylor expanded in x around 0 43.8%
mul-1-neg43.8%
unsub-neg43.8%
*-commutative43.8%
associate-*r*43.8%
Simplified43.8%
Taylor expanded in eps around inf 63.3%
add-sqr-sqrt34.7%
sqrt-unprod61.2%
sqr-neg61.2%
sqrt-unprod22.5%
add-sqr-sqrt64.7%
cancel-sign-sub-inv64.7%
Applied egg-rr64.7%
if 5.00000000000000041e-6 < x < 2.2000000000000001e230 or 9.50000000000000013e276 < 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 30.5%
Taylor expanded in x around 0 53.0%
if 2.2000000000000001e230 < x < 9.50000000000000013e276Initial 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 61.0%
Taylor expanded in x around 0 51.4%
mul-1-neg51.4%
unsub-neg51.4%
*-commutative51.4%
associate-*r*51.4%
Simplified51.4%
Taylor expanded in eps around inf 51.7%
Final simplification61.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.0) (* (* x eps_m) -0.5) (if (<= x 5e-6) 1.0 (/ (* x eps_m) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.0) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 5e-6) {
tmp = 1.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-1.0d0)) then
tmp = (x * eps_m) * (-0.5d0)
else if (x <= 5d-6) then
tmp = 1.0d0
else
tmp = (x * eps_m) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1.0) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 5e-6) {
tmp = 1.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.0: tmp = (x * eps_m) * -0.5 elif x <= 5e-6: tmp = 1.0 else: tmp = (x * eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.0) tmp = Float64(Float64(x * eps_m) * -0.5); elseif (x <= 5e-6) tmp = 1.0; else tmp = Float64(Float64(x * eps_m) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.0) tmp = (x * eps_m) * -0.5; elseif (x <= 5e-6) tmp = 1.0; else tmp = (x * eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.0], N[(N[(x * eps$95$m), $MachinePrecision] * -0.5), $MachinePrecision], If[LessEqual[x, 5e-6], 1.0, N[(N[(x * eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\left(x \cdot eps_m\right) \cdot -0.5\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-6}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps_m}{2}\\
\end{array}
\end{array}
if x < -1Initial program 97.7%
fma-neg97.7%
/-rgt-identity97.7%
fma-neg97.7%
/-rgt-identity97.7%
distribute-rgt-neg-in97.7%
sub-neg97.7%
metadata-eval97.7%
distribute-rgt-neg-in97.7%
Simplified97.7%
Taylor expanded in x around 0 52.7%
Taylor expanded in x around 0 25.6%
mul-1-neg25.6%
unsub-neg25.6%
*-commutative25.6%
associate-*r*25.6%
Simplified25.6%
Taylor expanded in eps around inf 25.3%
frac-2neg25.3%
distribute-lft-neg-out25.3%
div-inv25.3%
add-sqr-sqrt25.2%
sqrt-unprod67.3%
sqr-neg67.3%
sqrt-unprod31.4%
add-sqr-sqrt31.5%
metadata-eval31.5%
metadata-eval31.5%
Applied egg-rr31.5%
if -1 < x < 5.00000000000000041e-6Initial program 52.6%
fma-neg52.6%
/-rgt-identity52.6%
fma-neg52.6%
/-rgt-identity52.6%
distribute-rgt-neg-in52.6%
sub-neg52.6%
metadata-eval52.6%
distribute-rgt-neg-in52.6%
Simplified52.6%
Taylor expanded in x around 0 76.1%
if 5.00000000000000041e-6 < 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.5%
Taylor expanded in x around 0 14.1%
mul-1-neg14.1%
unsub-neg14.1%
*-commutative14.1%
associate-*r*14.1%
Simplified14.1%
Taylor expanded in eps around inf 14.9%
Final simplification50.5%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -0.45) (* (* x eps_m) -0.5) (/ (+ 2.0 (* x eps_m)) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -0.45) {
tmp = (x * eps_m) * -0.5;
} else {
tmp = (2.0 + (x * eps_m)) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-0.45d0)) then
tmp = (x * eps_m) * (-0.5d0)
else
tmp = (2.0d0 + (x * eps_m)) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -0.45) {
tmp = (x * eps_m) * -0.5;
} else {
tmp = (2.0 + (x * eps_m)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -0.45: tmp = (x * eps_m) * -0.5 else: tmp = (2.0 + (x * eps_m)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -0.45) tmp = Float64(Float64(x * eps_m) * -0.5); else tmp = Float64(Float64(2.0 + Float64(x * eps_m)) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -0.45) tmp = (x * eps_m) * -0.5; else tmp = (2.0 + (x * eps_m)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -0.45], N[(N[(x * eps$95$m), $MachinePrecision] * -0.5), $MachinePrecision], N[(N[(2.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.45:\\
\;\;\;\;\left(x \cdot eps_m\right) \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot eps_m}{2}\\
\end{array}
\end{array}
if x < -0.450000000000000011Initial program 97.7%
fma-neg97.7%
/-rgt-identity97.7%
fma-neg97.7%
/-rgt-identity97.7%
distribute-rgt-neg-in97.7%
sub-neg97.7%
metadata-eval97.7%
distribute-rgt-neg-in97.7%
Simplified97.7%
Taylor expanded in x around 0 52.7%
Taylor expanded in x around 0 25.6%
mul-1-neg25.6%
unsub-neg25.6%
*-commutative25.6%
associate-*r*25.6%
Simplified25.6%
Taylor expanded in eps around inf 25.3%
frac-2neg25.3%
distribute-lft-neg-out25.3%
div-inv25.3%
add-sqr-sqrt25.2%
sqrt-unprod67.3%
sqr-neg67.3%
sqrt-unprod31.4%
add-sqr-sqrt31.5%
metadata-eval31.5%
metadata-eval31.5%
Applied egg-rr31.5%
if -0.450000000000000011 < x Initial program 69.5%
fma-neg69.5%
/-rgt-identity69.5%
fma-neg69.5%
/-rgt-identity69.5%
distribute-rgt-neg-in69.5%
sub-neg69.5%
metadata-eval69.5%
distribute-rgt-neg-in69.5%
Simplified69.5%
Taylor expanded in x around 0 38.0%
Taylor expanded in x around 0 36.9%
mul-1-neg36.9%
unsub-neg36.9%
*-commutative36.9%
associate-*r*36.9%
Simplified36.9%
Taylor expanded in eps around inf 53.6%
Final simplification49.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -8e-225) (/ (- 2.0 (* x eps_m)) 2.0) (/ (+ 2.0 (* x eps_m)) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -8e-225) {
tmp = (2.0 - (x * eps_m)) / 2.0;
} else {
tmp = (2.0 + (x * eps_m)) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-8d-225)) then
tmp = (2.0d0 - (x * eps_m)) / 2.0d0
else
tmp = (2.0d0 + (x * eps_m)) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -8e-225) {
tmp = (2.0 - (x * eps_m)) / 2.0;
} else {
tmp = (2.0 + (x * eps_m)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -8e-225: tmp = (2.0 - (x * eps_m)) / 2.0 else: tmp = (2.0 + (x * eps_m)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -8e-225) tmp = Float64(Float64(2.0 - Float64(x * eps_m)) / 2.0); else tmp = Float64(Float64(2.0 + Float64(x * eps_m)) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -8e-225) tmp = (2.0 - (x * eps_m)) / 2.0; else tmp = (2.0 + (x * eps_m)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -8e-225], N[(N[(2.0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8 \cdot 10^{-225}:\\
\;\;\;\;\frac{2 - x \cdot eps_m}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot eps_m}{2}\\
\end{array}
\end{array}
if x < -7.9999999999999997e-225Initial program 72.8%
fma-neg72.8%
/-rgt-identity72.8%
fma-neg72.8%
/-rgt-identity72.8%
distribute-rgt-neg-in72.8%
sub-neg72.8%
metadata-eval72.8%
distribute-rgt-neg-in72.8%
Simplified72.8%
Taylor expanded in x around 0 44.0%
Taylor expanded in x around 0 37.9%
mul-1-neg37.9%
unsub-neg37.9%
*-commutative37.9%
associate-*r*37.9%
Simplified37.9%
Taylor expanded in eps around inf 51.7%
add-sqr-sqrt25.8%
sqrt-unprod40.0%
sqr-neg40.0%
sqrt-unprod14.8%
add-sqr-sqrt54.4%
cancel-sign-sub-inv54.4%
Applied egg-rr54.4%
if -7.9999999999999997e-225 < x Initial program 75.2%
fma-neg75.2%
/-rgt-identity75.2%
fma-neg75.2%
/-rgt-identity75.2%
distribute-rgt-neg-in75.2%
sub-neg75.2%
metadata-eval75.2%
distribute-rgt-neg-in75.2%
Simplified75.2%
Taylor expanded in x around 0 38.1%
Taylor expanded in x around 0 33.2%
mul-1-neg33.2%
unsub-neg33.2%
*-commutative33.2%
associate-*r*33.2%
Simplified33.2%
Taylor expanded in eps around inf 47.0%
Final simplification49.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.0) (* (* x eps_m) -0.5) 1.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.0) {
tmp = (x * eps_m) * -0.5;
} 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 <= (-1.0d0)) then
tmp = (x * eps_m) * (-0.5d0)
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 <= -1.0) {
tmp = (x * eps_m) * -0.5;
} else {
tmp = 1.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.0: tmp = (x * eps_m) * -0.5 else: tmp = 1.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.0) tmp = Float64(Float64(x * eps_m) * -0.5); else tmp = 1.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.0) tmp = (x * eps_m) * -0.5; else tmp = 1.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.0], N[(N[(x * eps$95$m), $MachinePrecision] * -0.5), $MachinePrecision], 1.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\left(x \cdot eps_m\right) \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1Initial program 97.7%
fma-neg97.7%
/-rgt-identity97.7%
fma-neg97.7%
/-rgt-identity97.7%
distribute-rgt-neg-in97.7%
sub-neg97.7%
metadata-eval97.7%
distribute-rgt-neg-in97.7%
Simplified97.7%
Taylor expanded in x around 0 52.7%
Taylor expanded in x around 0 25.6%
mul-1-neg25.6%
unsub-neg25.6%
*-commutative25.6%
associate-*r*25.6%
Simplified25.6%
Taylor expanded in eps around inf 25.3%
frac-2neg25.3%
distribute-lft-neg-out25.3%
div-inv25.3%
add-sqr-sqrt25.2%
sqrt-unprod67.3%
sqr-neg67.3%
sqrt-unprod31.4%
add-sqr-sqrt31.5%
metadata-eval31.5%
metadata-eval31.5%
Applied egg-rr31.5%
if -1 < x Initial program 69.5%
fma-neg69.5%
/-rgt-identity69.5%
fma-neg69.5%
/-rgt-identity69.5%
distribute-rgt-neg-in69.5%
sub-neg69.5%
metadata-eval69.5%
distribute-rgt-neg-in69.5%
Simplified69.5%
Taylor expanded in x around 0 50.1%
Final simplification47.0%
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 74.3%
fma-neg74.3%
/-rgt-identity74.3%
fma-neg74.3%
/-rgt-identity74.3%
distribute-rgt-neg-in74.3%
sub-neg74.3%
metadata-eval74.3%
distribute-rgt-neg-in74.3%
Simplified74.3%
Taylor expanded in x around 0 42.2%
Final simplification42.2%
herbie shell --seed 2024018
(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))