
(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 19 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (* (+ x 1.0) (exp (- x)))))
(if (<= eps_m 0.22)
(/ (+ t_0 t_0) 2.0)
(/ (+ (exp (* x eps_m)) (exp (* x (- eps_m)))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = (x + 1.0) * exp(-x);
double tmp;
if (eps_m <= 0.22) {
tmp = (t_0 + t_0) / 2.0;
} else {
tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: tmp
t_0 = (x + 1.0d0) * exp(-x)
if (eps_m <= 0.22d0) then
tmp = (t_0 + t_0) / 2.0d0
else
tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = (x + 1.0) * Math.exp(-x);
double tmp;
if (eps_m <= 0.22) {
tmp = (t_0 + t_0) / 2.0;
} else {
tmp = (Math.exp((x * eps_m)) + Math.exp((x * -eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = (x + 1.0) * math.exp(-x) tmp = 0 if eps_m <= 0.22: tmp = (t_0 + t_0) / 2.0 else: tmp = (math.exp((x * eps_m)) + math.exp((x * -eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(Float64(x + 1.0) * exp(Float64(-x))) tmp = 0.0 if (eps_m <= 0.22) tmp = Float64(Float64(t_0 + t_0) / 2.0); else tmp = Float64(Float64(exp(Float64(x * eps_m)) + exp(Float64(x * Float64(-eps_m)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = (x + 1.0) * exp(-x); tmp = 0.0; if (eps_m <= 0.22) tmp = (t_0 + t_0) / 2.0; else tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(N[(x + 1.0), $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps$95$m, 0.22], N[(N[(t$95$0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := \left(x + 1\right) \cdot e^{-x}\\
\mathbf{if}\;eps\_m \leq 0.22:\\
\;\;\;\;\frac{t\_0 + t\_0}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot eps\_m} + e^{x \cdot \left(-eps\_m\right)}}{2}\\
\end{array}
\end{array}
if eps < 0.220000000000000001Initial program 60.8%
Simplified60.8%
Taylor expanded in eps around 0 71.4%
distribute-rgt1-in71.4%
mul-1-neg71.4%
distribute-lft-out71.4%
distribute-rgt1-in71.4%
mul-1-neg71.4%
Simplified71.4%
if 0.220000000000000001 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
associate-*r*100.0%
neg-mul-1100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
mul-1-neg100.0%
*-commutative100.0%
distribute-lft-neg-in100.0%
Simplified100.0%
Final simplification79.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (or (<= x 2.7e+54) (not (<= x 8.5e+100))) (/ (+ (exp (* x eps_m)) (exp (* x (- eps_m)))) 2.0) (/ x (exp x))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if ((x <= 2.7e+54) || !(x <= 8.5e+100)) {
tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0;
} else {
tmp = x / exp(x);
}
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 <= 2.7d+54) .or. (.not. (x <= 8.5d+100))) then
tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0d0
else
tmp = x / exp(x)
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if ((x <= 2.7e+54) || !(x <= 8.5e+100)) {
tmp = (Math.exp((x * eps_m)) + Math.exp((x * -eps_m))) / 2.0;
} else {
tmp = x / Math.exp(x);
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if (x <= 2.7e+54) or not (x <= 8.5e+100): tmp = (math.exp((x * eps_m)) + math.exp((x * -eps_m))) / 2.0 else: tmp = x / math.exp(x) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if ((x <= 2.7e+54) || !(x <= 8.5e+100)) tmp = Float64(Float64(exp(Float64(x * eps_m)) + exp(Float64(x * Float64(-eps_m)))) / 2.0); else tmp = Float64(x / exp(x)); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if ((x <= 2.7e+54) || ~((x <= 8.5e+100))) tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0; else tmp = x / exp(x); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[Or[LessEqual[x, 2.7e+54], N[Not[LessEqual[x, 8.5e+100]], $MachinePrecision]], N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(x / N[Exp[x], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.7 \cdot 10^{+54} \lor \neg \left(x \leq 8.5 \cdot 10^{+100}\right):\\
\;\;\;\;\frac{e^{x \cdot eps\_m} + e^{x \cdot \left(-eps\_m\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{e^{x}}\\
\end{array}
\end{array}
if x < 2.70000000000000011e54 or 8.50000000000000043e100 < x Initial program 70.8%
Simplified70.8%
Taylor expanded in eps around inf 99.5%
Taylor expanded in eps around inf 91.9%
associate-*r*91.9%
neg-mul-191.9%
Simplified91.9%
Taylor expanded in eps around inf 90.2%
*-commutative90.2%
Simplified90.2%
Taylor expanded in eps around inf 90.2%
mul-1-neg90.2%
mul-1-neg90.2%
*-commutative90.2%
distribute-lft-neg-in90.2%
Simplified90.2%
if 2.70000000000000011e54 < x < 8.50000000000000043e100Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 85.9%
associate--r+85.9%
associate-*r*85.9%
mul-1-neg85.9%
cancel-sign-sub85.9%
distribute-rgt1-in85.9%
distribute-rgt-out--85.9%
mul-1-neg85.9%
mul-1-neg85.9%
Simplified85.9%
Taylor expanded in x around inf 85.9%
rec-exp85.9%
associate-*r/85.9%
*-rgt-identity85.9%
Simplified85.9%
Final simplification89.9%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (- x))))
(if (<= eps_m 0.22)
(/ (+ (* t_0 (+ 1.0 (+ x 1.0))) (* x t_0)) 2.0)
(/ (+ (exp (* x eps_m)) (exp (* x (- eps_m)))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp(-x);
double tmp;
if (eps_m <= 0.22) {
tmp = ((t_0 * (1.0 + (x + 1.0))) + (x * t_0)) / 2.0;
} else {
tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: tmp
t_0 = exp(-x)
if (eps_m <= 0.22d0) then
tmp = ((t_0 * (1.0d0 + (x + 1.0d0))) + (x * t_0)) / 2.0d0
else
tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = Math.exp(-x);
double tmp;
if (eps_m <= 0.22) {
tmp = ((t_0 * (1.0 + (x + 1.0))) + (x * t_0)) / 2.0;
} else {
tmp = (Math.exp((x * eps_m)) + Math.exp((x * -eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp(-x) tmp = 0 if eps_m <= 0.22: tmp = ((t_0 * (1.0 + (x + 1.0))) + (x * t_0)) / 2.0 else: tmp = (math.exp((x * eps_m)) + math.exp((x * -eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(-x)) tmp = 0.0 if (eps_m <= 0.22) 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 * eps_m)) + exp(Float64(x * Float64(-eps_m)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp(-x); tmp = 0.0; if (eps_m <= 0.22) tmp = ((t_0 * (1.0 + (x + 1.0))) + (x * t_0)) / 2.0; else tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Exp[(-x)], $MachinePrecision]}, If[LessEqual[eps$95$m, 0.22], 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 * eps$95$m), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{-x}\\
\mathbf{if}\;eps\_m \leq 0.22:\\
\;\;\;\;\frac{t\_0 \cdot \left(1 + \left(x + 1\right)\right) + x \cdot t\_0}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot eps\_m} + e^{x \cdot \left(-eps\_m\right)}}{2}\\
\end{array}
\end{array}
if eps < 0.220000000000000001Initial program 60.8%
Simplified60.8%
Taylor expanded in eps around 0 71.4%
associate--r+71.4%
associate-*r*71.4%
mul-1-neg71.4%
cancel-sign-sub71.4%
distribute-rgt1-in71.4%
distribute-rgt-out--71.4%
mul-1-neg71.4%
mul-1-neg71.4%
Simplified71.4%
if 0.220000000000000001 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
associate-*r*100.0%
neg-mul-1100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
mul-1-neg100.0%
*-commutative100.0%
distribute-lft-neg-in100.0%
Simplified100.0%
Final simplification79.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 0.22) (/ (+ (exp (* x (- -1.0 eps_m))) (exp (- x))) 2.0) (/ (+ (exp (* x eps_m)) (exp (* x (- eps_m)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 0.22) {
tmp = (exp((x * (-1.0 - eps_m))) + exp(-x)) / 2.0;
} else {
tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (eps_m <= 0.22d0) then
tmp = (exp((x * ((-1.0d0) - eps_m))) + exp(-x)) / 2.0d0
else
tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (eps_m <= 0.22) {
tmp = (Math.exp((x * (-1.0 - eps_m))) + Math.exp(-x)) / 2.0;
} else {
tmp = (Math.exp((x * eps_m)) + Math.exp((x * -eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 0.22: tmp = (math.exp((x * (-1.0 - eps_m))) + math.exp(-x)) / 2.0 else: tmp = (math.exp((x * eps_m)) + math.exp((x * -eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 0.22) tmp = Float64(Float64(exp(Float64(x * Float64(-1.0 - eps_m))) + exp(Float64(-x))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * eps_m)) + exp(Float64(x * Float64(-eps_m)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 0.22) tmp = (exp((x * (-1.0 - eps_m))) + exp(-x)) / 2.0; else tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 0.22], N[(N[(N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 0.22:\\
\;\;\;\;\frac{e^{x \cdot \left(-1 - eps\_m\right)} + e^{-x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot eps\_m} + e^{x \cdot \left(-eps\_m\right)}}{2}\\
\end{array}
\end{array}
if eps < 0.220000000000000001Initial program 60.8%
Simplified60.8%
Taylor expanded in eps around inf 99.4%
Taylor expanded in eps around 0 92.6%
neg-mul-192.6%
Simplified92.6%
if 0.220000000000000001 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
associate-*r*100.0%
neg-mul-1100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
mul-1-neg100.0%
*-commutative100.0%
distribute-lft-neg-in100.0%
Simplified100.0%
Final simplification94.8%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* x (+ -1.0 eps_m))) (exp (* x (- -1.0 eps_m)))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * (-1.0 + eps_m))) + exp((x * (-1.0 - eps_m)))) / 2.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = (exp((x * ((-1.0d0) + eps_m))) + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return (Math.exp((x * (-1.0 + eps_m))) + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.exp((x * (-1.0 + eps_m))) + math.exp((x * (-1.0 - eps_m)))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(exp(Float64(x * Float64(-1.0 + eps_m))) + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((x * (-1.0 + eps_m))) + exp((x * (-1.0 - eps_m)))) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\frac{e^{x \cdot \left(-1 + eps\_m\right)} + e^{x \cdot \left(-1 - eps\_m\right)}}{2}
\end{array}
Initial program 72.4%
Simplified72.4%
Taylor expanded in eps around inf 99.6%
Final simplification99.6%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 2e-277)
(+ 0.5 (/ 0.5 (exp x)))
(if (or (<= x 3.7e+52) (not (<= x 4e+100)))
(/ (+ 1.0 (exp (* x eps_m))) 2.0)
(/ x (exp x)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 2e-277) {
tmp = 0.5 + (0.5 / exp(x));
} else if ((x <= 3.7e+52) || !(x <= 4e+100)) {
tmp = (1.0 + exp((x * eps_m))) / 2.0;
} else {
tmp = x / exp(x);
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 2d-277) then
tmp = 0.5d0 + (0.5d0 / exp(x))
else if ((x <= 3.7d+52) .or. (.not. (x <= 4d+100))) then
tmp = (1.0d0 + exp((x * eps_m))) / 2.0d0
else
tmp = x / exp(x)
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 2e-277) {
tmp = 0.5 + (0.5 / Math.exp(x));
} else if ((x <= 3.7e+52) || !(x <= 4e+100)) {
tmp = (1.0 + Math.exp((x * eps_m))) / 2.0;
} else {
tmp = x / Math.exp(x);
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 2e-277: tmp = 0.5 + (0.5 / math.exp(x)) elif (x <= 3.7e+52) or not (x <= 4e+100): tmp = (1.0 + math.exp((x * eps_m))) / 2.0 else: tmp = x / math.exp(x) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 2e-277) tmp = Float64(0.5 + Float64(0.5 / exp(x))); elseif ((x <= 3.7e+52) || !(x <= 4e+100)) tmp = Float64(Float64(1.0 + exp(Float64(x * eps_m))) / 2.0); else tmp = Float64(x / exp(x)); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 2e-277) tmp = 0.5 + (0.5 / exp(x)); elseif ((x <= 3.7e+52) || ~((x <= 4e+100))) tmp = (1.0 + exp((x * eps_m))) / 2.0; else tmp = x / exp(x); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 2e-277], N[(0.5 + N[(0.5 / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, 3.7e+52], N[Not[LessEqual[x, 4e+100]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(x / N[Exp[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{-277}:\\
\;\;\;\;0.5 + \frac{0.5}{e^{x}}\\
\mathbf{elif}\;x \leq 3.7 \cdot 10^{+52} \lor \neg \left(x \leq 4 \cdot 10^{+100}\right):\\
\;\;\;\;\frac{1 + e^{x \cdot eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{e^{x}}\\
\end{array}
\end{array}
if x < 1.99999999999999994e-277Initial program 68.9%
Simplified68.9%
Taylor expanded in eps around inf 99.3%
Taylor expanded in eps around inf 99.3%
associate-*r*99.3%
neg-mul-199.3%
Simplified99.3%
Taylor expanded in eps around 0 83.0%
mul-1-neg83.0%
Simplified83.0%
Taylor expanded in x around inf 83.0%
distribute-lft-in83.0%
metadata-eval83.0%
exp-neg83.0%
associate-*r/83.0%
metadata-eval83.0%
Simplified83.0%
if 1.99999999999999994e-277 < x < 3.7e52 or 4.00000000000000006e100 < x Initial program 72.3%
Simplified72.3%
Taylor expanded in eps around inf 99.8%
Taylor expanded in eps around inf 86.1%
associate-*r*86.1%
neg-mul-186.1%
Simplified86.1%
Taylor expanded in eps around inf 82.8%
*-commutative82.8%
Simplified82.8%
Taylor expanded in eps around 0 67.9%
if 3.7e52 < x < 4.00000000000000006e100Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 85.9%
associate--r+85.9%
associate-*r*85.9%
mul-1-neg85.9%
cancel-sign-sub85.9%
distribute-rgt1-in85.9%
distribute-rgt-out--85.9%
mul-1-neg85.9%
mul-1-neg85.9%
Simplified85.9%
Taylor expanded in x around inf 85.9%
rec-exp85.9%
associate-*r/85.9%
*-rgt-identity85.9%
Simplified85.9%
Final simplification75.1%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (* x eps_m))))
(if (<= x -9.5e-189)
(/ (* x (+ (/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) x) (+ -1.0 eps_m))) 2.0)
(if (<= x 7.5e+46)
(/ (+ t_0 (- 1.0 (* x eps_m))) 2.0)
(if (<= x 9.6e+101) (/ x (exp x)) (/ (+ 1.0 t_0) 2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * eps_m));
double tmp;
if (x <= -9.5e-189) {
tmp = (x * (((1.0 + exp((x * (-1.0 - eps_m)))) / x) + (-1.0 + eps_m))) / 2.0;
} else if (x <= 7.5e+46) {
tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0;
} else if (x <= 9.6e+101) {
tmp = x / exp(x);
} else {
tmp = (1.0 + t_0) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: tmp
t_0 = exp((x * eps_m))
if (x <= (-9.5d-189)) then
tmp = (x * (((1.0d0 + exp((x * ((-1.0d0) - eps_m)))) / x) + ((-1.0d0) + eps_m))) / 2.0d0
else if (x <= 7.5d+46) then
tmp = (t_0 + (1.0d0 - (x * eps_m))) / 2.0d0
else if (x <= 9.6d+101) then
tmp = x / exp(x)
else
tmp = (1.0d0 + t_0) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = Math.exp((x * eps_m));
double tmp;
if (x <= -9.5e-189) {
tmp = (x * (((1.0 + Math.exp((x * (-1.0 - eps_m)))) / x) + (-1.0 + eps_m))) / 2.0;
} else if (x <= 7.5e+46) {
tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0;
} else if (x <= 9.6e+101) {
tmp = x / Math.exp(x);
} else {
tmp = (1.0 + t_0) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * eps_m)) tmp = 0 if x <= -9.5e-189: tmp = (x * (((1.0 + math.exp((x * (-1.0 - eps_m)))) / x) + (-1.0 + eps_m))) / 2.0 elif x <= 7.5e+46: tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0 elif x <= 9.6e+101: tmp = x / math.exp(x) else: tmp = (1.0 + t_0) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * eps_m)) tmp = 0.0 if (x <= -9.5e-189) tmp = Float64(Float64(x * Float64(Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / x) + Float64(-1.0 + eps_m))) / 2.0); elseif (x <= 7.5e+46) tmp = Float64(Float64(t_0 + Float64(1.0 - Float64(x * eps_m))) / 2.0); elseif (x <= 9.6e+101) tmp = Float64(x / exp(x)); else tmp = Float64(Float64(1.0 + t_0) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp((x * eps_m)); tmp = 0.0; if (x <= -9.5e-189) tmp = (x * (((1.0 + exp((x * (-1.0 - eps_m)))) / x) + (-1.0 + eps_m))) / 2.0; elseif (x <= 7.5e+46) tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0; elseif (x <= 9.6e+101) tmp = x / exp(x); else tmp = (1.0 + t_0) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -9.5e-189], N[(N[(x * N[(N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 7.5e+46], N[(N[(t$95$0 + N[(1.0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 9.6e+101], N[(x / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot eps\_m}\\
\mathbf{if}\;x \leq -9.5 \cdot 10^{-189}:\\
\;\;\;\;\frac{x \cdot \left(\frac{1 + e^{x \cdot \left(-1 - eps\_m\right)}}{x} + \left(-1 + eps\_m\right)\right)}{2}\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{+46}:\\
\;\;\;\;\frac{t\_0 + \left(1 - x \cdot eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 9.6 \cdot 10^{+101}:\\
\;\;\;\;\frac{x}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + t\_0}{2}\\
\end{array}
\end{array}
if x < -9.499999999999999e-189Initial program 80.9%
Simplified80.9%
Taylor expanded in eps around inf 98.9%
Taylor expanded in x around 0 65.1%
neg-mul-165.1%
unsub-neg65.1%
Simplified65.1%
Taylor expanded in x around -inf 70.7%
associate-*r*70.7%
mul-1-neg70.7%
distribute-lft-out--70.7%
mul-1-neg70.7%
mul-1-neg70.7%
+-commutative70.7%
Simplified70.7%
if -9.499999999999999e-189 < x < 7.5000000000000003e46Initial program 51.3%
Simplified51.3%
Taylor expanded in eps around inf 99.7%
Taylor expanded in eps around inf 97.2%
associate-*r*97.2%
neg-mul-197.2%
Simplified97.2%
Taylor expanded in eps around inf 97.5%
*-commutative97.5%
Simplified97.5%
Taylor expanded in eps around 0 87.4%
if 7.5000000000000003e46 < x < 9.59999999999999953e101Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 85.9%
associate--r+85.9%
associate-*r*85.9%
mul-1-neg85.9%
cancel-sign-sub85.9%
distribute-rgt1-in85.9%
distribute-rgt-out--85.9%
mul-1-neg85.9%
mul-1-neg85.9%
Simplified85.9%
Taylor expanded in x around inf 85.9%
rec-exp85.9%
associate-*r/85.9%
*-rgt-identity85.9%
Simplified85.9%
if 9.59999999999999953e101 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 71.1%
associate-*r*71.1%
neg-mul-171.1%
Simplified71.1%
Taylor expanded in eps around inf 62.0%
*-commutative62.0%
Simplified62.0%
Taylor expanded in eps around 0 44.2%
Final simplification73.6%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (* x eps_m))))
(if (<= x -9.5e-189)
(/ (+ (- 1.0 x) (exp (* x (- eps_m)))) 2.0)
(if (<= x 1.1e+45)
(/ (+ t_0 (- 1.0 (* x eps_m))) 2.0)
(if (<= x 1.3e+103) (/ x (exp x)) (/ (+ 1.0 t_0) 2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * eps_m));
double tmp;
if (x <= -9.5e-189) {
tmp = ((1.0 - x) + exp((x * -eps_m))) / 2.0;
} else if (x <= 1.1e+45) {
tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0;
} else if (x <= 1.3e+103) {
tmp = x / exp(x);
} else {
tmp = (1.0 + t_0) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: tmp
t_0 = exp((x * eps_m))
if (x <= (-9.5d-189)) then
tmp = ((1.0d0 - x) + exp((x * -eps_m))) / 2.0d0
else if (x <= 1.1d+45) then
tmp = (t_0 + (1.0d0 - (x * eps_m))) / 2.0d0
else if (x <= 1.3d+103) then
tmp = x / exp(x)
else
tmp = (1.0d0 + t_0) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = Math.exp((x * eps_m));
double tmp;
if (x <= -9.5e-189) {
tmp = ((1.0 - x) + Math.exp((x * -eps_m))) / 2.0;
} else if (x <= 1.1e+45) {
tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0;
} else if (x <= 1.3e+103) {
tmp = x / Math.exp(x);
} else {
tmp = (1.0 + t_0) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * eps_m)) tmp = 0 if x <= -9.5e-189: tmp = ((1.0 - x) + math.exp((x * -eps_m))) / 2.0 elif x <= 1.1e+45: tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0 elif x <= 1.3e+103: tmp = x / math.exp(x) else: tmp = (1.0 + t_0) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * eps_m)) tmp = 0.0 if (x <= -9.5e-189) tmp = Float64(Float64(Float64(1.0 - x) + exp(Float64(x * Float64(-eps_m)))) / 2.0); elseif (x <= 1.1e+45) tmp = Float64(Float64(t_0 + Float64(1.0 - Float64(x * eps_m))) / 2.0); elseif (x <= 1.3e+103) tmp = Float64(x / exp(x)); else tmp = Float64(Float64(1.0 + t_0) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp((x * eps_m)); tmp = 0.0; if (x <= -9.5e-189) tmp = ((1.0 - x) + exp((x * -eps_m))) / 2.0; elseif (x <= 1.1e+45) tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0; elseif (x <= 1.3e+103) tmp = x / exp(x); else tmp = (1.0 + t_0) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -9.5e-189], N[(N[(N[(1.0 - x), $MachinePrecision] + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.1e+45], N[(N[(t$95$0 + N[(1.0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.3e+103], N[(x / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot eps\_m}\\
\mathbf{if}\;x \leq -9.5 \cdot 10^{-189}:\\
\;\;\;\;\frac{\left(1 - x\right) + e^{x \cdot \left(-eps\_m\right)}}{2}\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{+45}:\\
\;\;\;\;\frac{t\_0 + \left(1 - x \cdot eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{+103}:\\
\;\;\;\;\frac{x}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + t\_0}{2}\\
\end{array}
\end{array}
if x < -9.499999999999999e-189Initial program 80.9%
Simplified80.9%
Taylor expanded in eps around inf 98.9%
Taylor expanded in x around 0 65.1%
neg-mul-165.1%
unsub-neg65.1%
Simplified65.1%
Taylor expanded in eps around inf 65.1%
associate-*r*98.9%
neg-mul-198.9%
Simplified65.1%
Taylor expanded in eps around 0 59.0%
if -9.499999999999999e-189 < x < 1.1e45Initial program 51.3%
Simplified51.3%
Taylor expanded in eps around inf 99.7%
Taylor expanded in eps around inf 97.2%
associate-*r*97.2%
neg-mul-197.2%
Simplified97.2%
Taylor expanded in eps around inf 97.5%
*-commutative97.5%
Simplified97.5%
Taylor expanded in eps around 0 87.4%
if 1.1e45 < x < 1.3000000000000001e103Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 85.9%
associate--r+85.9%
associate-*r*85.9%
mul-1-neg85.9%
cancel-sign-sub85.9%
distribute-rgt1-in85.9%
distribute-rgt-out--85.9%
mul-1-neg85.9%
mul-1-neg85.9%
Simplified85.9%
Taylor expanded in x around inf 85.9%
rec-exp85.9%
associate-*r/85.9%
*-rgt-identity85.9%
Simplified85.9%
if 1.3000000000000001e103 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 71.1%
associate-*r*71.1%
neg-mul-171.1%
Simplified71.1%
Taylor expanded in eps around inf 62.0%
*-commutative62.0%
Simplified62.0%
Taylor expanded in eps around 0 44.2%
Final simplification70.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (* x eps_m))))
(if (<= x -450.0)
(+ 0.5 (/ 0.5 (exp x)))
(if (<= x 1.9e+49)
(/ (+ t_0 (- 1.0 (* x eps_m))) 2.0)
(if (<= x 4.3e+100) (/ x (exp x)) (/ (+ 1.0 t_0) 2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * eps_m));
double tmp;
if (x <= -450.0) {
tmp = 0.5 + (0.5 / exp(x));
} else if (x <= 1.9e+49) {
tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0;
} else if (x <= 4.3e+100) {
tmp = x / exp(x);
} else {
tmp = (1.0 + t_0) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: tmp
t_0 = exp((x * eps_m))
if (x <= (-450.0d0)) then
tmp = 0.5d0 + (0.5d0 / exp(x))
else if (x <= 1.9d+49) then
tmp = (t_0 + (1.0d0 - (x * eps_m))) / 2.0d0
else if (x <= 4.3d+100) then
tmp = x / exp(x)
else
tmp = (1.0d0 + t_0) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = Math.exp((x * eps_m));
double tmp;
if (x <= -450.0) {
tmp = 0.5 + (0.5 / Math.exp(x));
} else if (x <= 1.9e+49) {
tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0;
} else if (x <= 4.3e+100) {
tmp = x / Math.exp(x);
} else {
tmp = (1.0 + t_0) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * eps_m)) tmp = 0 if x <= -450.0: tmp = 0.5 + (0.5 / math.exp(x)) elif x <= 1.9e+49: tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0 elif x <= 4.3e+100: tmp = x / math.exp(x) else: tmp = (1.0 + t_0) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * eps_m)) tmp = 0.0 if (x <= -450.0) tmp = Float64(0.5 + Float64(0.5 / exp(x))); elseif (x <= 1.9e+49) tmp = Float64(Float64(t_0 + Float64(1.0 - Float64(x * eps_m))) / 2.0); elseif (x <= 4.3e+100) tmp = Float64(x / exp(x)); else tmp = Float64(Float64(1.0 + t_0) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp((x * eps_m)); tmp = 0.0; if (x <= -450.0) tmp = 0.5 + (0.5 / exp(x)); elseif (x <= 1.9e+49) tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0; elseif (x <= 4.3e+100) tmp = x / exp(x); else tmp = (1.0 + t_0) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -450.0], N[(0.5 + N[(0.5 / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.9e+49], N[(N[(t$95$0 + N[(1.0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 4.3e+100], N[(x / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot eps\_m}\\
\mathbf{if}\;x \leq -450:\\
\;\;\;\;0.5 + \frac{0.5}{e^{x}}\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{+49}:\\
\;\;\;\;\frac{t\_0 + \left(1 - x \cdot eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 4.3 \cdot 10^{+100}:\\
\;\;\;\;\frac{x}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + t\_0}{2}\\
\end{array}
\end{array}
if x < -450Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
associate-*r*100.0%
neg-mul-1100.0%
Simplified100.0%
Taylor expanded in eps around 0 100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
distribute-lft-in100.0%
metadata-eval100.0%
exp-neg100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
if -450 < x < 1.8999999999999999e49Initial program 54.8%
Simplified54.8%
Taylor expanded in eps around inf 99.3%
Taylor expanded in eps around inf 97.4%
associate-*r*97.4%
neg-mul-197.4%
Simplified97.4%
Taylor expanded in eps around inf 97.9%
*-commutative97.9%
Simplified97.9%
Taylor expanded in eps around 0 86.4%
if 1.8999999999999999e49 < x < 4.29999999999999993e100Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 85.9%
associate--r+85.9%
associate-*r*85.9%
mul-1-neg85.9%
cancel-sign-sub85.9%
distribute-rgt1-in85.9%
distribute-rgt-out--85.9%
mul-1-neg85.9%
mul-1-neg85.9%
Simplified85.9%
Taylor expanded in x around inf 85.9%
rec-exp85.9%
associate-*r/85.9%
*-rgt-identity85.9%
Simplified85.9%
if 4.29999999999999993e100 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 71.1%
associate-*r*71.1%
neg-mul-171.1%
Simplified71.1%
Taylor expanded in eps around inf 62.0%
*-commutative62.0%
Simplified62.0%
Taylor expanded in eps around 0 44.2%
Final simplification79.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 1.45e+16)
(+ 0.5 (/ 0.5 (exp x)))
(if (<= x 9e+103)
(/ x (exp x))
(+ 1.0 (* (* x x) (- (* x 0.3333333333333333) 0.5))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1.45e+16) {
tmp = 0.5 + (0.5 / exp(x));
} else if (x <= 9e+103) {
tmp = x / exp(x);
} else {
tmp = 1.0 + ((x * x) * ((x * 0.3333333333333333) - 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.45d+16) then
tmp = 0.5d0 + (0.5d0 / exp(x))
else if (x <= 9d+103) then
tmp = x / exp(x)
else
tmp = 1.0d0 + ((x * x) * ((x * 0.3333333333333333d0) - 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.45e+16) {
tmp = 0.5 + (0.5 / Math.exp(x));
} else if (x <= 9e+103) {
tmp = x / Math.exp(x);
} else {
tmp = 1.0 + ((x * x) * ((x * 0.3333333333333333) - 0.5));
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1.45e+16: tmp = 0.5 + (0.5 / math.exp(x)) elif x <= 9e+103: tmp = x / math.exp(x) else: tmp = 1.0 + ((x * x) * ((x * 0.3333333333333333) - 0.5)) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1.45e+16) tmp = Float64(0.5 + Float64(0.5 / exp(x))); elseif (x <= 9e+103) tmp = Float64(x / exp(x)); else tmp = Float64(1.0 + Float64(Float64(x * x) * Float64(Float64(x * 0.3333333333333333) - 0.5))); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 1.45e+16) tmp = 0.5 + (0.5 / exp(x)); elseif (x <= 9e+103) tmp = x / exp(x); else tmp = 1.0 + ((x * x) * ((x * 0.3333333333333333) - 0.5)); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 1.45e+16], N[(0.5 + N[(0.5 / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 9e+103], N[(x / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x * x), $MachinePrecision] * N[(N[(x * 0.3333333333333333), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.45 \cdot 10^{+16}:\\
\;\;\;\;0.5 + \frac{0.5}{e^{x}}\\
\mathbf{elif}\;x \leq 9 \cdot 10^{+103}:\\
\;\;\;\;\frac{x}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x \cdot x\right) \cdot \left(x \cdot 0.3333333333333333 - 0.5\right)\\
\end{array}
\end{array}
if x < 1.45e16Initial program 61.0%
Simplified61.0%
Taylor expanded in eps around inf 99.4%
Taylor expanded in eps around inf 99.4%
associate-*r*99.4%
neg-mul-199.4%
Simplified99.4%
Taylor expanded in eps around 0 79.7%
mul-1-neg79.7%
Simplified79.7%
Taylor expanded in x around inf 79.7%
distribute-lft-in79.7%
metadata-eval79.7%
exp-neg79.7%
associate-*r/79.7%
metadata-eval79.7%
Simplified79.7%
if 1.45e16 < x < 9.00000000000000002e103Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 71.9%
associate--r+71.9%
associate-*r*71.9%
mul-1-neg71.9%
cancel-sign-sub71.9%
distribute-rgt1-in71.9%
distribute-rgt-out--71.9%
mul-1-neg71.9%
mul-1-neg71.9%
Simplified71.9%
Taylor expanded in x around inf 71.9%
rec-exp71.9%
associate-*r/71.9%
*-rgt-identity71.9%
Simplified71.9%
if 9.00000000000000002e103 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 39.8%
associate--r+39.8%
associate-*r*39.8%
mul-1-neg39.8%
cancel-sign-sub39.8%
distribute-rgt1-in39.8%
distribute-rgt-out--39.8%
mul-1-neg39.8%
mul-1-neg39.8%
Simplified39.8%
Taylor expanded in x around 0 61.7%
unpow261.7%
Applied egg-rr61.7%
Final simplification75.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 2.2)
(+ 1.0 (* x (- (* x (+ 0.25 (* x -0.08333333333333333))) 0.5)))
(if (<= x 4e+100)
(/ x (exp x))
(+ 1.0 (* (* x x) (- (* x 0.3333333333333333) 0.5))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 2.2) {
tmp = 1.0 + (x * ((x * (0.25 + (x * -0.08333333333333333))) - 0.5));
} else if (x <= 4e+100) {
tmp = x / exp(x);
} else {
tmp = 1.0 + ((x * x) * ((x * 0.3333333333333333) - 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 <= 2.2d0) then
tmp = 1.0d0 + (x * ((x * (0.25d0 + (x * (-0.08333333333333333d0)))) - 0.5d0))
else if (x <= 4d+100) then
tmp = x / exp(x)
else
tmp = 1.0d0 + ((x * x) * ((x * 0.3333333333333333d0) - 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 <= 2.2) {
tmp = 1.0 + (x * ((x * (0.25 + (x * -0.08333333333333333))) - 0.5));
} else if (x <= 4e+100) {
tmp = x / Math.exp(x);
} else {
tmp = 1.0 + ((x * x) * ((x * 0.3333333333333333) - 0.5));
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 2.2: tmp = 1.0 + (x * ((x * (0.25 + (x * -0.08333333333333333))) - 0.5)) elif x <= 4e+100: tmp = x / math.exp(x) else: tmp = 1.0 + ((x * x) * ((x * 0.3333333333333333) - 0.5)) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 2.2) tmp = Float64(1.0 + Float64(x * Float64(Float64(x * Float64(0.25 + Float64(x * -0.08333333333333333))) - 0.5))); elseif (x <= 4e+100) tmp = Float64(x / exp(x)); else tmp = Float64(1.0 + Float64(Float64(x * x) * Float64(Float64(x * 0.3333333333333333) - 0.5))); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 2.2) tmp = 1.0 + (x * ((x * (0.25 + (x * -0.08333333333333333))) - 0.5)); elseif (x <= 4e+100) tmp = x / exp(x); else tmp = 1.0 + ((x * x) * ((x * 0.3333333333333333) - 0.5)); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 2.2], N[(1.0 + N[(x * N[(N[(x * N[(0.25 + N[(x * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4e+100], N[(x / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x * x), $MachinePrecision] * N[(N[(x * 0.3333333333333333), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.2:\\
\;\;\;\;1 + x \cdot \left(x \cdot \left(0.25 + x \cdot -0.08333333333333333\right) - 0.5\right)\\
\mathbf{elif}\;x \leq 4 \cdot 10^{+100}:\\
\;\;\;\;\frac{x}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x \cdot x\right) \cdot \left(x \cdot 0.3333333333333333 - 0.5\right)\\
\end{array}
\end{array}
if x < 2.2000000000000002Initial program 60.8%
Simplified60.8%
Taylor expanded in eps around inf 99.4%
Taylor expanded in eps around inf 99.4%
associate-*r*99.4%
neg-mul-199.4%
Simplified99.4%
Taylor expanded in eps around 0 80.1%
mul-1-neg80.1%
Simplified80.1%
Taylor expanded in x around 0 74.9%
if 2.2000000000000002 < x < 4.00000000000000006e100Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 68.7%
associate--r+68.7%
associate-*r*68.7%
mul-1-neg68.7%
cancel-sign-sub68.7%
distribute-rgt1-in68.7%
distribute-rgt-out--68.7%
mul-1-neg68.7%
mul-1-neg68.7%
Simplified68.7%
Taylor expanded in x around inf 68.7%
rec-exp68.7%
associate-*r/68.7%
*-rgt-identity68.7%
Simplified68.7%
if 4.00000000000000006e100 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 39.8%
associate--r+39.8%
associate-*r*39.8%
mul-1-neg39.8%
cancel-sign-sub39.8%
distribute-rgt1-in39.8%
distribute-rgt-out--39.8%
mul-1-neg39.8%
mul-1-neg39.8%
Simplified39.8%
Taylor expanded in x around 0 61.7%
unpow261.7%
Applied egg-rr61.7%
Final simplification71.6%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1e+154)
(+ 1.0 (* x (- (* x 0.25) 0.5)))
(if (<= x -3.7)
(/ (* x (- -1.0 eps_m)) 2.0)
(+ 1.0 (* (* x x) (- (* x 0.3333333333333333) 0.5))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1e+154) {
tmp = 1.0 + (x * ((x * 0.25) - 0.5));
} else if (x <= -3.7) {
tmp = (x * (-1.0 - eps_m)) / 2.0;
} else {
tmp = 1.0 + ((x * x) * ((x * 0.3333333333333333) - 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 <= (-1d+154)) then
tmp = 1.0d0 + (x * ((x * 0.25d0) - 0.5d0))
else if (x <= (-3.7d0)) then
tmp = (x * ((-1.0d0) - eps_m)) / 2.0d0
else
tmp = 1.0d0 + ((x * x) * ((x * 0.3333333333333333d0) - 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 <= -1e+154) {
tmp = 1.0 + (x * ((x * 0.25) - 0.5));
} else if (x <= -3.7) {
tmp = (x * (-1.0 - eps_m)) / 2.0;
} else {
tmp = 1.0 + ((x * x) * ((x * 0.3333333333333333) - 0.5));
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1e+154: tmp = 1.0 + (x * ((x * 0.25) - 0.5)) elif x <= -3.7: tmp = (x * (-1.0 - eps_m)) / 2.0 else: tmp = 1.0 + ((x * x) * ((x * 0.3333333333333333) - 0.5)) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1e+154) tmp = Float64(1.0 + Float64(x * Float64(Float64(x * 0.25) - 0.5))); elseif (x <= -3.7) tmp = Float64(Float64(x * Float64(-1.0 - eps_m)) / 2.0); else tmp = Float64(1.0 + Float64(Float64(x * x) * Float64(Float64(x * 0.3333333333333333) - 0.5))); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1e+154) tmp = 1.0 + (x * ((x * 0.25) - 0.5)); elseif (x <= -3.7) tmp = (x * (-1.0 - eps_m)) / 2.0; else tmp = 1.0 + ((x * x) * ((x * 0.3333333333333333) - 0.5)); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1e+154], N[(1.0 + N[(x * N[(N[(x * 0.25), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.7], N[(N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(1.0 + N[(N[(x * x), $MachinePrecision] * N[(N[(x * 0.3333333333333333), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{+154}:\\
\;\;\;\;1 + x \cdot \left(x \cdot 0.25 - 0.5\right)\\
\mathbf{elif}\;x \leq -3.7:\\
\;\;\;\;\frac{x \cdot \left(-1 - eps\_m\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x \cdot x\right) \cdot \left(x \cdot 0.3333333333333333 - 0.5\right)\\
\end{array}
\end{array}
if x < -1.00000000000000004e154Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
associate-*r*100.0%
neg-mul-1100.0%
Simplified100.0%
Taylor expanded in eps around 0 100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 94.0%
if -1.00000000000000004e154 < x < -3.7000000000000002Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 35.7%
Taylor expanded in x around inf 2.4%
sub-neg2.4%
metadata-eval2.4%
+-commutative2.4%
+-commutative2.4%
Simplified2.4%
Taylor expanded in eps around inf 2.4%
Taylor expanded in x around 0 2.4%
mul-1-neg2.4%
distribute-rgt-neg-in2.4%
+-commutative2.4%
distribute-neg-in2.4%
mul-1-neg2.4%
metadata-eval2.4%
+-commutative2.4%
mul-1-neg2.4%
unsub-neg2.4%
Simplified2.4%
if -3.7000000000000002 < x Initial program 68.5%
Simplified68.5%
Taylor expanded in eps around 0 66.8%
associate--r+66.8%
associate-*r*66.8%
mul-1-neg66.8%
cancel-sign-sub66.8%
distribute-rgt1-in66.8%
distribute-rgt-out--66.8%
mul-1-neg66.8%
mul-1-neg66.8%
Simplified66.8%
Taylor expanded in x around 0 65.6%
unpow265.6%
Applied egg-rr65.6%
Final simplification62.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -5200.0) (+ 1.0 (* x (- (* x (+ 0.25 (* x -0.08333333333333333))) 0.5))) (+ 1.0 (* (* x x) (- (* x 0.3333333333333333) 0.5)))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -5200.0) {
tmp = 1.0 + (x * ((x * (0.25 + (x * -0.08333333333333333))) - 0.5));
} else {
tmp = 1.0 + ((x * x) * ((x * 0.3333333333333333) - 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 <= (-5200.0d0)) then
tmp = 1.0d0 + (x * ((x * (0.25d0 + (x * (-0.08333333333333333d0)))) - 0.5d0))
else
tmp = 1.0d0 + ((x * x) * ((x * 0.3333333333333333d0) - 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 <= -5200.0) {
tmp = 1.0 + (x * ((x * (0.25 + (x * -0.08333333333333333))) - 0.5));
} else {
tmp = 1.0 + ((x * x) * ((x * 0.3333333333333333) - 0.5));
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -5200.0: tmp = 1.0 + (x * ((x * (0.25 + (x * -0.08333333333333333))) - 0.5)) else: tmp = 1.0 + ((x * x) * ((x * 0.3333333333333333) - 0.5)) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -5200.0) tmp = Float64(1.0 + Float64(x * Float64(Float64(x * Float64(0.25 + Float64(x * -0.08333333333333333))) - 0.5))); else tmp = Float64(1.0 + Float64(Float64(x * x) * Float64(Float64(x * 0.3333333333333333) - 0.5))); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -5200.0) tmp = 1.0 + (x * ((x * (0.25 + (x * -0.08333333333333333))) - 0.5)); else tmp = 1.0 + ((x * x) * ((x * 0.3333333333333333) - 0.5)); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -5200.0], N[(1.0 + N[(x * N[(N[(x * N[(0.25 + N[(x * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(x * x), $MachinePrecision] * N[(N[(x * 0.3333333333333333), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5200:\\
\;\;\;\;1 + x \cdot \left(x \cdot \left(0.25 + x \cdot -0.08333333333333333\right) - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x \cdot x\right) \cdot \left(x \cdot 0.3333333333333333 - 0.5\right)\\
\end{array}
\end{array}
if x < -5200Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
associate-*r*100.0%
neg-mul-1100.0%
Simplified100.0%
Taylor expanded in eps around 0 100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 70.8%
if -5200 < x Initial program 68.5%
Simplified68.5%
Taylor expanded in eps around 0 66.8%
associate--r+66.8%
associate-*r*66.8%
mul-1-neg66.8%
cancel-sign-sub66.8%
distribute-rgt1-in66.8%
distribute-rgt-out--66.8%
mul-1-neg66.8%
mul-1-neg66.8%
Simplified66.8%
Taylor expanded in x around 0 65.6%
unpow265.6%
Applied egg-rr65.6%
Final simplification66.3%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -155.0) (/ (* x (- -1.0 eps_m)) 2.0) (if (<= x 4.5e-9) (/ (- 2.0 (* x x)) 2.0) (/ (* x eps_m) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -155.0) {
tmp = (x * (-1.0 - eps_m)) / 2.0;
} else if (x <= 4.5e-9) {
tmp = (2.0 - (x * x)) / 2.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-155.0d0)) then
tmp = (x * ((-1.0d0) - eps_m)) / 2.0d0
else if (x <= 4.5d-9) then
tmp = (2.0d0 - (x * x)) / 2.0d0
else
tmp = (x * eps_m) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -155.0) {
tmp = (x * (-1.0 - eps_m)) / 2.0;
} else if (x <= 4.5e-9) {
tmp = (2.0 - (x * x)) / 2.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -155.0: tmp = (x * (-1.0 - eps_m)) / 2.0 elif x <= 4.5e-9: tmp = (2.0 - (x * x)) / 2.0 else: tmp = (x * eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -155.0) tmp = Float64(Float64(x * Float64(-1.0 - eps_m)) / 2.0); elseif (x <= 4.5e-9) tmp = Float64(Float64(2.0 - Float64(x * x)) / 2.0); else tmp = Float64(Float64(x * eps_m) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -155.0) tmp = (x * (-1.0 - eps_m)) / 2.0; elseif (x <= 4.5e-9) tmp = (2.0 - (x * x)) / 2.0; else tmp = (x * eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -155.0], N[(N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 4.5e-9], N[(N[(2.0 - N[(x * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x * eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -155:\\
\;\;\;\;\frac{x \cdot \left(-1 - eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-9}:\\
\;\;\;\;\frac{2 - x \cdot x}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < -155Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 45.9%
Taylor expanded in x around inf 14.7%
sub-neg14.7%
metadata-eval14.7%
+-commutative14.7%
+-commutative14.7%
Simplified14.7%
Taylor expanded in eps around inf 14.7%
Taylor expanded in x around 0 14.7%
mul-1-neg14.7%
distribute-rgt-neg-in14.7%
+-commutative14.7%
distribute-neg-in14.7%
mul-1-neg14.7%
metadata-eval14.7%
+-commutative14.7%
mul-1-neg14.7%
unsub-neg14.7%
Simplified14.7%
if -155 < x < 4.49999999999999976e-9Initial program 52.0%
Simplified52.0%
Taylor expanded in eps around 0 76.9%
associate--r+76.8%
associate-*r*76.8%
mul-1-neg76.8%
cancel-sign-sub76.8%
distribute-rgt1-in76.8%
distribute-rgt-out--76.8%
mul-1-neg76.8%
mul-1-neg76.8%
Simplified76.8%
Taylor expanded in x around 0 76.9%
mul-1-neg76.9%
unsub-neg76.9%
Simplified76.9%
unpow276.9%
Applied egg-rr76.9%
if 4.49999999999999976e-9 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 30.5%
neg-mul-130.5%
unsub-neg30.5%
Simplified30.5%
Taylor expanded in eps around inf 23.3%
Final simplification53.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -0.46) (/ (* x (- -1.0 eps_m)) 2.0) (if (<= x 4.5e-9) 1.0 (/ (* x eps_m) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -0.46) {
tmp = (x * (-1.0 - eps_m)) / 2.0;
} else if (x <= 4.5e-9) {
tmp = 1.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-0.46d0)) then
tmp = (x * ((-1.0d0) - eps_m)) / 2.0d0
else if (x <= 4.5d-9) then
tmp = 1.0d0
else
tmp = (x * eps_m) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -0.46) {
tmp = (x * (-1.0 - eps_m)) / 2.0;
} else if (x <= 4.5e-9) {
tmp = 1.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -0.46: tmp = (x * (-1.0 - eps_m)) / 2.0 elif x <= 4.5e-9: tmp = 1.0 else: tmp = (x * eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -0.46) tmp = Float64(Float64(x * Float64(-1.0 - eps_m)) / 2.0); elseif (x <= 4.5e-9) tmp = 1.0; else tmp = Float64(Float64(x * eps_m) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -0.46) tmp = (x * (-1.0 - eps_m)) / 2.0; elseif (x <= 4.5e-9) tmp = 1.0; else tmp = (x * eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -0.46], N[(N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 4.5e-9], 1.0, N[(N[(x * eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.46:\\
\;\;\;\;\frac{x \cdot \left(-1 - eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-9}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < -0.46000000000000002Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 45.9%
Taylor expanded in x around inf 14.7%
sub-neg14.7%
metadata-eval14.7%
+-commutative14.7%
+-commutative14.7%
Simplified14.7%
Taylor expanded in eps around inf 14.7%
Taylor expanded in x around 0 14.7%
mul-1-neg14.7%
distribute-rgt-neg-in14.7%
+-commutative14.7%
distribute-neg-in14.7%
mul-1-neg14.7%
metadata-eval14.7%
+-commutative14.7%
mul-1-neg14.7%
unsub-neg14.7%
Simplified14.7%
if -0.46000000000000002 < x < 4.49999999999999976e-9Initial program 52.0%
Simplified52.0%
Taylor expanded in eps around inf 99.3%
Taylor expanded in eps around inf 99.3%
associate-*r*99.3%
neg-mul-199.3%
Simplified99.3%
Taylor expanded in eps around 0 76.3%
mul-1-neg76.3%
Simplified76.3%
Taylor expanded in x around 0 76.8%
if 4.49999999999999976e-9 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 30.5%
neg-mul-130.5%
unsub-neg30.5%
Simplified30.5%
Taylor expanded in eps around inf 23.3%
Final simplification52.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.0) (* (* x eps_m) -0.5) (if (<= x 4.5e-9) 1.0 (/ (* x eps_m) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.0) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 4.5e-9) {
tmp = 1.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-1.0d0)) then
tmp = (x * eps_m) * (-0.5d0)
else if (x <= 4.5d-9) then
tmp = 1.0d0
else
tmp = (x * eps_m) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1.0) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 4.5e-9) {
tmp = 1.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.0: tmp = (x * eps_m) * -0.5 elif x <= 4.5e-9: tmp = 1.0 else: tmp = (x * eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.0) tmp = Float64(Float64(x * eps_m) * -0.5); elseif (x <= 4.5e-9) tmp = 1.0; else tmp = Float64(Float64(x * eps_m) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.0) tmp = (x * eps_m) * -0.5; elseif (x <= 4.5e-9) tmp = 1.0; else tmp = (x * eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.0], N[(N[(x * eps$95$m), $MachinePrecision] * -0.5), $MachinePrecision], If[LessEqual[x, 4.5e-9], 1.0, N[(N[(x * eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\left(x \cdot eps\_m\right) \cdot -0.5\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-9}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < -1Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 45.9%
Taylor expanded in x around inf 14.7%
sub-neg14.7%
metadata-eval14.7%
+-commutative14.7%
+-commutative14.7%
Simplified14.7%
Taylor expanded in eps around inf 14.7%
*-commutative14.7%
Simplified14.7%
if -1 < x < 4.49999999999999976e-9Initial program 52.0%
Simplified52.0%
Taylor expanded in eps around inf 99.3%
Taylor expanded in eps around inf 99.3%
associate-*r*99.3%
neg-mul-199.3%
Simplified99.3%
Taylor expanded in eps around 0 76.3%
mul-1-neg76.3%
Simplified76.3%
Taylor expanded in x around 0 76.8%
if 4.49999999999999976e-9 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 30.5%
neg-mul-130.5%
unsub-neg30.5%
Simplified30.5%
Taylor expanded in eps around inf 23.3%
Final simplification52.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.0) (* (* x eps_m) -0.5) 1.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.0) {
tmp = (x * eps_m) * -0.5;
} else {
tmp = 1.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-1.0d0)) then
tmp = (x * eps_m) * (-0.5d0)
else
tmp = 1.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1.0) {
tmp = (x * eps_m) * -0.5;
} else {
tmp = 1.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.0: tmp = (x * eps_m) * -0.5 else: tmp = 1.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.0) tmp = Float64(Float64(x * eps_m) * -0.5); else tmp = 1.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.0) tmp = (x * eps_m) * -0.5; else tmp = 1.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.0], N[(N[(x * eps$95$m), $MachinePrecision] * -0.5), $MachinePrecision], 1.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\left(x \cdot eps\_m\right) \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 45.9%
Taylor expanded in x around inf 14.7%
sub-neg14.7%
metadata-eval14.7%
+-commutative14.7%
+-commutative14.7%
Simplified14.7%
Taylor expanded in eps around inf 14.7%
*-commutative14.7%
Simplified14.7%
if -1 < x Initial program 68.5%
Simplified68.5%
Taylor expanded in eps around inf 99.5%
Taylor expanded in eps around inf 86.5%
associate-*r*86.5%
neg-mul-186.5%
Simplified86.5%
Taylor expanded in eps around 0 51.2%
mul-1-neg51.2%
Simplified51.2%
Taylor expanded in x around 0 51.4%
Final simplification46.8%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (+ 1.0 (* x (- (* x 0.25) 0.5))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return 1.0 + (x * ((x * 0.25) - 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 = 1.0d0 + (x * ((x * 0.25d0) - 0.5d0))
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return 1.0 + (x * ((x * 0.25) - 0.5));
}
eps_m = math.fabs(eps) def code(x, eps_m): return 1.0 + (x * ((x * 0.25) - 0.5))
eps_m = abs(eps) function code(x, eps_m) return Float64(1.0 + Float64(x * Float64(Float64(x * 0.25) - 0.5))) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = 1.0 + (x * ((x * 0.25) - 0.5)); end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(1.0 + N[(x * N[(N[(x * 0.25), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
1 + x \cdot \left(x \cdot 0.25 - 0.5\right)
\end{array}
Initial program 72.4%
Simplified72.4%
Taylor expanded in eps around inf 99.6%
Taylor expanded in eps around inf 88.2%
associate-*r*88.2%
neg-mul-188.2%
Simplified88.2%
Taylor expanded in eps around 0 57.3%
mul-1-neg57.3%
Simplified57.3%
Taylor expanded in x around 0 59.1%
Final simplification59.1%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 1.0)
eps_m = fabs(eps);
double code(double x, double eps_m) {
return 1.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = 1.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return 1.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return 1.0
eps_m = abs(eps) function code(x, eps_m) return 1.0 end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = 1.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := 1.0
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
1
\end{array}
Initial program 72.4%
Simplified72.4%
Taylor expanded in eps around inf 99.6%
Taylor expanded in eps around inf 88.2%
associate-*r*88.2%
neg-mul-188.2%
Simplified88.2%
Taylor expanded in eps around 0 57.3%
mul-1-neg57.3%
Simplified57.3%
Taylor expanded in x around 0 45.4%
herbie shell --seed 2024147
(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))