
(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 14 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}
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(let* ((t_0 (exp (- x))))
(if (<= eps 1e-90)
(/ (+ (* t_0 (+ 1.0 (+ x 1.0))) (* x t_0)) 2.0)
(/ (+ (exp (* x (+ eps -1.0))) (exp (* (- x) eps))) 2.0))))eps = abs(eps);
double code(double x, double eps) {
double t_0 = exp(-x);
double tmp;
if (eps <= 1e-90) {
tmp = ((t_0 * (1.0 + (x + 1.0))) + (x * t_0)) / 2.0;
} else {
tmp = (exp((x * (eps + -1.0))) + exp((-x * eps))) / 2.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = exp(-x)
if (eps <= 1d-90) then
tmp = ((t_0 * (1.0d0 + (x + 1.0d0))) + (x * t_0)) / 2.0d0
else
tmp = (exp((x * (eps + (-1.0d0)))) + exp((-x * eps))) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double t_0 = Math.exp(-x);
double tmp;
if (eps <= 1e-90) {
tmp = ((t_0 * (1.0 + (x + 1.0))) + (x * t_0)) / 2.0;
} else {
tmp = (Math.exp((x * (eps + -1.0))) + Math.exp((-x * eps))) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): t_0 = math.exp(-x) tmp = 0 if eps <= 1e-90: tmp = ((t_0 * (1.0 + (x + 1.0))) + (x * t_0)) / 2.0 else: tmp = (math.exp((x * (eps + -1.0))) + math.exp((-x * eps))) / 2.0 return tmp
eps = abs(eps) function code(x, eps) t_0 = exp(Float64(-x)) tmp = 0.0 if (eps <= 1e-90) tmp = Float64(Float64(Float64(t_0 * Float64(1.0 + Float64(x + 1.0))) + Float64(x * t_0)) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(eps + -1.0))) + exp(Float64(Float64(-x) * eps))) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) t_0 = exp(-x); tmp = 0.0; if (eps <= 1e-90) tmp = ((t_0 * (1.0 + (x + 1.0))) + (x * t_0)) / 2.0; else tmp = (exp((x * (eps + -1.0))) + exp((-x * eps))) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function
code[x_, eps_] := Block[{t$95$0 = N[Exp[(-x)], $MachinePrecision]}, If[LessEqual[eps, 1e-90], N[(N[(N[(t$95$0 * N[(1.0 + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * t$95$0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[((-x) * eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
t_0 := e^{-x}\\
\mathbf{if}\;\varepsilon \leq 10^{-90}:\\
\;\;\;\;\frac{t_0 \cdot \left(1 + \left(x + 1\right)\right) + x \cdot t_0}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(\varepsilon + -1\right)} + e^{\left(-x\right) \cdot \varepsilon}}{2}\\
\end{array}
\end{array}
if eps < 9.99999999999999995e-91Initial program 69.7%
*-commutative69.7%
distribute-rgt-neg-in69.7%
*-commutative69.7%
sub-neg69.7%
metadata-eval69.7%
distribute-rgt-neg-in69.7%
Simplified69.7%
Taylor expanded in eps around 0 63.6%
associate--r+63.6%
associate-*r*63.6%
mul-1-neg63.6%
cancel-sign-sub63.6%
distribute-rgt1-in63.6%
distribute-rgt-out--64.2%
mul-1-neg64.2%
mul-1-neg64.2%
Simplified64.2%
if 9.99999999999999995e-91 < eps Initial program 92.1%
*-commutative92.1%
distribute-rgt-neg-in92.1%
*-commutative92.1%
sub-neg92.1%
metadata-eval92.1%
distribute-rgt-neg-in92.1%
Simplified92.1%
Taylor expanded in eps around inf 100.0%
associate-*r*100.0%
mul-1-neg100.0%
mul-1-neg100.0%
associate-*r*100.0%
mul-1-neg100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
associate-*r*100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
associate-*r*100.0%
mul-1-neg100.0%
associate-*r*100.0%
mul-1-neg100.0%
Simplified100.0%
Final simplification76.2%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(let* ((t_0 (exp (* x (+ eps -1.0)))) (t_1 (/ 2.0 (exp x))))
(if (<= x -3e-245)
(/ (+ 1.0 (exp (* (- x) eps))) 2.0)
(if (<= x 1.25e+25)
(/ (+ t_0 (- 1.0 (* x eps))) 2.0)
(if (<= x 5.5e+138) (/ (+ t_1 (* x t_1)) 2.0) (/ (+ 1.0 t_0) 2.0))))))eps = abs(eps);
double code(double x, double eps) {
double t_0 = exp((x * (eps + -1.0)));
double t_1 = 2.0 / exp(x);
double tmp;
if (x <= -3e-245) {
tmp = (1.0 + exp((-x * eps))) / 2.0;
} else if (x <= 1.25e+25) {
tmp = (t_0 + (1.0 - (x * eps))) / 2.0;
} else if (x <= 5.5e+138) {
tmp = (t_1 + (x * t_1)) / 2.0;
} else {
tmp = (1.0 + t_0) / 2.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = exp((x * (eps + (-1.0d0))))
t_1 = 2.0d0 / exp(x)
if (x <= (-3d-245)) then
tmp = (1.0d0 + exp((-x * eps))) / 2.0d0
else if (x <= 1.25d+25) then
tmp = (t_0 + (1.0d0 - (x * eps))) / 2.0d0
else if (x <= 5.5d+138) then
tmp = (t_1 + (x * t_1)) / 2.0d0
else
tmp = (1.0d0 + t_0) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double t_0 = Math.exp((x * (eps + -1.0)));
double t_1 = 2.0 / Math.exp(x);
double tmp;
if (x <= -3e-245) {
tmp = (1.0 + Math.exp((-x * eps))) / 2.0;
} else if (x <= 1.25e+25) {
tmp = (t_0 + (1.0 - (x * eps))) / 2.0;
} else if (x <= 5.5e+138) {
tmp = (t_1 + (x * t_1)) / 2.0;
} else {
tmp = (1.0 + t_0) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): t_0 = math.exp((x * (eps + -1.0))) t_1 = 2.0 / math.exp(x) tmp = 0 if x <= -3e-245: tmp = (1.0 + math.exp((-x * eps))) / 2.0 elif x <= 1.25e+25: tmp = (t_0 + (1.0 - (x * eps))) / 2.0 elif x <= 5.5e+138: tmp = (t_1 + (x * t_1)) / 2.0 else: tmp = (1.0 + t_0) / 2.0 return tmp
eps = abs(eps) function code(x, eps) t_0 = exp(Float64(x * Float64(eps + -1.0))) t_1 = Float64(2.0 / exp(x)) tmp = 0.0 if (x <= -3e-245) tmp = Float64(Float64(1.0 + exp(Float64(Float64(-x) * eps))) / 2.0); elseif (x <= 1.25e+25) tmp = Float64(Float64(t_0 + Float64(1.0 - Float64(x * eps))) / 2.0); elseif (x <= 5.5e+138) tmp = Float64(Float64(t_1 + Float64(x * t_1)) / 2.0); else tmp = Float64(Float64(1.0 + t_0) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) t_0 = exp((x * (eps + -1.0))); t_1 = 2.0 / exp(x); tmp = 0.0; if (x <= -3e-245) tmp = (1.0 + exp((-x * eps))) / 2.0; elseif (x <= 1.25e+25) tmp = (t_0 + (1.0 - (x * eps))) / 2.0; elseif (x <= 5.5e+138) tmp = (t_1 + (x * t_1)) / 2.0; else tmp = (1.0 + t_0) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function
code[x_, eps_] := Block[{t$95$0 = N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(2.0 / N[Exp[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3e-245], N[(N[(1.0 + N[Exp[N[((-x) * eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.25e+25], N[(N[(t$95$0 + N[(1.0 - N[(x * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5.5e+138], N[(N[(t$95$1 + N[(x * t$95$1), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(\varepsilon + -1\right)}\\
t_1 := \frac{2}{e^{x}}\\
\mathbf{if}\;x \leq -3 \cdot 10^{-245}:\\
\;\;\;\;\frac{1 + e^{\left(-x\right) \cdot \varepsilon}}{2}\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{+25}:\\
\;\;\;\;\frac{t_0 + \left(1 - x \cdot \varepsilon\right)}{2}\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{+138}:\\
\;\;\;\;\frac{t_1 + x \cdot t_1}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + t_0}{2}\\
\end{array}
\end{array}
if x < -3.0000000000000002e-245Initial program 67.7%
*-commutative67.7%
distribute-rgt-neg-in67.7%
*-commutative67.7%
sub-neg67.7%
metadata-eval67.7%
distribute-rgt-neg-in67.7%
Simplified67.7%
Taylor expanded in eps around inf 96.7%
associate-*r*96.7%
mul-1-neg96.7%
mul-1-neg96.7%
associate-*r*96.7%
mul-1-neg96.7%
+-commutative96.7%
Simplified96.7%
Taylor expanded in eps around inf 96.8%
associate-*r*96.8%
mul-1-neg96.8%
Simplified96.8%
Taylor expanded in x around inf 96.8%
associate-*r*96.8%
mul-1-neg96.8%
associate-*r*96.8%
mul-1-neg96.8%
Simplified96.8%
Taylor expanded in x around 0 70.1%
if -3.0000000000000002e-245 < x < 1.25000000000000006e25Initial program 66.4%
*-commutative66.4%
distribute-rgt-neg-in66.4%
*-commutative66.4%
sub-neg66.4%
metadata-eval66.4%
distribute-rgt-neg-in66.4%
Simplified66.4%
Taylor expanded in eps around inf 99.3%
associate-*r*99.3%
mul-1-neg99.3%
mul-1-neg99.3%
associate-*r*99.3%
mul-1-neg99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in eps around inf 99.3%
associate-*r*99.3%
mul-1-neg99.3%
Simplified99.3%
Taylor expanded in x around inf 99.3%
associate-*r*99.3%
mul-1-neg99.3%
associate-*r*99.3%
mul-1-neg99.3%
Simplified99.3%
Taylor expanded in eps around 0 80.5%
associate-*r*80.5%
mul-1-neg80.5%
Simplified80.5%
if 1.25000000000000006e25 < x < 5.4999999999999999e138Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in eps around 0 68.1%
associate--r+68.1%
associate-*r*68.1%
mul-1-neg68.1%
cancel-sign-sub68.1%
distribute-rgt1-in68.1%
distribute-rgt-out--68.1%
mul-1-neg68.1%
mul-1-neg68.1%
Simplified68.1%
Taylor expanded in x around inf 68.1%
+-commutative68.1%
associate-*r*68.1%
mul-1-neg68.1%
associate-*r*68.1%
*-commutative68.1%
associate-*l*68.1%
mul-1-neg68.1%
exp-neg68.1%
associate-*l/68.1%
metadata-eval68.1%
exp-neg68.1%
associate-*r/68.1%
metadata-eval68.1%
Simplified68.1%
if 5.4999999999999999e138 < x Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
associate-*r*100.0%
mul-1-neg100.0%
mul-1-neg100.0%
associate-*r*100.0%
mul-1-neg100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in eps around inf 67.5%
associate-*r*67.5%
mul-1-neg67.5%
Simplified67.5%
Taylor expanded in x around inf 67.5%
associate-*r*67.5%
mul-1-neg67.5%
associate-*r*67.5%
mul-1-neg67.5%
Simplified67.5%
Taylor expanded in eps around 0 26.2%
Final simplification66.0%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(let* ((t_0 (/ 2.0 (exp x))))
(if (<= eps 6.8e-90)
(/ (+ t_0 (* x t_0)) 2.0)
(/ (+ (exp (* x (+ eps -1.0))) (exp (* (- x) eps))) 2.0))))eps = abs(eps);
double code(double x, double eps) {
double t_0 = 2.0 / exp(x);
double tmp;
if (eps <= 6.8e-90) {
tmp = (t_0 + (x * t_0)) / 2.0;
} else {
tmp = (exp((x * (eps + -1.0))) + exp((-x * eps))) / 2.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / exp(x)
if (eps <= 6.8d-90) then
tmp = (t_0 + (x * t_0)) / 2.0d0
else
tmp = (exp((x * (eps + (-1.0d0)))) + exp((-x * eps))) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double t_0 = 2.0 / Math.exp(x);
double tmp;
if (eps <= 6.8e-90) {
tmp = (t_0 + (x * t_0)) / 2.0;
} else {
tmp = (Math.exp((x * (eps + -1.0))) + Math.exp((-x * eps))) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): t_0 = 2.0 / math.exp(x) tmp = 0 if eps <= 6.8e-90: tmp = (t_0 + (x * t_0)) / 2.0 else: tmp = (math.exp((x * (eps + -1.0))) + math.exp((-x * eps))) / 2.0 return tmp
eps = abs(eps) function code(x, eps) t_0 = Float64(2.0 / exp(x)) tmp = 0.0 if (eps <= 6.8e-90) tmp = Float64(Float64(t_0 + Float64(x * t_0)) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(eps + -1.0))) + exp(Float64(Float64(-x) * eps))) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) t_0 = 2.0 / exp(x); tmp = 0.0; if (eps <= 6.8e-90) tmp = (t_0 + (x * t_0)) / 2.0; else tmp = (exp((x * (eps + -1.0))) + exp((-x * eps))) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function
code[x_, eps_] := Block[{t$95$0 = N[(2.0 / N[Exp[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, 6.8e-90], N[(N[(t$95$0 + N[(x * t$95$0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[((-x) * eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
t_0 := \frac{2}{e^{x}}\\
\mathbf{if}\;\varepsilon \leq 6.8 \cdot 10^{-90}:\\
\;\;\;\;\frac{t_0 + x \cdot t_0}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(\varepsilon + -1\right)} + e^{\left(-x\right) \cdot \varepsilon}}{2}\\
\end{array}
\end{array}
if eps < 6.79999999999999988e-90Initial program 69.7%
*-commutative69.7%
distribute-rgt-neg-in69.7%
*-commutative69.7%
sub-neg69.7%
metadata-eval69.7%
distribute-rgt-neg-in69.7%
Simplified69.7%
Taylor expanded in eps around 0 63.6%
associate--r+63.6%
associate-*r*63.6%
mul-1-neg63.6%
cancel-sign-sub63.6%
distribute-rgt1-in63.6%
distribute-rgt-out--64.2%
mul-1-neg64.2%
mul-1-neg64.2%
Simplified64.2%
Taylor expanded in x around inf 63.6%
+-commutative63.6%
associate-*r*63.6%
mul-1-neg63.6%
associate-*r*63.6%
*-commutative63.6%
associate-*l*63.6%
mul-1-neg63.6%
exp-neg63.6%
associate-*l/63.6%
metadata-eval63.6%
exp-neg63.6%
associate-*r/63.6%
metadata-eval63.6%
Simplified63.6%
if 6.79999999999999988e-90 < eps Initial program 92.1%
*-commutative92.1%
distribute-rgt-neg-in92.1%
*-commutative92.1%
sub-neg92.1%
metadata-eval92.1%
distribute-rgt-neg-in92.1%
Simplified92.1%
Taylor expanded in eps around inf 100.0%
associate-*r*100.0%
mul-1-neg100.0%
mul-1-neg100.0%
associate-*r*100.0%
mul-1-neg100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
associate-*r*100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
associate-*r*100.0%
mul-1-neg100.0%
associate-*r*100.0%
mul-1-neg100.0%
Simplified100.0%
Final simplification75.8%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (/ (+ (exp (* x (+ eps -1.0))) (exp (* x (- -1.0 eps)))) 2.0))
eps = abs(eps);
double code(double x, double eps) {
return (exp((x * (eps + -1.0))) + exp((x * (-1.0 - eps)))) / 2.0;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (exp((x * (eps + (-1.0d0)))) + exp((x * ((-1.0d0) - eps)))) / 2.0d0
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
return (Math.exp((x * (eps + -1.0))) + Math.exp((x * (-1.0 - eps)))) / 2.0;
}
eps = abs(eps) def code(x, eps): return (math.exp((x * (eps + -1.0))) + math.exp((x * (-1.0 - eps)))) / 2.0
eps = abs(eps) function code(x, eps) return Float64(Float64(exp(Float64(x * Float64(eps + -1.0))) + exp(Float64(x * Float64(-1.0 - eps)))) / 2.0) end
eps = abs(eps) function tmp = code(x, eps) tmp = (exp((x * (eps + -1.0))) + exp((x * (-1.0 - eps)))) / 2.0; end
NOTE: eps should be positive before calling this function code[x_, eps_] := N[(N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps = |eps|\\
\\
\frac{e^{x \cdot \left(\varepsilon + -1\right)} + e^{x \cdot \left(-1 - \varepsilon\right)}}{2}
\end{array}
Initial program 77.2%
*-commutative77.2%
distribute-rgt-neg-in77.2%
*-commutative77.2%
sub-neg77.2%
metadata-eval77.2%
distribute-rgt-neg-in77.2%
Simplified77.2%
Taylor expanded in eps around inf 98.6%
associate-*r*98.6%
mul-1-neg98.6%
mul-1-neg98.6%
associate-*r*98.6%
mul-1-neg98.6%
+-commutative98.6%
Simplified98.6%
Final simplification98.6%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(let* ((t_0 (exp (* x (+ eps -1.0)))))
(if (<= x -3.6e-245)
(/ (+ 1.0 (exp (* (- x) eps))) 2.0)
(if (<= x 2.5e+22)
(/ (+ t_0 (- 1.0 (* x eps))) 2.0)
(if (<= x 7.6e+141)
(/ (* x (/ 2.0 (exp x))) 2.0)
(/ (+ 1.0 t_0) 2.0))))))eps = abs(eps);
double code(double x, double eps) {
double t_0 = exp((x * (eps + -1.0)));
double tmp;
if (x <= -3.6e-245) {
tmp = (1.0 + exp((-x * eps))) / 2.0;
} else if (x <= 2.5e+22) {
tmp = (t_0 + (1.0 - (x * eps))) / 2.0;
} else if (x <= 7.6e+141) {
tmp = (x * (2.0 / exp(x))) / 2.0;
} else {
tmp = (1.0 + t_0) / 2.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = exp((x * (eps + (-1.0d0))))
if (x <= (-3.6d-245)) then
tmp = (1.0d0 + exp((-x * eps))) / 2.0d0
else if (x <= 2.5d+22) then
tmp = (t_0 + (1.0d0 - (x * eps))) / 2.0d0
else if (x <= 7.6d+141) then
tmp = (x * (2.0d0 / exp(x))) / 2.0d0
else
tmp = (1.0d0 + t_0) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double t_0 = Math.exp((x * (eps + -1.0)));
double tmp;
if (x <= -3.6e-245) {
tmp = (1.0 + Math.exp((-x * eps))) / 2.0;
} else if (x <= 2.5e+22) {
tmp = (t_0 + (1.0 - (x * eps))) / 2.0;
} else if (x <= 7.6e+141) {
tmp = (x * (2.0 / Math.exp(x))) / 2.0;
} else {
tmp = (1.0 + t_0) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): t_0 = math.exp((x * (eps + -1.0))) tmp = 0 if x <= -3.6e-245: tmp = (1.0 + math.exp((-x * eps))) / 2.0 elif x <= 2.5e+22: tmp = (t_0 + (1.0 - (x * eps))) / 2.0 elif x <= 7.6e+141: tmp = (x * (2.0 / math.exp(x))) / 2.0 else: tmp = (1.0 + t_0) / 2.0 return tmp
eps = abs(eps) function code(x, eps) t_0 = exp(Float64(x * Float64(eps + -1.0))) tmp = 0.0 if (x <= -3.6e-245) tmp = Float64(Float64(1.0 + exp(Float64(Float64(-x) * eps))) / 2.0); elseif (x <= 2.5e+22) tmp = Float64(Float64(t_0 + Float64(1.0 - Float64(x * eps))) / 2.0); elseif (x <= 7.6e+141) tmp = Float64(Float64(x * Float64(2.0 / exp(x))) / 2.0); else tmp = Float64(Float64(1.0 + t_0) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) t_0 = exp((x * (eps + -1.0))); tmp = 0.0; if (x <= -3.6e-245) tmp = (1.0 + exp((-x * eps))) / 2.0; elseif (x <= 2.5e+22) tmp = (t_0 + (1.0 - (x * eps))) / 2.0; elseif (x <= 7.6e+141) tmp = (x * (2.0 / exp(x))) / 2.0; else tmp = (1.0 + t_0) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function
code[x_, eps_] := Block[{t$95$0 = N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -3.6e-245], N[(N[(1.0 + N[Exp[N[((-x) * eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.5e+22], N[(N[(t$95$0 + N[(1.0 - N[(x * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 7.6e+141], N[(N[(x * N[(2.0 / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(\varepsilon + -1\right)}\\
\mathbf{if}\;x \leq -3.6 \cdot 10^{-245}:\\
\;\;\;\;\frac{1 + e^{\left(-x\right) \cdot \varepsilon}}{2}\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{+22}:\\
\;\;\;\;\frac{t_0 + \left(1 - x \cdot \varepsilon\right)}{2}\\
\mathbf{elif}\;x \leq 7.6 \cdot 10^{+141}:\\
\;\;\;\;\frac{x \cdot \frac{2}{e^{x}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + t_0}{2}\\
\end{array}
\end{array}
if x < -3.59999999999999999e-245Initial program 67.7%
*-commutative67.7%
distribute-rgt-neg-in67.7%
*-commutative67.7%
sub-neg67.7%
metadata-eval67.7%
distribute-rgt-neg-in67.7%
Simplified67.7%
Taylor expanded in eps around inf 96.7%
associate-*r*96.7%
mul-1-neg96.7%
mul-1-neg96.7%
associate-*r*96.7%
mul-1-neg96.7%
+-commutative96.7%
Simplified96.7%
Taylor expanded in eps around inf 96.8%
associate-*r*96.8%
mul-1-neg96.8%
Simplified96.8%
Taylor expanded in x around inf 96.8%
associate-*r*96.8%
mul-1-neg96.8%
associate-*r*96.8%
mul-1-neg96.8%
Simplified96.8%
Taylor expanded in x around 0 70.1%
if -3.59999999999999999e-245 < x < 2.4999999999999998e22Initial program 66.4%
*-commutative66.4%
distribute-rgt-neg-in66.4%
*-commutative66.4%
sub-neg66.4%
metadata-eval66.4%
distribute-rgt-neg-in66.4%
Simplified66.4%
Taylor expanded in eps around inf 99.3%
associate-*r*99.3%
mul-1-neg99.3%
mul-1-neg99.3%
associate-*r*99.3%
mul-1-neg99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in eps around inf 99.3%
associate-*r*99.3%
mul-1-neg99.3%
Simplified99.3%
Taylor expanded in x around inf 99.3%
associate-*r*99.3%
mul-1-neg99.3%
associate-*r*99.3%
mul-1-neg99.3%
Simplified99.3%
Taylor expanded in eps around 0 80.5%
associate-*r*80.5%
mul-1-neg80.5%
Simplified80.5%
if 2.4999999999999998e22 < x < 7.59999999999999952e141Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in eps around 0 68.1%
associate--r+68.1%
associate-*r*68.1%
mul-1-neg68.1%
cancel-sign-sub68.1%
distribute-rgt1-in68.1%
distribute-rgt-out--68.1%
mul-1-neg68.1%
mul-1-neg68.1%
Simplified68.1%
Taylor expanded in x around inf 68.1%
associate-*r*68.1%
mul-1-neg68.1%
associate-*r*68.1%
*-commutative68.1%
associate-*l*68.1%
mul-1-neg68.1%
exp-neg68.1%
associate-*l/68.1%
metadata-eval68.1%
Simplified68.1%
if 7.59999999999999952e141 < x Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
associate-*r*100.0%
mul-1-neg100.0%
mul-1-neg100.0%
associate-*r*100.0%
mul-1-neg100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in eps around inf 67.5%
associate-*r*67.5%
mul-1-neg67.5%
Simplified67.5%
Taylor expanded in x around inf 67.5%
associate-*r*67.5%
mul-1-neg67.5%
associate-*r*67.5%
mul-1-neg67.5%
Simplified67.5%
Taylor expanded in eps around 0 26.2%
Final simplification66.0%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(if (<= x -3e-245)
(/ (+ 1.0 (exp (* (- x) eps))) 2.0)
(if (or (<= x 1.35e+25) (not (<= x 6.2e+139)))
(/ (+ 1.0 (exp (* x (+ eps -1.0)))) 2.0)
(/ (* x (/ 2.0 (exp x))) 2.0))))eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (x <= -3e-245) {
tmp = (1.0 + exp((-x * eps))) / 2.0;
} else if ((x <= 1.35e+25) || !(x <= 6.2e+139)) {
tmp = (1.0 + exp((x * (eps + -1.0)))) / 2.0;
} else {
tmp = (x * (2.0 / exp(x))) / 2.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= (-3d-245)) then
tmp = (1.0d0 + exp((-x * eps))) / 2.0d0
else if ((x <= 1.35d+25) .or. (.not. (x <= 6.2d+139))) then
tmp = (1.0d0 + exp((x * (eps + (-1.0d0))))) / 2.0d0
else
tmp = (x * (2.0d0 / exp(x))) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (x <= -3e-245) {
tmp = (1.0 + Math.exp((-x * eps))) / 2.0;
} else if ((x <= 1.35e+25) || !(x <= 6.2e+139)) {
tmp = (1.0 + Math.exp((x * (eps + -1.0)))) / 2.0;
} else {
tmp = (x * (2.0 / Math.exp(x))) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if x <= -3e-245: tmp = (1.0 + math.exp((-x * eps))) / 2.0 elif (x <= 1.35e+25) or not (x <= 6.2e+139): tmp = (1.0 + math.exp((x * (eps + -1.0)))) / 2.0 else: tmp = (x * (2.0 / math.exp(x))) / 2.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (x <= -3e-245) tmp = Float64(Float64(1.0 + exp(Float64(Float64(-x) * eps))) / 2.0); elseif ((x <= 1.35e+25) || !(x <= 6.2e+139)) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps + -1.0)))) / 2.0); else tmp = Float64(Float64(x * Float64(2.0 / exp(x))) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -3e-245) tmp = (1.0 + exp((-x * eps))) / 2.0; elseif ((x <= 1.35e+25) || ~((x <= 6.2e+139))) tmp = (1.0 + exp((x * (eps + -1.0)))) / 2.0; else tmp = (x * (2.0 / exp(x))) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[x, -3e-245], N[(N[(1.0 + N[Exp[N[((-x) * eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 1.35e+25], N[Not[LessEqual[x, 6.2e+139]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x * N[(2.0 / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3 \cdot 10^{-245}:\\
\;\;\;\;\frac{1 + e^{\left(-x\right) \cdot \varepsilon}}{2}\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{+25} \lor \neg \left(x \leq 6.2 \cdot 10^{+139}\right):\\
\;\;\;\;\frac{1 + e^{x \cdot \left(\varepsilon + -1\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{2}{e^{x}}}{2}\\
\end{array}
\end{array}
if x < -3.0000000000000002e-245Initial program 67.7%
*-commutative67.7%
distribute-rgt-neg-in67.7%
*-commutative67.7%
sub-neg67.7%
metadata-eval67.7%
distribute-rgt-neg-in67.7%
Simplified67.7%
Taylor expanded in eps around inf 96.7%
associate-*r*96.7%
mul-1-neg96.7%
mul-1-neg96.7%
associate-*r*96.7%
mul-1-neg96.7%
+-commutative96.7%
Simplified96.7%
Taylor expanded in eps around inf 96.8%
associate-*r*96.8%
mul-1-neg96.8%
Simplified96.8%
Taylor expanded in x around inf 96.8%
associate-*r*96.8%
mul-1-neg96.8%
associate-*r*96.8%
mul-1-neg96.8%
Simplified96.8%
Taylor expanded in x around 0 70.1%
if -3.0000000000000002e-245 < x < 1.35e25 or 6.2e139 < x Initial program 77.6%
*-commutative77.6%
distribute-rgt-neg-in77.6%
*-commutative77.6%
sub-neg77.6%
metadata-eval77.6%
distribute-rgt-neg-in77.6%
Simplified77.6%
Taylor expanded in eps around inf 99.5%
associate-*r*99.5%
mul-1-neg99.5%
mul-1-neg99.5%
associate-*r*99.5%
mul-1-neg99.5%
+-commutative99.5%
Simplified99.5%
Taylor expanded in eps around inf 88.7%
associate-*r*88.7%
mul-1-neg88.7%
Simplified88.7%
Taylor expanded in x around inf 88.7%
associate-*r*88.7%
mul-1-neg88.7%
associate-*r*88.7%
mul-1-neg88.7%
Simplified88.7%
Taylor expanded in eps around 0 61.9%
if 1.35e25 < x < 6.2e139Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in eps around 0 68.1%
associate--r+68.1%
associate-*r*68.1%
mul-1-neg68.1%
cancel-sign-sub68.1%
distribute-rgt1-in68.1%
distribute-rgt-out--68.1%
mul-1-neg68.1%
mul-1-neg68.1%
Simplified68.1%
Taylor expanded in x around inf 68.1%
associate-*r*68.1%
mul-1-neg68.1%
associate-*r*68.1%
*-commutative68.1%
associate-*l*68.1%
mul-1-neg68.1%
exp-neg68.1%
associate-*l/68.1%
metadata-eval68.1%
Simplified68.1%
Final simplification65.8%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(if (<= x 5.8e+18)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (<= x 5.5e+138)
(/ (* x (/ 2.0 (exp x))) 2.0)
(/ (* x (+ 2.0 (* x (+ x -2.0)))) 2.0))))eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (x <= 5.8e+18) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 5.5e+138) {
tmp = (x * (2.0 / exp(x))) / 2.0;
} else {
tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 5.8d+18) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= 5.5d+138) then
tmp = (x * (2.0d0 / exp(x))) / 2.0d0
else
tmp = (x * (2.0d0 + (x * (x + (-2.0d0))))) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (x <= 5.8e+18) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 5.5e+138) {
tmp = (x * (2.0 / Math.exp(x))) / 2.0;
} else {
tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if x <= 5.8e+18: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 5.5e+138: tmp = (x * (2.0 / math.exp(x))) / 2.0 else: tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (x <= 5.8e+18) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 5.5e+138) tmp = Float64(Float64(x * Float64(2.0 / exp(x))) / 2.0); else tmp = Float64(Float64(x * Float64(2.0 + Float64(x * Float64(x + -2.0)))) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 5.8e+18) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= 5.5e+138) tmp = (x * (2.0 / exp(x))) / 2.0; else tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[x, 5.8e+18], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5.5e+138], N[(N[(x * N[(2.0 / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x * N[(2.0 + N[(x * N[(x + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.8 \cdot 10^{+18}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{+138}:\\
\;\;\;\;\frac{x \cdot \frac{2}{e^{x}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(2 + x \cdot \left(x + -2\right)\right)}{2}\\
\end{array}
\end{array}
if x < 5.8e18Initial program 67.1%
*-commutative67.1%
distribute-rgt-neg-in67.1%
*-commutative67.1%
sub-neg67.1%
metadata-eval67.1%
distribute-rgt-neg-in67.1%
Simplified67.1%
Taylor expanded in eps around inf 97.9%
associate-*r*97.9%
mul-1-neg97.9%
mul-1-neg97.9%
associate-*r*97.9%
mul-1-neg97.9%
+-commutative97.9%
Simplified97.9%
Taylor expanded in eps around inf 98.0%
associate-*r*98.0%
mul-1-neg98.0%
Simplified98.0%
Taylor expanded in eps around 0 71.4%
mul-1-neg71.4%
Simplified71.4%
if 5.8e18 < x < 5.4999999999999999e138Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in eps around 0 68.1%
associate--r+68.1%
associate-*r*68.1%
mul-1-neg68.1%
cancel-sign-sub68.1%
distribute-rgt1-in68.1%
distribute-rgt-out--68.1%
mul-1-neg68.1%
mul-1-neg68.1%
Simplified68.1%
Taylor expanded in x around inf 68.1%
associate-*r*68.1%
mul-1-neg68.1%
associate-*r*68.1%
*-commutative68.1%
associate-*l*68.1%
mul-1-neg68.1%
exp-neg68.1%
associate-*l/68.1%
metadata-eval68.1%
Simplified68.1%
if 5.4999999999999999e138 < x Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in eps around 0 43.8%
associate--r+43.8%
associate-*r*43.8%
mul-1-neg43.8%
cancel-sign-sub43.8%
distribute-rgt1-in43.8%
distribute-rgt-out--43.8%
mul-1-neg43.8%
mul-1-neg43.8%
Simplified43.8%
Taylor expanded in x around inf 43.8%
associate-*r*43.8%
mul-1-neg43.8%
associate-*r*43.8%
*-commutative43.8%
associate-*l*43.8%
mul-1-neg43.8%
exp-neg43.8%
associate-*l/43.8%
metadata-eval43.8%
Simplified43.8%
Taylor expanded in x around 0 57.8%
+-commutative57.8%
unpow257.8%
distribute-rgt-out57.8%
Simplified57.8%
Final simplification68.7%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(if (<= x 5.8e+18)
(/ (+ 1.0 (exp (* (- x) eps))) 2.0)
(if (<= x 1e+139)
(/ (* x (/ 2.0 (exp x))) 2.0)
(/ (* x (+ 2.0 (* x (+ x -2.0)))) 2.0))))eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (x <= 5.8e+18) {
tmp = (1.0 + exp((-x * eps))) / 2.0;
} else if (x <= 1e+139) {
tmp = (x * (2.0 / exp(x))) / 2.0;
} else {
tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 5.8d+18) then
tmp = (1.0d0 + exp((-x * eps))) / 2.0d0
else if (x <= 1d+139) then
tmp = (x * (2.0d0 / exp(x))) / 2.0d0
else
tmp = (x * (2.0d0 + (x * (x + (-2.0d0))))) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (x <= 5.8e+18) {
tmp = (1.0 + Math.exp((-x * eps))) / 2.0;
} else if (x <= 1e+139) {
tmp = (x * (2.0 / Math.exp(x))) / 2.0;
} else {
tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if x <= 5.8e+18: tmp = (1.0 + math.exp((-x * eps))) / 2.0 elif x <= 1e+139: tmp = (x * (2.0 / math.exp(x))) / 2.0 else: tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (x <= 5.8e+18) tmp = Float64(Float64(1.0 + exp(Float64(Float64(-x) * eps))) / 2.0); elseif (x <= 1e+139) tmp = Float64(Float64(x * Float64(2.0 / exp(x))) / 2.0); else tmp = Float64(Float64(x * Float64(2.0 + Float64(x * Float64(x + -2.0)))) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 5.8e+18) tmp = (1.0 + exp((-x * eps))) / 2.0; elseif (x <= 1e+139) tmp = (x * (2.0 / exp(x))) / 2.0; else tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[x, 5.8e+18], N[(N[(1.0 + N[Exp[N[((-x) * eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1e+139], N[(N[(x * N[(2.0 / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x * N[(2.0 + N[(x * N[(x + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.8 \cdot 10^{+18}:\\
\;\;\;\;\frac{1 + e^{\left(-x\right) \cdot \varepsilon}}{2}\\
\mathbf{elif}\;x \leq 10^{+139}:\\
\;\;\;\;\frac{x \cdot \frac{2}{e^{x}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(2 + x \cdot \left(x + -2\right)\right)}{2}\\
\end{array}
\end{array}
if x < 5.8e18Initial program 67.1%
*-commutative67.1%
distribute-rgt-neg-in67.1%
*-commutative67.1%
sub-neg67.1%
metadata-eval67.1%
distribute-rgt-neg-in67.1%
Simplified67.1%
Taylor expanded in eps around inf 97.9%
associate-*r*97.9%
mul-1-neg97.9%
mul-1-neg97.9%
associate-*r*97.9%
mul-1-neg97.9%
+-commutative97.9%
Simplified97.9%
Taylor expanded in eps around inf 98.0%
associate-*r*98.0%
mul-1-neg98.0%
Simplified98.0%
Taylor expanded in x around inf 98.0%
associate-*r*98.0%
mul-1-neg98.0%
associate-*r*98.0%
mul-1-neg98.0%
Simplified98.0%
Taylor expanded in x around 0 75.9%
if 5.8e18 < x < 1.00000000000000003e139Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in eps around 0 68.1%
associate--r+68.1%
associate-*r*68.1%
mul-1-neg68.1%
cancel-sign-sub68.1%
distribute-rgt1-in68.1%
distribute-rgt-out--68.1%
mul-1-neg68.1%
mul-1-neg68.1%
Simplified68.1%
Taylor expanded in x around inf 68.1%
associate-*r*68.1%
mul-1-neg68.1%
associate-*r*68.1%
*-commutative68.1%
associate-*l*68.1%
mul-1-neg68.1%
exp-neg68.1%
associate-*l/68.1%
metadata-eval68.1%
Simplified68.1%
if 1.00000000000000003e139 < x Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in eps around 0 43.8%
associate--r+43.8%
associate-*r*43.8%
mul-1-neg43.8%
cancel-sign-sub43.8%
distribute-rgt1-in43.8%
distribute-rgt-out--43.8%
mul-1-neg43.8%
mul-1-neg43.8%
Simplified43.8%
Taylor expanded in x around inf 43.8%
associate-*r*43.8%
mul-1-neg43.8%
associate-*r*43.8%
*-commutative43.8%
associate-*l*43.8%
mul-1-neg43.8%
exp-neg43.8%
associate-*l/43.8%
metadata-eval43.8%
Simplified43.8%
Taylor expanded in x around 0 57.8%
+-commutative57.8%
unpow257.8%
distribute-rgt-out57.8%
Simplified57.8%
Final simplification71.8%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(if (<= x 5.3e-5)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (<= x 4.8e+221)
(/ (+ (+ 1.0 (/ 1.0 eps)) (+ 1.0 (/ -1.0 eps))) 2.0)
(/ (* x (+ 2.0 (* x (+ x -2.0)))) 2.0))))eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (x <= 5.3e-5) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 4.8e+221) {
tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0;
} else {
tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 5.3d-5) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= 4.8d+221) then
tmp = ((1.0d0 + (1.0d0 / eps)) + (1.0d0 + ((-1.0d0) / eps))) / 2.0d0
else
tmp = (x * (2.0d0 + (x * (x + (-2.0d0))))) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (x <= 5.3e-5) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 4.8e+221) {
tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0;
} else {
tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if x <= 5.3e-5: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 4.8e+221: tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0 else: tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (x <= 5.3e-5) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 4.8e+221) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) + Float64(1.0 + Float64(-1.0 / eps))) / 2.0); else tmp = Float64(Float64(x * Float64(2.0 + Float64(x * Float64(x + -2.0)))) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 5.3e-5) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= 4.8e+221) tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0; else tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[x, 5.3e-5], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 4.8e+221], N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x * N[(2.0 + N[(x * N[(x + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.3 \cdot 10^{-5}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{+221}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) + \left(1 + \frac{-1}{\varepsilon}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(2 + x \cdot \left(x + -2\right)\right)}{2}\\
\end{array}
\end{array}
if x < 5.3000000000000001e-5Initial program 66.5%
*-commutative66.5%
distribute-rgt-neg-in66.5%
*-commutative66.5%
sub-neg66.5%
metadata-eval66.5%
distribute-rgt-neg-in66.5%
Simplified66.5%
Taylor expanded in eps around inf 97.9%
associate-*r*97.9%
mul-1-neg97.9%
mul-1-neg97.9%
associate-*r*97.9%
mul-1-neg97.9%
+-commutative97.9%
Simplified97.9%
Taylor expanded in eps around inf 97.9%
associate-*r*97.9%
mul-1-neg97.9%
Simplified97.9%
Taylor expanded in eps around 0 72.6%
mul-1-neg72.6%
Simplified72.6%
if 5.3000000000000001e-5 < x < 4.80000000000000038e221Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 24.3%
Taylor expanded in x around 0 58.2%
if 4.80000000000000038e221 < x Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in eps around 0 38.5%
associate--r+38.5%
associate-*r*38.5%
mul-1-neg38.5%
cancel-sign-sub38.5%
distribute-rgt1-in38.5%
distribute-rgt-out--38.5%
mul-1-neg38.5%
mul-1-neg38.5%
Simplified38.5%
Taylor expanded in x around inf 38.5%
associate-*r*38.5%
mul-1-neg38.5%
associate-*r*38.5%
*-commutative38.5%
associate-*l*38.5%
mul-1-neg38.5%
exp-neg38.5%
associate-*l/38.5%
metadata-eval38.5%
Simplified38.5%
Taylor expanded in x around 0 63.1%
+-commutative63.1%
unpow263.1%
distribute-rgt-out63.1%
Simplified63.1%
Final simplification68.4%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(if (<= x 5.3e-5)
(/ (- 2.0 (* x eps)) 2.0)
(if (<= x 4.5e+221)
(/ (+ (+ 1.0 (/ 1.0 eps)) (+ 1.0 (/ -1.0 eps))) 2.0)
(/ (* x (+ 2.0 (* x (+ x -2.0)))) 2.0))))eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (x <= 5.3e-5) {
tmp = (2.0 - (x * eps)) / 2.0;
} else if (x <= 4.5e+221) {
tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0;
} else {
tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 5.3d-5) then
tmp = (2.0d0 - (x * eps)) / 2.0d0
else if (x <= 4.5d+221) then
tmp = ((1.0d0 + (1.0d0 / eps)) + (1.0d0 + ((-1.0d0) / eps))) / 2.0d0
else
tmp = (x * (2.0d0 + (x * (x + (-2.0d0))))) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (x <= 5.3e-5) {
tmp = (2.0 - (x * eps)) / 2.0;
} else if (x <= 4.5e+221) {
tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0;
} else {
tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if x <= 5.3e-5: tmp = (2.0 - (x * eps)) / 2.0 elif x <= 4.5e+221: tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0 else: tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (x <= 5.3e-5) tmp = Float64(Float64(2.0 - Float64(x * eps)) / 2.0); elseif (x <= 4.5e+221) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) + Float64(1.0 + Float64(-1.0 / eps))) / 2.0); else tmp = Float64(Float64(x * Float64(2.0 + Float64(x * Float64(x + -2.0)))) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 5.3e-5) tmp = (2.0 - (x * eps)) / 2.0; elseif (x <= 4.5e+221) tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0; else tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[x, 5.3e-5], N[(N[(2.0 - N[(x * eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 4.5e+221], N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x * N[(2.0 + N[(x * N[(x + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.3 \cdot 10^{-5}:\\
\;\;\;\;\frac{2 - x \cdot \varepsilon}{2}\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{+221}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) + \left(1 + \frac{-1}{\varepsilon}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(2 + x \cdot \left(x + -2\right)\right)}{2}\\
\end{array}
\end{array}
if x < 5.3000000000000001e-5Initial program 66.5%
*-commutative66.5%
distribute-rgt-neg-in66.5%
*-commutative66.5%
sub-neg66.5%
metadata-eval66.5%
distribute-rgt-neg-in66.5%
Simplified66.5%
Taylor expanded in x around 0 44.8%
Taylor expanded in x around 0 42.8%
Taylor expanded in eps around inf 59.6%
associate-*r*59.6%
mul-1-neg59.6%
Simplified59.6%
if 5.3000000000000001e-5 < x < 4.5000000000000002e221Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 24.3%
Taylor expanded in x around 0 58.2%
if 4.5000000000000002e221 < x Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in eps around 0 38.5%
associate--r+38.5%
associate-*r*38.5%
mul-1-neg38.5%
cancel-sign-sub38.5%
distribute-rgt1-in38.5%
distribute-rgt-out--38.5%
mul-1-neg38.5%
mul-1-neg38.5%
Simplified38.5%
Taylor expanded in x around inf 38.5%
associate-*r*38.5%
mul-1-neg38.5%
associate-*r*38.5%
*-commutative38.5%
associate-*l*38.5%
mul-1-neg38.5%
exp-neg38.5%
associate-*l/38.5%
metadata-eval38.5%
Simplified38.5%
Taylor expanded in x around 0 63.1%
+-commutative63.1%
unpow263.1%
distribute-rgt-out63.1%
Simplified63.1%
Final simplification59.6%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (if (<= x 5.3e-5) (/ (- 2.0 (* x eps)) 2.0) (/ (* x (+ 2.0 (* x (+ x -2.0)))) 2.0)))
eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (x <= 5.3e-5) {
tmp = (2.0 - (x * eps)) / 2.0;
} else {
tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 5.3d-5) then
tmp = (2.0d0 - (x * eps)) / 2.0d0
else
tmp = (x * (2.0d0 + (x * (x + (-2.0d0))))) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (x <= 5.3e-5) {
tmp = (2.0 - (x * eps)) / 2.0;
} else {
tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if x <= 5.3e-5: tmp = (2.0 - (x * eps)) / 2.0 else: tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (x <= 5.3e-5) tmp = Float64(Float64(2.0 - Float64(x * eps)) / 2.0); else tmp = Float64(Float64(x * Float64(2.0 + Float64(x * Float64(x + -2.0)))) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 5.3e-5) tmp = (2.0 - (x * eps)) / 2.0; else tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[x, 5.3e-5], N[(N[(2.0 - N[(x * eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x * N[(2.0 + N[(x * N[(x + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.3 \cdot 10^{-5}:\\
\;\;\;\;\frac{2 - x \cdot \varepsilon}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(2 + x \cdot \left(x + -2\right)\right)}{2}\\
\end{array}
\end{array}
if x < 5.3000000000000001e-5Initial program 66.5%
*-commutative66.5%
distribute-rgt-neg-in66.5%
*-commutative66.5%
sub-neg66.5%
metadata-eval66.5%
distribute-rgt-neg-in66.5%
Simplified66.5%
Taylor expanded in x around 0 44.8%
Taylor expanded in x around 0 42.8%
Taylor expanded in eps around inf 59.6%
associate-*r*59.6%
mul-1-neg59.6%
Simplified59.6%
if 5.3000000000000001e-5 < x Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in eps around 0 53.2%
associate--r+53.2%
associate-*r*53.2%
mul-1-neg53.2%
cancel-sign-sub53.2%
distribute-rgt1-in53.2%
distribute-rgt-out--53.2%
mul-1-neg53.2%
mul-1-neg53.2%
Simplified53.2%
Taylor expanded in x around inf 53.2%
associate-*r*53.2%
mul-1-neg53.2%
associate-*r*53.2%
*-commutative53.2%
associate-*l*53.2%
mul-1-neg53.2%
exp-neg53.2%
associate-*l/53.2%
metadata-eval53.2%
Simplified53.2%
Taylor expanded in x around 0 34.6%
+-commutative34.6%
unpow234.6%
distribute-rgt-out34.6%
Simplified34.6%
Final simplification51.6%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (if (<= x 5.3e-5) (/ (- 2.0 (* x eps)) 2.0) (/ (* x eps) 2.0)))
eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (x <= 5.3e-5) {
tmp = (2.0 - (x * eps)) / 2.0;
} else {
tmp = (x * eps) / 2.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 5.3d-5) then
tmp = (2.0d0 - (x * eps)) / 2.0d0
else
tmp = (x * eps) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (x <= 5.3e-5) {
tmp = (2.0 - (x * eps)) / 2.0;
} else {
tmp = (x * eps) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if x <= 5.3e-5: tmp = (2.0 - (x * eps)) / 2.0 else: tmp = (x * eps) / 2.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (x <= 5.3e-5) tmp = Float64(Float64(2.0 - Float64(x * eps)) / 2.0); else tmp = Float64(Float64(x * eps) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 5.3e-5) tmp = (2.0 - (x * eps)) / 2.0; else tmp = (x * eps) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[x, 5.3e-5], N[(N[(2.0 - N[(x * eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x * eps), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.3 \cdot 10^{-5}:\\
\;\;\;\;\frac{2 - x \cdot \varepsilon}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \varepsilon}{2}\\
\end{array}
\end{array}
if x < 5.3000000000000001e-5Initial program 66.5%
*-commutative66.5%
distribute-rgt-neg-in66.5%
*-commutative66.5%
sub-neg66.5%
metadata-eval66.5%
distribute-rgt-neg-in66.5%
Simplified66.5%
Taylor expanded in x around 0 44.8%
Taylor expanded in x around 0 42.8%
Taylor expanded in eps around inf 59.6%
associate-*r*59.6%
mul-1-neg59.6%
Simplified59.6%
if 5.3000000000000001e-5 < x Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 23.5%
associate-*r*23.5%
mul-1-neg23.5%
Simplified23.5%
Taylor expanded in eps around inf 12.3%
*-commutative12.3%
Simplified12.3%
Final simplification44.4%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (if (<= x 5.3e-5) 1.0 (/ (* x eps) 2.0)))
eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (x <= 5.3e-5) {
tmp = 1.0;
} else {
tmp = (x * eps) / 2.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 5.3d-5) then
tmp = 1.0d0
else
tmp = (x * eps) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (x <= 5.3e-5) {
tmp = 1.0;
} else {
tmp = (x * eps) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if x <= 5.3e-5: tmp = 1.0 else: tmp = (x * eps) / 2.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (x <= 5.3e-5) tmp = 1.0; else tmp = Float64(Float64(x * eps) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 5.3e-5) tmp = 1.0; else tmp = (x * eps) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[x, 5.3e-5], 1.0, N[(N[(x * eps), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.3 \cdot 10^{-5}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \varepsilon}{2}\\
\end{array}
\end{array}
if x < 5.3000000000000001e-5Initial program 66.5%
*-commutative66.5%
distribute-rgt-neg-in66.5%
*-commutative66.5%
sub-neg66.5%
metadata-eval66.5%
distribute-rgt-neg-in66.5%
Simplified66.5%
Taylor expanded in x around 0 53.5%
if 5.3000000000000001e-5 < x Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 23.5%
associate-*r*23.5%
mul-1-neg23.5%
Simplified23.5%
Taylor expanded in eps around inf 12.3%
*-commutative12.3%
Simplified12.3%
Final simplification40.3%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 1.0)
eps = abs(eps);
double code(double x, double eps) {
return 1.0;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = 1.0d0
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
return 1.0;
}
eps = abs(eps) def code(x, eps): return 1.0
eps = abs(eps) function code(x, eps) return 1.0 end
eps = abs(eps) function tmp = code(x, eps) tmp = 1.0; end
NOTE: eps should be positive before calling this function code[x_, eps_] := 1.0
\begin{array}{l}
eps = |eps|\\
\\
1
\end{array}
Initial program 77.2%
*-commutative77.2%
distribute-rgt-neg-in77.2%
*-commutative77.2%
sub-neg77.2%
metadata-eval77.2%
distribute-rgt-neg-in77.2%
Simplified77.2%
Taylor expanded in x around 0 37.4%
Final simplification37.4%
herbie shell --seed 2023301
(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))