
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 0.014) (/ (+ (/ 1.0 (exp (+ x (* x eps_m)))) (exp (* x eps_m))) 2.0) (/ (+ (exp (* x (+ eps_m -1.0))) (exp (- x))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 0.014) {
tmp = ((1.0 / exp((x + (x * eps_m)))) + exp((x * eps_m))) / 2.0;
} else {
tmp = (exp((x * (eps_m + -1.0))) + 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 <= 0.014d0) then
tmp = ((1.0d0 / exp((x + (x * eps_m)))) + exp((x * eps_m))) / 2.0d0
else
tmp = (exp((x * (eps_m + (-1.0d0)))) + 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 <= 0.014) {
tmp = ((1.0 / Math.exp((x + (x * eps_m)))) + Math.exp((x * eps_m))) / 2.0;
} else {
tmp = (Math.exp((x * (eps_m + -1.0))) + Math.exp(-x)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 0.014: tmp = ((1.0 / math.exp((x + (x * eps_m)))) + math.exp((x * eps_m))) / 2.0 else: tmp = (math.exp((x * (eps_m + -1.0))) + math.exp(-x)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 0.014) tmp = Float64(Float64(Float64(1.0 / exp(Float64(x + Float64(x * eps_m)))) + exp(Float64(x * eps_m))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + exp(Float64(-x))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 0.014) tmp = ((1.0 / exp((x + (x * eps_m)))) + exp((x * eps_m))) / 2.0; else tmp = (exp((x * (eps_m + -1.0))) + exp(-x)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 0.014], N[(N[(N[(1.0 / N[Exp[N[(x + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.014:\\
\;\;\;\;\frac{\frac{1}{e^{x + x \cdot eps\_m}} + e^{x \cdot eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(eps\_m + -1\right)} + e^{-x}}{2}\\
\end{array}
\end{array}
if x < 0.0140000000000000003Initial program 60.6%
Simplified53.0%
Taylor expanded in eps around inf 99.0%
Taylor expanded in eps around inf 99.1%
*-commutative99.1%
Simplified99.1%
if 0.0140000000000000003 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around 0 78.6%
rec-exp78.6%
Simplified78.6%
Final simplification93.6%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (/ (+ 1.0 (exp (* x (+ eps_m -1.0)))) 2.0))
(t_1 (exp (- x)))
(t_2 (/ (+ t_1 t_1) 2.0)))
(if (<= x -1.7e-226)
(/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) 2.0)
(if (<= x 4.3e+15)
(/ (+ (exp (* x eps_m)) (- 1.0 (* x eps_m))) 2.0)
(if (<= x 5.9e+54)
t_2
(if (<= x 1.8e+135)
t_0
(if (<= x 3.9e+226)
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (- 1.0 (/ 1.0 eps_m))) 2.0)
(if (<= x 3.8e+285) t_0 t_2))))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0;
double t_1 = exp(-x);
double t_2 = (t_1 + t_1) / 2.0;
double tmp;
if (x <= -1.7e-226) {
tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 4.3e+15) {
tmp = (exp((x * eps_m)) + (1.0 - (x * eps_m))) / 2.0;
} else if (x <= 5.9e+54) {
tmp = t_2;
} else if (x <= 1.8e+135) {
tmp = t_0;
} else if (x <= 3.9e+226) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else if (x <= 3.8e+285) {
tmp = t_0;
} else {
tmp = t_2;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (1.0d0 + exp((x * (eps_m + (-1.0d0))))) / 2.0d0
t_1 = exp(-x)
t_2 = (t_1 + t_1) / 2.0d0
if (x <= (-1.7d-226)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
else if (x <= 4.3d+15) then
tmp = (exp((x * eps_m)) + (1.0d0 - (x * eps_m))) / 2.0d0
else if (x <= 5.9d+54) then
tmp = t_2
else if (x <= 1.8d+135) then
tmp = t_0
else if (x <= 3.9d+226) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 - (1.0d0 / eps_m))) / 2.0d0
else if (x <= 3.8d+285) then
tmp = t_0
else
tmp = t_2
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 + Math.exp((x * (eps_m + -1.0)))) / 2.0;
double t_1 = Math.exp(-x);
double t_2 = (t_1 + t_1) / 2.0;
double tmp;
if (x <= -1.7e-226) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 4.3e+15) {
tmp = (Math.exp((x * eps_m)) + (1.0 - (x * eps_m))) / 2.0;
} else if (x <= 5.9e+54) {
tmp = t_2;
} else if (x <= 1.8e+135) {
tmp = t_0;
} else if (x <= 3.9e+226) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else if (x <= 3.8e+285) {
tmp = t_0;
} else {
tmp = t_2;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = (1.0 + math.exp((x * (eps_m + -1.0)))) / 2.0 t_1 = math.exp(-x) t_2 = (t_1 + t_1) / 2.0 tmp = 0 if x <= -1.7e-226: tmp = (1.0 + math.exp((x * (-1.0 - eps_m)))) / 2.0 elif x <= 4.3e+15: tmp = (math.exp((x * eps_m)) + (1.0 - (x * eps_m))) / 2.0 elif x <= 5.9e+54: tmp = t_2 elif x <= 1.8e+135: tmp = t_0 elif x <= 3.9e+226: tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0 elif x <= 3.8e+285: tmp = t_0 else: tmp = t_2 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(Float64(1.0 + exp(Float64(x * Float64(eps_m + -1.0)))) / 2.0) t_1 = exp(Float64(-x)) t_2 = Float64(Float64(t_1 + t_1) / 2.0) tmp = 0.0 if (x <= -1.7e-226) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); elseif (x <= 4.3e+15) tmp = Float64(Float64(exp(Float64(x * eps_m)) + Float64(1.0 - Float64(x * eps_m))) / 2.0); elseif (x <= 5.9e+54) tmp = t_2; elseif (x <= 1.8e+135) tmp = t_0; elseif (x <= 3.9e+226) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 - Float64(1.0 / eps_m))) / 2.0); elseif (x <= 3.8e+285) tmp = t_0; else tmp = t_2; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0; t_1 = exp(-x); t_2 = (t_1 + t_1) / 2.0; tmp = 0.0; if (x <= -1.7e-226) tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0; elseif (x <= 4.3e+15) tmp = (exp((x * eps_m)) + (1.0 - (x * eps_m))) / 2.0; elseif (x <= 5.9e+54) tmp = t_2; elseif (x <= 1.8e+135) tmp = t_0; elseif (x <= 3.9e+226) tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0; elseif (x <= 3.8e+285) tmp = t_0; else tmp = t_2; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(N[(1.0 + N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, Block[{t$95$1 = N[Exp[(-x)], $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$1 + t$95$1), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, -1.7e-226], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 4.3e+15], N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] + N[(1.0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5.9e+54], t$95$2, If[LessEqual[x, 1.8e+135], t$95$0, If[LessEqual[x, 3.9e+226], 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], If[LessEqual[x, 3.8e+285], t$95$0, t$95$2]]]]]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := \frac{1 + e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
t_1 := e^{-x}\\
t_2 := \frac{t\_1 + t\_1}{2}\\
\mathbf{if}\;x \leq -1.7 \cdot 10^{-226}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\mathbf{elif}\;x \leq 4.3 \cdot 10^{+15}:\\
\;\;\;\;\frac{e^{x \cdot eps\_m} + \left(1 - x \cdot eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 5.9 \cdot 10^{+54}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{+135}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3.9 \cdot 10^{+226}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 - \frac{1}{eps\_m}\right)}{2}\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{+285}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if x < -1.70000000000000004e-226Initial program 67.4%
fma-neg67.3%
/-rgt-identity67.3%
fma-neg67.4%
/-rgt-identity67.4%
distribute-rgt-neg-in67.4%
sub-neg67.4%
metadata-eval67.4%
distribute-rgt-neg-in67.4%
Simplified67.4%
Taylor expanded in x around 0 39.8%
Taylor expanded in eps around inf 71.8%
mul-1-neg71.8%
mul-1-neg71.8%
Simplified71.8%
if -1.70000000000000004e-226 < x < 4.3e15Initial program 56.1%
Simplified49.4%
Taylor expanded in eps around inf 98.8%
Taylor expanded in x around 0 89.8%
mul-1-neg89.8%
Simplified89.8%
Taylor expanded in eps around inf 89.8%
Taylor expanded in eps around inf 90.4%
*-commutative96.9%
Simplified90.4%
if 4.3e15 < x < 5.8999999999999997e54 or 3.7999999999999999e285 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around 0 100.0%
rec-exp100.0%
Simplified100.0%
Taylor expanded in eps around 0 91.8%
mul-1-neg3.1%
Simplified91.8%
if 5.8999999999999997e54 < x < 1.7999999999999999e135 or 3.89999999999999984e226 < x < 3.7999999999999999e285Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 30.8%
if 1.7999999999999999e135 < x < 3.89999999999999984e226Initial 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 10.4%
Taylor expanded in x around 0 71.7%
Final simplification75.3%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1e-272) (/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) 2.0) (/ (+ (exp (* x (+ eps_m -1.0))) (exp (- x))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1e-272) {
tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0;
} else {
tmp = (exp((x * (eps_m + -1.0))) + 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 <= (-1d-272)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
else
tmp = (exp((x * (eps_m + (-1.0d0)))) + 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 <= -1e-272) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
} else {
tmp = (Math.exp((x * (eps_m + -1.0))) + Math.exp(-x)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1e-272: tmp = (1.0 + math.exp((x * (-1.0 - eps_m)))) / 2.0 else: tmp = (math.exp((x * (eps_m + -1.0))) + math.exp(-x)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1e-272) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + exp(Float64(-x))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1e-272) tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0; else tmp = (exp((x * (eps_m + -1.0))) + exp(-x)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1e-272], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-272}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(eps\_m + -1\right)} + e^{-x}}{2}\\
\end{array}
\end{array}
if x < -9.9999999999999993e-273Initial program 68.0%
fma-neg68.0%
/-rgt-identity68.0%
fma-neg68.0%
/-rgt-identity68.0%
distribute-rgt-neg-in68.0%
sub-neg68.0%
metadata-eval68.0%
distribute-rgt-neg-in68.0%
Simplified68.0%
Taylor expanded in x around 0 42.8%
Taylor expanded in eps around inf 74.2%
mul-1-neg74.2%
mul-1-neg74.2%
Simplified74.2%
if -9.9999999999999993e-273 < x Initial program 73.5%
Simplified69.6%
Taylor expanded in eps around inf 99.2%
Taylor expanded in eps around 0 86.2%
rec-exp86.2%
Simplified86.2%
Final simplification81.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* x (+ eps_m -1.0))) (/ 1.0 (exp (+ x (* x eps_m))))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * (eps_m + -1.0))) + (1.0 / exp((x + (x * eps_m))))) / 2.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = (exp((x * (eps_m + (-1.0d0)))) + (1.0d0 / exp((x + (x * eps_m))))) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return (Math.exp((x * (eps_m + -1.0))) + (1.0 / Math.exp((x + (x * eps_m))))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.exp((x * (eps_m + -1.0))) + (1.0 / math.exp((x + (x * eps_m))))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + Float64(1.0 / exp(Float64(x + Float64(x * eps_m))))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((x * (eps_m + -1.0))) + (1.0 / exp((x + (x * eps_m))))) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[Exp[N[(x + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\frac{e^{x \cdot \left(eps\_m + -1\right)} + \frac{1}{e^{x + x \cdot eps\_m}}}{2}
\end{array}
Initial program 71.2%
Simplified65.7%
Taylor expanded in eps around inf 99.3%
Final simplification99.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (+ 1.0 (/ 1.0 eps_m))))
(if (<= x -1e-272)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (<= x 2.2e+135)
(/ (+ 1.0 (exp (* x eps_m))) 2.0)
(if (<= x 6.8e+224)
(/ (+ t_0 (- 1.0 (/ 1.0 eps_m))) 2.0)
(if (<= x 3.2e+279)
(/ (+ 1.0 (exp (* x (+ eps_m -1.0)))) 2.0)
(/ (+ t_0 (/ -1.0 eps_m)) 2.0)))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = 1.0 + (1.0 / eps_m);
double tmp;
if (x <= -1e-272) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 2.2e+135) {
tmp = (1.0 + exp((x * eps_m))) / 2.0;
} else if (x <= 6.8e+224) {
tmp = (t_0 + (1.0 - (1.0 / eps_m))) / 2.0;
} else if (x <= 3.2e+279) {
tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0;
} else {
tmp = (t_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) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (1.0d0 / eps_m)
if (x <= (-1d-272)) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= 2.2d+135) then
tmp = (1.0d0 + exp((x * eps_m))) / 2.0d0
else if (x <= 6.8d+224) then
tmp = (t_0 + (1.0d0 - (1.0d0 / eps_m))) / 2.0d0
else if (x <= 3.2d+279) then
tmp = (1.0d0 + exp((x * (eps_m + (-1.0d0))))) / 2.0d0
else
tmp = (t_0 + ((-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 t_0 = 1.0 + (1.0 / eps_m);
double tmp;
if (x <= -1e-272) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 2.2e+135) {
tmp = (1.0 + Math.exp((x * eps_m))) / 2.0;
} else if (x <= 6.8e+224) {
tmp = (t_0 + (1.0 - (1.0 / eps_m))) / 2.0;
} else if (x <= 3.2e+279) {
tmp = (1.0 + Math.exp((x * (eps_m + -1.0)))) / 2.0;
} else {
tmp = (t_0 + (-1.0 / eps_m)) / 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 <= -1e-272: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 2.2e+135: tmp = (1.0 + math.exp((x * eps_m))) / 2.0 elif x <= 6.8e+224: tmp = (t_0 + (1.0 - (1.0 / eps_m))) / 2.0 elif x <= 3.2e+279: tmp = (1.0 + math.exp((x * (eps_m + -1.0)))) / 2.0 else: tmp = (t_0 + (-1.0 / eps_m)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(1.0 + Float64(1.0 / eps_m)) tmp = 0.0 if (x <= -1e-272) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 2.2e+135) tmp = Float64(Float64(1.0 + exp(Float64(x * eps_m))) / 2.0); elseif (x <= 6.8e+224) tmp = Float64(Float64(t_0 + Float64(1.0 - Float64(1.0 / eps_m))) / 2.0); elseif (x <= 3.2e+279) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps_m + -1.0)))) / 2.0); else tmp = Float64(Float64(t_0 + Float64(-1.0 / eps_m)) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = 1.0 + (1.0 / eps_m); tmp = 0.0; if (x <= -1e-272) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= 2.2e+135) tmp = (1.0 + exp((x * eps_m))) / 2.0; elseif (x <= 6.8e+224) tmp = (t_0 + (1.0 - (1.0 / eps_m))) / 2.0; elseif (x <= 3.2e+279) tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0; else tmp = (t_0 + (-1.0 / eps_m)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1e-272], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.2e+135], N[(N[(1.0 + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 6.8e+224], N[(N[(t$95$0 + N[(1.0 - N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 3.2e+279], N[(N[(1.0 + N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(t$95$0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := 1 + \frac{1}{eps\_m}\\
\mathbf{if}\;x \leq -1 \cdot 10^{-272}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{+135}:\\
\;\;\;\;\frac{1 + e^{x \cdot eps\_m}}{2}\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{+224}:\\
\;\;\;\;\frac{t\_0 + \left(1 - \frac{1}{eps\_m}\right)}{2}\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{+279}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 + \frac{-1}{eps\_m}}{2}\\
\end{array}
\end{array}
if x < -9.9999999999999993e-273Initial program 68.0%
Simplified60.1%
Taylor expanded in eps around inf 99.4%
Taylor expanded in x around 0 69.6%
Taylor expanded in eps around 0 77.3%
mul-1-neg77.3%
Simplified77.3%
if -9.9999999999999993e-273 < x < 2.1999999999999999e135Initial program 62.9%
Simplified57.4%
Taylor expanded in eps around inf 98.9%
Taylor expanded in x around 0 75.4%
Taylor expanded in eps around inf 75.9%
*-commutative89.9%
Simplified75.9%
if 2.1999999999999999e135 < x < 6.8000000000000004e224Initial 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 10.4%
Taylor expanded in x around 0 71.7%
if 6.8000000000000004e224 < x < 3.19999999999999988e279Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 37.7%
if 3.19999999999999988e279 < 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 2.5%
Taylor expanded in x around 0 80.6%
Taylor expanded in eps around 0 80.6%
Final simplification74.1%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (+ 1.0 (/ 1.0 eps_m))))
(if (<= x -1e-272)
(/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) 2.0)
(if (<= x 3.2e+135)
(/ (+ 1.0 (exp (* x eps_m))) 2.0)
(if (<= x 8.1e+223)
(/ (+ t_0 (- 1.0 (/ 1.0 eps_m))) 2.0)
(if (<= x 6.5e+286)
(/ (+ 1.0 (exp (* x (+ eps_m -1.0)))) 2.0)
(/ (+ t_0 (/ -1.0 eps_m)) 2.0)))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = 1.0 + (1.0 / eps_m);
double tmp;
if (x <= -1e-272) {
tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 3.2e+135) {
tmp = (1.0 + exp((x * eps_m))) / 2.0;
} else if (x <= 8.1e+223) {
tmp = (t_0 + (1.0 - (1.0 / eps_m))) / 2.0;
} else if (x <= 6.5e+286) {
tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0;
} else {
tmp = (t_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) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (1.0d0 / eps_m)
if (x <= (-1d-272)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
else if (x <= 3.2d+135) then
tmp = (1.0d0 + exp((x * eps_m))) / 2.0d0
else if (x <= 8.1d+223) then
tmp = (t_0 + (1.0d0 - (1.0d0 / eps_m))) / 2.0d0
else if (x <= 6.5d+286) then
tmp = (1.0d0 + exp((x * (eps_m + (-1.0d0))))) / 2.0d0
else
tmp = (t_0 + ((-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 t_0 = 1.0 + (1.0 / eps_m);
double tmp;
if (x <= -1e-272) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 3.2e+135) {
tmp = (1.0 + Math.exp((x * eps_m))) / 2.0;
} else if (x <= 8.1e+223) {
tmp = (t_0 + (1.0 - (1.0 / eps_m))) / 2.0;
} else if (x <= 6.5e+286) {
tmp = (1.0 + Math.exp((x * (eps_m + -1.0)))) / 2.0;
} else {
tmp = (t_0 + (-1.0 / eps_m)) / 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 <= -1e-272: tmp = (1.0 + math.exp((x * (-1.0 - eps_m)))) / 2.0 elif x <= 3.2e+135: tmp = (1.0 + math.exp((x * eps_m))) / 2.0 elif x <= 8.1e+223: tmp = (t_0 + (1.0 - (1.0 / eps_m))) / 2.0 elif x <= 6.5e+286: tmp = (1.0 + math.exp((x * (eps_m + -1.0)))) / 2.0 else: tmp = (t_0 + (-1.0 / eps_m)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(1.0 + Float64(1.0 / eps_m)) tmp = 0.0 if (x <= -1e-272) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); elseif (x <= 3.2e+135) tmp = Float64(Float64(1.0 + exp(Float64(x * eps_m))) / 2.0); elseif (x <= 8.1e+223) tmp = Float64(Float64(t_0 + Float64(1.0 - Float64(1.0 / eps_m))) / 2.0); elseif (x <= 6.5e+286) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps_m + -1.0)))) / 2.0); else tmp = Float64(Float64(t_0 + Float64(-1.0 / eps_m)) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = 1.0 + (1.0 / eps_m); tmp = 0.0; if (x <= -1e-272) tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0; elseif (x <= 3.2e+135) tmp = (1.0 + exp((x * eps_m))) / 2.0; elseif (x <= 8.1e+223) tmp = (t_0 + (1.0 - (1.0 / eps_m))) / 2.0; elseif (x <= 6.5e+286) tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0; else tmp = (t_0 + (-1.0 / eps_m)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1e-272], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 3.2e+135], N[(N[(1.0 + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 8.1e+223], N[(N[(t$95$0 + N[(1.0 - N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 6.5e+286], N[(N[(1.0 + N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(t$95$0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := 1 + \frac{1}{eps\_m}\\
\mathbf{if}\;x \leq -1 \cdot 10^{-272}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{+135}:\\
\;\;\;\;\frac{1 + e^{x \cdot eps\_m}}{2}\\
\mathbf{elif}\;x \leq 8.1 \cdot 10^{+223}:\\
\;\;\;\;\frac{t\_0 + \left(1 - \frac{1}{eps\_m}\right)}{2}\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{+286}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 + \frac{-1}{eps\_m}}{2}\\
\end{array}
\end{array}
if x < -9.9999999999999993e-273Initial program 68.0%
fma-neg68.0%
/-rgt-identity68.0%
fma-neg68.0%
/-rgt-identity68.0%
distribute-rgt-neg-in68.0%
sub-neg68.0%
metadata-eval68.0%
distribute-rgt-neg-in68.0%
Simplified68.0%
Taylor expanded in x around 0 42.8%
Taylor expanded in eps around inf 74.2%
mul-1-neg74.2%
mul-1-neg74.2%
Simplified74.2%
if -9.9999999999999993e-273 < x < 3.19999999999999975e135Initial program 62.9%
Simplified57.4%
Taylor expanded in eps around inf 98.9%
Taylor expanded in x around 0 75.4%
Taylor expanded in eps around inf 75.9%
*-commutative89.9%
Simplified75.9%
if 3.19999999999999975e135 < x < 8.10000000000000018e223Initial 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 10.4%
Taylor expanded in x around 0 71.7%
if 8.10000000000000018e223 < x < 6.5000000000000003e286Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 37.7%
if 6.5000000000000003e286 < 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 2.5%
Taylor expanded in x around 0 80.6%
Taylor expanded in eps around 0 80.6%
Final simplification72.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 (exp (* x eps_m))) 2.0)))
(if (<= x -2e-272)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (<= x 7.2e+135)
t_1
(if (<= x 2.05e+226)
(/ (+ t_0 (- 1.0 (/ 1.0 eps_m))) 2.0)
(if (<= x 2.2e+267) t_1 (/ (+ t_0 (/ -1.0 eps_m)) 2.0)))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = 1.0 + (1.0 / eps_m);
double t_1 = (1.0 + exp((x * eps_m))) / 2.0;
double tmp;
if (x <= -2e-272) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 7.2e+135) {
tmp = t_1;
} else if (x <= 2.05e+226) {
tmp = (t_0 + (1.0 - (1.0 / eps_m))) / 2.0;
} else if (x <= 2.2e+267) {
tmp = t_1;
} else {
tmp = (t_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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + (1.0d0 / eps_m)
t_1 = (1.0d0 + exp((x * eps_m))) / 2.0d0
if (x <= (-2d-272)) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= 7.2d+135) then
tmp = t_1
else if (x <= 2.05d+226) then
tmp = (t_0 + (1.0d0 - (1.0d0 / eps_m))) / 2.0d0
else if (x <= 2.2d+267) then
tmp = t_1
else
tmp = (t_0 + ((-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 t_0 = 1.0 + (1.0 / eps_m);
double t_1 = (1.0 + Math.exp((x * eps_m))) / 2.0;
double tmp;
if (x <= -2e-272) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 7.2e+135) {
tmp = t_1;
} else if (x <= 2.05e+226) {
tmp = (t_0 + (1.0 - (1.0 / eps_m))) / 2.0;
} else if (x <= 2.2e+267) {
tmp = t_1;
} else {
tmp = (t_0 + (-1.0 / eps_m)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = 1.0 + (1.0 / eps_m) t_1 = (1.0 + math.exp((x * eps_m))) / 2.0 tmp = 0 if x <= -2e-272: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 7.2e+135: tmp = t_1 elif x <= 2.05e+226: tmp = (t_0 + (1.0 - (1.0 / eps_m))) / 2.0 elif x <= 2.2e+267: tmp = t_1 else: tmp = (t_0 + (-1.0 / eps_m)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(1.0 + Float64(1.0 / eps_m)) t_1 = Float64(Float64(1.0 + exp(Float64(x * eps_m))) / 2.0) tmp = 0.0 if (x <= -2e-272) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 7.2e+135) tmp = t_1; elseif (x <= 2.05e+226) tmp = Float64(Float64(t_0 + Float64(1.0 - Float64(1.0 / eps_m))) / 2.0); elseif (x <= 2.2e+267) tmp = t_1; else tmp = Float64(Float64(t_0 + Float64(-1.0 / eps_m)) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = 1.0 + (1.0 / eps_m); t_1 = (1.0 + exp((x * eps_m))) / 2.0; tmp = 0.0; if (x <= -2e-272) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= 7.2e+135) tmp = t_1; elseif (x <= 2.05e+226) tmp = (t_0 + (1.0 - (1.0 / eps_m))) / 2.0; elseif (x <= 2.2e+267) tmp = t_1; else tmp = (t_0 + (-1.0 / eps_m)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, -2e-272], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 7.2e+135], t$95$1, If[LessEqual[x, 2.05e+226], N[(N[(t$95$0 + N[(1.0 - N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.2e+267], t$95$1, N[(N[(t$95$0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := 1 + \frac{1}{eps\_m}\\
t_1 := \frac{1 + e^{x \cdot eps\_m}}{2}\\
\mathbf{if}\;x \leq -2 \cdot 10^{-272}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{+135}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.05 \cdot 10^{+226}:\\
\;\;\;\;\frac{t\_0 + \left(1 - \frac{1}{eps\_m}\right)}{2}\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{+267}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 + \frac{-1}{eps\_m}}{2}\\
\end{array}
\end{array}
if x < -1.99999999999999986e-272Initial program 68.0%
Simplified60.1%
Taylor expanded in eps around inf 99.4%
Taylor expanded in x around 0 69.6%
Taylor expanded in eps around 0 77.3%
mul-1-neg77.3%
Simplified77.3%
if -1.99999999999999986e-272 < x < 7.1999999999999996e135 or 2.04999999999999993e226 < x < 2.2000000000000001e267Initial program 66.6%
Simplified61.7%
Taylor expanded in eps around inf 99.0%
Taylor expanded in x around 0 72.2%
Taylor expanded in eps around inf 72.6%
*-commutative90.1%
Simplified72.6%
if 7.1999999999999996e135 < x < 2.04999999999999993e226Initial 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 10.4%
Taylor expanded in x around 0 71.7%
if 2.2000000000000001e267 < 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 16.4%
Taylor expanded in x around 0 72.3%
Taylor expanded in eps around 0 72.3%
Final simplification74.5%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 0.014) (/ (+ 1.0 (exp (- x))) 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 <= 0.014) {
tmp = (1.0 + exp(-x)) / 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 <= 0.014d0) then
tmp = (1.0d0 + exp(-x)) / 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 <= 0.014) {
tmp = (1.0 + Math.exp(-x)) / 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 <= 0.014: tmp = (1.0 + math.exp(-x)) / 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 <= 0.014) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 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 <= 0.014) tmp = (1.0 + exp(-x)) / 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, 0.014], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.014:\\
\;\;\;\;\frac{1 + e^{-x}}{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 < 0.0140000000000000003Initial program 60.6%
Simplified53.0%
Taylor expanded in eps around inf 99.0%
Taylor expanded in x around 0 79.6%
Taylor expanded in eps around 0 80.9%
mul-1-neg80.9%
Simplified80.9%
if 0.0140000000000000003 < 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 23.7%
Taylor expanded in x around 0 53.7%
Final simplification73.5%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -0.6)
(/ (* x (- -1.0 eps_m)) 2.0)
(if (<= x 0.014)
1.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 <= -0.6) {
tmp = (x * (-1.0 - eps_m)) / 2.0;
} else if (x <= 0.014) {
tmp = 1.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 <= (-0.6d0)) then
tmp = (x * ((-1.0d0) - eps_m)) / 2.0d0
else if (x <= 0.014d0) then
tmp = 1.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 <= -0.6) {
tmp = (x * (-1.0 - eps_m)) / 2.0;
} else if (x <= 0.014) {
tmp = 1.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 <= -0.6: tmp = (x * (-1.0 - eps_m)) / 2.0 elif x <= 0.014: tmp = 1.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 <= -0.6) tmp = Float64(Float64(x * Float64(-1.0 - eps_m)) / 2.0); elseif (x <= 0.014) tmp = 1.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 <= -0.6) tmp = (x * (-1.0 - eps_m)) / 2.0; elseif (x <= 0.014) tmp = 1.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, -0.6], N[(N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 0.014], 1.0, 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 -0.6:\\
\;\;\;\;\frac{x \cdot \left(-1 - eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 0.014:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 - \frac{1}{eps\_m}\right)}{2}\\
\end{array}
\end{array}
if x < -0.599999999999999978Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 55.5%
mul-1-neg55.5%
Simplified55.5%
Taylor expanded in x around inf 29.9%
if -0.599999999999999978 < x < 0.0140000000000000003Initial program 51.6%
fma-neg51.5%
/-rgt-identity51.5%
fma-neg51.6%
/-rgt-identity51.6%
distribute-rgt-neg-in51.6%
sub-neg51.6%
metadata-eval51.6%
distribute-rgt-neg-in51.6%
Simplified51.6%
Taylor expanded in x around 0 77.0%
if 0.0140000000000000003 < 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 23.7%
Taylor expanded in x around 0 53.7%
Final simplification64.3%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -0.65) (/ (* x (- -1.0 eps_m)) 2.0) (if (<= x 360.0) 1.0 (/ (+ (+ 1.0 (/ 1.0 eps_m)) (/ -1.0 eps_m)) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -0.65) {
tmp = (x * (-1.0 - eps_m)) / 2.0;
} else if (x <= 360.0) {
tmp = 1.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (-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 <= (-0.65d0)) then
tmp = (x * ((-1.0d0) - eps_m)) / 2.0d0
else if (x <= 360.0d0) then
tmp = 1.0d0
else
tmp = ((1.0d0 + (1.0d0 / eps_m)) + ((-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 <= -0.65) {
tmp = (x * (-1.0 - eps_m)) / 2.0;
} else if (x <= 360.0) {
tmp = 1.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (-1.0 / eps_m)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -0.65: tmp = (x * (-1.0 - eps_m)) / 2.0 elif x <= 360.0: tmp = 1.0 else: tmp = ((1.0 + (1.0 / eps_m)) + (-1.0 / eps_m)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -0.65) tmp = Float64(Float64(x * Float64(-1.0 - eps_m)) / 2.0); elseif (x <= 360.0) tmp = 1.0; else tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + 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 <= -0.65) tmp = (x * (-1.0 - eps_m)) / 2.0; elseif (x <= 360.0) tmp = 1.0; else tmp = ((1.0 + (1.0 / eps_m)) + (-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, -0.65], N[(N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 360.0], 1.0, N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.65:\\
\;\;\;\;\frac{x \cdot \left(-1 - eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 360:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \frac{-1}{eps\_m}}{2}\\
\end{array}
\end{array}
if x < -0.650000000000000022Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 55.5%
mul-1-neg55.5%
Simplified55.5%
Taylor expanded in x around inf 29.9%
if -0.650000000000000022 < x < 360Initial program 51.9%
fma-neg51.8%
/-rgt-identity51.8%
fma-neg51.9%
/-rgt-identity51.9%
distribute-rgt-neg-in51.9%
sub-neg51.9%
metadata-eval51.9%
distribute-rgt-neg-in51.9%
Simplified51.9%
Taylor expanded in x around 0 76.5%
if 360 < 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 22.6%
Taylor expanded in x around 0 54.4%
Taylor expanded in eps around 0 54.4%
Final simplification64.3%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.0) (* (* x eps_m) -0.5) (if (<= x 0.014) 1.0 (* (* x eps_m) 0.5))))
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 <= 0.014) {
tmp = 1.0;
} else {
tmp = (x * eps_m) * 0.5;
}
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 <= 0.014d0) then
tmp = 1.0d0
else
tmp = (x * eps_m) * 0.5d0
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 <= 0.014) {
tmp = 1.0;
} else {
tmp = (x * eps_m) * 0.5;
}
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 <= 0.014: tmp = 1.0 else: tmp = (x * eps_m) * 0.5 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 <= 0.014) tmp = 1.0; else tmp = Float64(Float64(x * eps_m) * 0.5); 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 <= 0.014) tmp = 1.0; else tmp = (x * eps_m) * 0.5; 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, 0.014], 1.0, N[(N[(x * eps$95$m), $MachinePrecision] * 0.5), $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 0.014:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot eps\_m\right) \cdot 0.5\\
\end{array}
\end{array}
if x < -1Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 55.5%
mul-1-neg55.5%
Simplified55.5%
Taylor expanded in eps around inf 29.9%
*-commutative29.9%
associate-/l*29.9%
metadata-eval29.9%
Applied egg-rr29.9%
if -1 < x < 0.0140000000000000003Initial program 51.6%
fma-neg51.5%
/-rgt-identity51.5%
fma-neg51.6%
/-rgt-identity51.6%
distribute-rgt-neg-in51.6%
sub-neg51.6%
metadata-eval51.6%
distribute-rgt-neg-in51.6%
Simplified51.6%
Taylor expanded in x around 0 77.0%
if 0.0140000000000000003 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 26.5%
mul-1-neg26.5%
Simplified26.5%
Taylor expanded in eps around inf 14.0%
div-inv14.0%
add-sqr-sqrt13.0%
sqrt-unprod42.5%
neg-mul-142.5%
neg-mul-142.5%
sqr-neg42.5%
sqrt-unprod10.5%
add-sqr-sqrt11.4%
metadata-eval11.4%
Applied egg-rr11.4%
Final simplification52.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -0.99) (* (* x eps_m) -0.5) (/ (+ (* x eps_m) 2.0) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -0.99) {
tmp = (x * eps_m) * -0.5;
} else {
tmp = ((x * eps_m) + 2.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 <= (-0.99d0)) then
tmp = (x * eps_m) * (-0.5d0)
else
tmp = ((x * eps_m) + 2.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 <= -0.99) {
tmp = (x * eps_m) * -0.5;
} else {
tmp = ((x * eps_m) + 2.0) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -0.99: tmp = (x * eps_m) * -0.5 else: tmp = ((x * eps_m) + 2.0) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -0.99) tmp = Float64(Float64(x * eps_m) * -0.5); else tmp = Float64(Float64(Float64(x * eps_m) + 2.0) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -0.99) tmp = (x * eps_m) * -0.5; else tmp = ((x * eps_m) + 2.0) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -0.99], N[(N[(x * eps$95$m), $MachinePrecision] * -0.5), $MachinePrecision], N[(N[(N[(x * eps$95$m), $MachinePrecision] + 2.0), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.99:\\
\;\;\;\;\left(x \cdot eps\_m\right) \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m + 2}{2}\\
\end{array}
\end{array}
if x < -0.98999999999999999Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 55.5%
mul-1-neg55.5%
Simplified55.5%
Taylor expanded in eps around inf 29.9%
*-commutative29.9%
associate-/l*29.9%
metadata-eval29.9%
Applied egg-rr29.9%
if -0.98999999999999999 < x Initial program 66.7%
Simplified60.2%
Taylor expanded in eps around inf 99.2%
Taylor expanded in x around 0 66.1%
Taylor expanded in eps around inf 66.4%
*-commutative86.0%
Simplified66.4%
Taylor expanded in x around 0 56.1%
+-commutative56.1%
Simplified56.1%
Final simplification52.5%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -0.38) (/ (* x (- -1.0 eps_m)) 2.0) (/ (+ (* x eps_m) 2.0) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -0.38) {
tmp = (x * (-1.0 - eps_m)) / 2.0;
} else {
tmp = ((x * eps_m) + 2.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 <= (-0.38d0)) then
tmp = (x * ((-1.0d0) - eps_m)) / 2.0d0
else
tmp = ((x * eps_m) + 2.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 <= -0.38) {
tmp = (x * (-1.0 - eps_m)) / 2.0;
} else {
tmp = ((x * eps_m) + 2.0) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -0.38: tmp = (x * (-1.0 - eps_m)) / 2.0 else: tmp = ((x * eps_m) + 2.0) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -0.38) tmp = Float64(Float64(x * Float64(-1.0 - eps_m)) / 2.0); else tmp = Float64(Float64(Float64(x * eps_m) + 2.0) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -0.38) tmp = (x * (-1.0 - eps_m)) / 2.0; else tmp = ((x * eps_m) + 2.0) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -0.38], N[(N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(x * eps$95$m), $MachinePrecision] + 2.0), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.38:\\
\;\;\;\;\frac{x \cdot \left(-1 - eps\_m\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m + 2}{2}\\
\end{array}
\end{array}
if x < -0.38Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 55.5%
mul-1-neg55.5%
Simplified55.5%
Taylor expanded in x around inf 29.9%
if -0.38 < x Initial program 66.7%
Simplified60.2%
Taylor expanded in eps around inf 99.2%
Taylor expanded in x around 0 66.1%
Taylor expanded in eps around inf 66.4%
*-commutative86.0%
Simplified66.4%
Taylor expanded in x around 0 56.1%
+-commutative56.1%
Simplified56.1%
Final simplification52.5%
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 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 55.5%
mul-1-neg55.5%
Simplified55.5%
Taylor expanded in eps around inf 29.9%
*-commutative29.9%
associate-/l*29.9%
metadata-eval29.9%
Applied egg-rr29.9%
if -1 < x Initial program 66.7%
fma-neg66.7%
/-rgt-identity66.7%
fma-neg66.7%
/-rgt-identity66.7%
distribute-rgt-neg-in66.7%
sub-neg66.7%
metadata-eval66.7%
distribute-rgt-neg-in66.7%
Simplified66.7%
Taylor expanded in x around 0 53.9%
Final simplification50.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 0.5)
eps_m = fabs(eps);
double code(double x, double eps_m) {
return 0.5;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = 0.5d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return 0.5;
}
eps_m = math.fabs(eps) def code(x, eps_m): return 0.5
eps_m = abs(eps) function code(x, eps_m) return 0.5 end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = 0.5; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := 0.5
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
0.5
\end{array}
Initial program 71.2%
fma-neg71.2%
/-rgt-identity71.2%
fma-neg71.2%
/-rgt-identity71.2%
distribute-rgt-neg-in71.2%
sub-neg71.2%
metadata-eval71.2%
distribute-rgt-neg-in71.2%
Simplified71.2%
Taylor expanded in x around 0 38.0%
Taylor expanded in x around 0 32.2%
Taylor expanded in eps around 0 19.3%
Taylor expanded in eps around 0 10.3%
Final simplification10.3%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 1.0)
eps_m = fabs(eps);
double code(double x, double eps_m) {
return 1.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = 1.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return 1.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return 1.0
eps_m = abs(eps) function code(x, eps_m) return 1.0 end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = 1.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := 1.0
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
1
\end{array}
Initial program 71.2%
fma-neg71.2%
/-rgt-identity71.2%
fma-neg71.2%
/-rgt-identity71.2%
distribute-rgt-neg-in71.2%
sub-neg71.2%
metadata-eval71.2%
distribute-rgt-neg-in71.2%
Simplified71.2%
Taylor expanded in x around 0 47.0%
Final simplification47.0%
herbie shell --seed 2024046
(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))