
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 0.011) (/ (/ (* eps_m (* (exp (- x)) (+ 2.0 (* x 2.0)))) eps_m) 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.011) {
tmp = ((eps_m * (exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 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.011d0) then
tmp = ((eps_m * (exp(-x) * (2.0d0 + (x * 2.0d0)))) / eps_m) / 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.011) {
tmp = ((eps_m * (Math.exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 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.011: tmp = ((eps_m * (math.exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 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.011) tmp = Float64(Float64(Float64(eps_m * Float64(exp(Float64(-x)) * Float64(2.0 + Float64(x * 2.0)))) / eps_m) / 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.011) tmp = ((eps_m * (exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 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.011], N[(N[(N[(eps$95$m * N[(N[Exp[(-x)], $MachinePrecision] * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $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.011:\\
\;\;\;\;\frac{\frac{eps\_m \cdot \left(e^{-x} \cdot \left(2 + x \cdot 2\right)\right)}{eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot eps\_m} + e^{x \cdot \left(-eps\_m\right)}}{2}\\
\end{array}
\end{array}
if eps < 0.010999999999999999Initial program 64.1%
Simplified57.8%
Taylor expanded in eps around 0 31.5%
associate-+r+67.5%
distribute-rgt1-in67.5%
metadata-eval67.5%
mul0-lft67.5%
associate-*r*67.5%
distribute-rgt-out68.1%
mul-1-neg68.1%
Simplified68.1%
if 0.010999999999999999 < eps Initial program 100.0%
Simplified91.2%
Taylor expanded in eps around inf 99.9%
Taylor expanded in eps around inf 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around -inf 99.9%
rec-exp99.9%
neg-mul-199.9%
cancel-sign-sub-inv99.9%
metadata-eval99.9%
distribute-rgt-in99.9%
+-commutative99.9%
mul-1-neg99.9%
+-commutative99.9%
distribute-rgt-in99.9%
metadata-eval99.9%
cancel-sign-sub-inv99.9%
distribute-rgt-out--99.9%
Simplified99.9%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
Simplified100.0%
Final simplification77.8%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* x (+ eps_m -1.0))) (/ 1.0 (exp (+ x (* x eps_m))))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * (eps_m + -1.0))) + (1.0 / exp((x + (x * eps_m))))) / 2.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = (exp((x * (eps_m + (-1.0d0)))) + (1.0d0 / exp((x + (x * eps_m))))) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return (Math.exp((x * (eps_m + -1.0))) + (1.0 / Math.exp((x + (x * eps_m))))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.exp((x * (eps_m + -1.0))) + (1.0 / math.exp((x + (x * eps_m))))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + Float64(1.0 / exp(Float64(x + Float64(x * eps_m))))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((x * (eps_m + -1.0))) + (1.0 / exp((x + (x * eps_m))))) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[Exp[N[(x + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\frac{e^{x \cdot \left(eps\_m + -1\right)} + \frac{1}{e^{x + x \cdot eps\_m}}}{2}
\end{array}
Initial program 75.0%
Simplified67.9%
Taylor expanded in eps around inf 98.8%
Final simplification98.8%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -2000.0)
(+ 0.5 (/ 0.5 (exp x)))
(if (<= x -5e-308)
(/ (+ (+ 1.0 (* x eps_m)) (exp (* x (- -1.0 eps_m)))) 2.0)
(/
(+ (exp (* x (+ eps_m -1.0))) (/ 1.0 (+ 1.0 (* x (+ eps_m 1.0)))))
2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -2000.0) {
tmp = 0.5 + (0.5 / exp(x));
} else if (x <= -5e-308) {
tmp = ((1.0 + (x * eps_m)) + exp((x * (-1.0 - eps_m)))) / 2.0;
} else {
tmp = (exp((x * (eps_m + -1.0))) + (1.0 / (1.0 + (x * (eps_m + 1.0))))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-2000.0d0)) then
tmp = 0.5d0 + (0.5d0 / exp(x))
else if (x <= (-5d-308)) then
tmp = ((1.0d0 + (x * eps_m)) + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
else
tmp = (exp((x * (eps_m + (-1.0d0)))) + (1.0d0 / (1.0d0 + (x * (eps_m + 1.0d0))))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -2000.0) {
tmp = 0.5 + (0.5 / Math.exp(x));
} else if (x <= -5e-308) {
tmp = ((1.0 + (x * eps_m)) + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
} else {
tmp = (Math.exp((x * (eps_m + -1.0))) + (1.0 / (1.0 + (x * (eps_m + 1.0))))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -2000.0: tmp = 0.5 + (0.5 / math.exp(x)) elif x <= -5e-308: tmp = ((1.0 + (x * eps_m)) + math.exp((x * (-1.0 - eps_m)))) / 2.0 else: tmp = (math.exp((x * (eps_m + -1.0))) + (1.0 / (1.0 + (x * (eps_m + 1.0))))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -2000.0) tmp = Float64(0.5 + Float64(0.5 / exp(x))); elseif (x <= -5e-308) tmp = Float64(Float64(Float64(1.0 + Float64(x * eps_m)) + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + Float64(1.0 / Float64(1.0 + Float64(x * Float64(eps_m + 1.0))))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -2000.0) tmp = 0.5 + (0.5 / exp(x)); elseif (x <= -5e-308) tmp = ((1.0 + (x * eps_m)) + exp((x * (-1.0 - eps_m)))) / 2.0; else tmp = (exp((x * (eps_m + -1.0))) + (1.0 / (1.0 + (x * (eps_m + 1.0))))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -2000.0], N[(0.5 + N[(0.5 / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5e-308], N[(N[(N[(1.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[(1.0 + N[(x * N[(eps$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2000:\\
\;\;\;\;0.5 + \frac{0.5}{e^{x}}\\
\mathbf{elif}\;x \leq -5 \cdot 10^{-308}:\\
\;\;\;\;\frac{\left(1 + x \cdot eps\_m\right) + e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(eps\_m + -1\right)} + \frac{1}{1 + x \cdot \left(eps\_m + 1\right)}}{2}\\
\end{array}
\end{array}
if x < -2e3Initial program 97.3%
Simplified97.3%
Taylor expanded in eps around inf 97.3%
Taylor expanded in x around 0 55.4%
Taylor expanded in eps around 0 97.3%
neg-mul-197.3%
Simplified97.3%
Taylor expanded in x around inf 97.3%
distribute-lft-in97.3%
metadata-eval97.3%
rec-exp97.3%
associate-*r/97.3%
metadata-eval97.3%
Simplified97.3%
if -2e3 < x < -4.99999999999999955e-308Initial program 54.1%
Simplified38.3%
Taylor expanded in eps around inf 98.7%
Taylor expanded in eps around inf 98.7%
*-commutative98.7%
Simplified98.7%
Taylor expanded in x around -inf 98.7%
rec-exp98.7%
neg-mul-198.7%
cancel-sign-sub-inv98.7%
metadata-eval98.7%
distribute-rgt-in98.7%
+-commutative98.7%
mul-1-neg98.7%
+-commutative98.7%
distribute-rgt-in98.7%
metadata-eval98.7%
cancel-sign-sub-inv98.7%
distribute-rgt-out--98.7%
Simplified98.7%
Taylor expanded in x around 0 83.9%
if -4.99999999999999955e-308 < x Initial program 80.4%
Simplified76.0%
Taylor expanded in eps around inf 99.3%
Taylor expanded in x around 0 54.8%
+-commutative54.8%
Simplified54.8%
Final simplification69.6%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -2000.0)
(+ 0.5 (/ 0.5 (exp x)))
(if (<= x 8.8e-169)
(/ (+ (+ 1.0 (* x eps_m)) (exp (* x (- -1.0 eps_m)))) 2.0)
(/ (+ 1.0 (exp (* x (+ eps_m -1.0)))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -2000.0) {
tmp = 0.5 + (0.5 / exp(x));
} else if (x <= 8.8e-169) {
tmp = ((1.0 + (x * eps_m)) + exp((x * (-1.0 - eps_m)))) / 2.0;
} else {
tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-2000.0d0)) then
tmp = 0.5d0 + (0.5d0 / exp(x))
else if (x <= 8.8d-169) then
tmp = ((1.0d0 + (x * eps_m)) + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
else
tmp = (1.0d0 + exp((x * (eps_m + (-1.0d0))))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -2000.0) {
tmp = 0.5 + (0.5 / Math.exp(x));
} else if (x <= 8.8e-169) {
tmp = ((1.0 + (x * eps_m)) + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
} else {
tmp = (1.0 + Math.exp((x * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -2000.0: tmp = 0.5 + (0.5 / math.exp(x)) elif x <= 8.8e-169: tmp = ((1.0 + (x * eps_m)) + math.exp((x * (-1.0 - eps_m)))) / 2.0 else: tmp = (1.0 + math.exp((x * (eps_m + -1.0)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -2000.0) tmp = Float64(0.5 + Float64(0.5 / exp(x))); elseif (x <= 8.8e-169) tmp = Float64(Float64(Float64(1.0 + Float64(x * eps_m)) + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); else tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps_m + -1.0)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -2000.0) tmp = 0.5 + (0.5 / exp(x)); elseif (x <= 8.8e-169) tmp = ((1.0 + (x * eps_m)) + exp((x * (-1.0 - eps_m)))) / 2.0; else tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -2000.0], N[(0.5 + N[(0.5 / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8.8e-169], N[(N[(N[(1.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2000:\\
\;\;\;\;0.5 + \frac{0.5}{e^{x}}\\
\mathbf{elif}\;x \leq 8.8 \cdot 10^{-169}:\\
\;\;\;\;\frac{\left(1 + x \cdot eps\_m\right) + e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\end{array}
\end{array}
if x < -2e3Initial program 97.3%
Simplified97.3%
Taylor expanded in eps around inf 97.3%
Taylor expanded in x around 0 55.4%
Taylor expanded in eps around 0 97.3%
neg-mul-197.3%
Simplified97.3%
Taylor expanded in x around inf 97.3%
distribute-lft-in97.3%
metadata-eval97.3%
rec-exp97.3%
associate-*r/97.3%
metadata-eval97.3%
Simplified97.3%
if -2e3 < x < 8.80000000000000029e-169Initial program 54.4%
Simplified41.5%
Taylor expanded in eps around inf 99.1%
Taylor expanded in eps around inf 99.1%
*-commutative99.1%
Simplified99.1%
Taylor expanded in x around -inf 99.1%
rec-exp99.1%
neg-mul-199.1%
cancel-sign-sub-inv99.1%
metadata-eval99.1%
distribute-rgt-in99.1%
+-commutative99.1%
mul-1-neg99.1%
+-commutative99.1%
distribute-rgt-in99.1%
metadata-eval99.1%
cancel-sign-sub-inv99.1%
distribute-rgt-out--99.1%
Simplified99.1%
Taylor expanded in x around 0 87.2%
if 8.80000000000000029e-169 < x Initial program 86.5%
Simplified82.3%
Taylor expanded in eps around inf 99.1%
Taylor expanded in x around 0 44.4%
Final simplification69.4%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 8.8e-169) (+ 0.5 (/ 0.5 (exp x))) (/ (+ 1.0 (exp (* x (+ eps_m -1.0)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 8.8e-169) {
tmp = 0.5 + (0.5 / exp(x));
} else {
tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 8.8d-169) then
tmp = 0.5d0 + (0.5d0 / exp(x))
else
tmp = (1.0d0 + exp((x * (eps_m + (-1.0d0))))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 8.8e-169) {
tmp = 0.5 + (0.5 / Math.exp(x));
} else {
tmp = (1.0 + Math.exp((x * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 8.8e-169: tmp = 0.5 + (0.5 / math.exp(x)) else: tmp = (1.0 + math.exp((x * (eps_m + -1.0)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 8.8e-169) tmp = Float64(0.5 + Float64(0.5 / exp(x))); else tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps_m + -1.0)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 8.8e-169) tmp = 0.5 + (0.5 / exp(x)); else tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 8.8e-169], N[(0.5 + N[(0.5 / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 8.8 \cdot 10^{-169}:\\
\;\;\;\;0.5 + \frac{0.5}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\end{array}
\end{array}
if x < 8.80000000000000029e-169Initial program 65.6%
Simplified56.1%
Taylor expanded in eps around inf 98.6%
Taylor expanded in x around 0 78.8%
Taylor expanded in eps around 0 82.8%
neg-mul-182.8%
Simplified82.8%
Taylor expanded in x around inf 82.8%
distribute-lft-in82.8%
metadata-eval82.8%
rec-exp82.8%
associate-*r/82.8%
metadata-eval82.8%
Simplified82.8%
if 8.80000000000000029e-169 < x Initial program 86.5%
Simplified82.3%
Taylor expanded in eps around inf 99.1%
Taylor expanded in x around 0 44.4%
Final simplification65.6%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 8.8e-169) (+ 0.5 (/ 0.5 (exp x))) (/ (+ 1.0 (exp (* x eps_m))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 8.8e-169) {
tmp = 0.5 + (0.5 / exp(x));
} else {
tmp = (1.0 + 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 (x <= 8.8d-169) then
tmp = 0.5d0 + (0.5d0 / exp(x))
else
tmp = (1.0d0 + 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 (x <= 8.8e-169) {
tmp = 0.5 + (0.5 / Math.exp(x));
} else {
tmp = (1.0 + Math.exp((x * eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 8.8e-169: tmp = 0.5 + (0.5 / math.exp(x)) else: tmp = (1.0 + math.exp((x * eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 8.8e-169) tmp = Float64(0.5 + Float64(0.5 / exp(x))); else tmp = Float64(Float64(1.0 + exp(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 <= 8.8e-169) tmp = 0.5 + (0.5 / exp(x)); else tmp = (1.0 + exp((x * eps_m))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 8.8e-169], N[(0.5 + N[(0.5 / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + 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}\;x \leq 8.8 \cdot 10^{-169}:\\
\;\;\;\;0.5 + \frac{0.5}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot eps\_m}}{2}\\
\end{array}
\end{array}
if x < 8.80000000000000029e-169Initial program 65.6%
Simplified56.1%
Taylor expanded in eps around inf 98.6%
Taylor expanded in x around 0 78.8%
Taylor expanded in eps around 0 82.8%
neg-mul-182.8%
Simplified82.8%
Taylor expanded in x around inf 82.8%
distribute-lft-in82.8%
metadata-eval82.8%
rec-exp82.8%
associate-*r/82.8%
metadata-eval82.8%
Simplified82.8%
if 8.80000000000000029e-169 < x Initial program 86.5%
Simplified82.3%
Taylor expanded in eps around inf 99.1%
Taylor expanded in eps around inf 74.6%
*-commutative74.6%
Simplified74.6%
Taylor expanded in x around 0 44.3%
Final simplification65.5%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 315.0) (+ 0.5 (/ 0.5 (exp x))) (/ (+ 1.0 (exp x)) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 315.0) {
tmp = 0.5 + (0.5 / exp(x));
} else {
tmp = (1.0 + exp(x)) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 315.0d0) then
tmp = 0.5d0 + (0.5d0 / exp(x))
else
tmp = (1.0d0 + exp(x)) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 315.0) {
tmp = 0.5 + (0.5 / Math.exp(x));
} else {
tmp = (1.0 + Math.exp(x)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 315.0: tmp = 0.5 + (0.5 / math.exp(x)) else: tmp = (1.0 + math.exp(x)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 315.0) tmp = Float64(0.5 + Float64(0.5 / exp(x))); else tmp = Float64(Float64(1.0 + exp(x)) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 315.0) tmp = 0.5 + (0.5 / exp(x)); else tmp = (1.0 + exp(x)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 315.0], N[(0.5 + N[(0.5 / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 315:\\
\;\;\;\;0.5 + \frac{0.5}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x}}{2}\\
\end{array}
\end{array}
if x < 315Initial program 63.0%
Simplified52.5%
Taylor expanded in eps around inf 98.3%
Taylor expanded in x around 0 79.3%
Taylor expanded in eps around 0 79.3%
neg-mul-179.3%
Simplified79.3%
Taylor expanded in x around inf 79.3%
distribute-lft-in79.3%
metadata-eval79.3%
rec-exp79.3%
associate-*r/79.3%
metadata-eval79.3%
Simplified79.3%
if 315 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 30.0%
Taylor expanded in eps around 0 3.1%
neg-mul-13.1%
Simplified3.1%
expm1-log1p-u3.1%
log1p-define3.1%
+-commutative3.1%
expm1-undefine3.1%
add-exp-log3.1%
+-commutative3.1%
add-sqr-sqrt0.0%
sqrt-unprod52.6%
sqr-neg52.6%
sqrt-unprod52.6%
add-sqr-sqrt52.6%
Applied egg-rr52.6%
associate--l+52.6%
expm1-undefine52.6%
rem-exp-log52.6%
log1p-define52.6%
log1p-expm152.6%
Simplified52.6%
Final simplification70.6%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 1.22e-32)
(+ 0.5 (/ 0.5 (exp x)))
(if (<= x 1.8e+35)
(/ (+ 2.0 (* x (- (/ (+ 2.0 (* eps_m (- eps_m 2.0))) eps_m) eps_m))) 2.0)
(if (<= x 2e+166) 0.0 (+ 1.0 (* x (- (* x 0.25) 0.5)))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1.22e-32) {
tmp = 0.5 + (0.5 / exp(x));
} else if (x <= 1.8e+35) {
tmp = (2.0 + (x * (((2.0 + (eps_m * (eps_m - 2.0))) / eps_m) - eps_m))) / 2.0;
} else if (x <= 2e+166) {
tmp = 0.0;
} else {
tmp = 1.0 + (x * ((x * 0.25) - 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.22d-32) then
tmp = 0.5d0 + (0.5d0 / exp(x))
else if (x <= 1.8d+35) then
tmp = (2.0d0 + (x * (((2.0d0 + (eps_m * (eps_m - 2.0d0))) / eps_m) - eps_m))) / 2.0d0
else if (x <= 2d+166) then
tmp = 0.0d0
else
tmp = 1.0d0 + (x * ((x * 0.25d0) - 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.22e-32) {
tmp = 0.5 + (0.5 / Math.exp(x));
} else if (x <= 1.8e+35) {
tmp = (2.0 + (x * (((2.0 + (eps_m * (eps_m - 2.0))) / eps_m) - eps_m))) / 2.0;
} else if (x <= 2e+166) {
tmp = 0.0;
} else {
tmp = 1.0 + (x * ((x * 0.25) - 0.5));
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1.22e-32: tmp = 0.5 + (0.5 / math.exp(x)) elif x <= 1.8e+35: tmp = (2.0 + (x * (((2.0 + (eps_m * (eps_m - 2.0))) / eps_m) - eps_m))) / 2.0 elif x <= 2e+166: tmp = 0.0 else: tmp = 1.0 + (x * ((x * 0.25) - 0.5)) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1.22e-32) tmp = Float64(0.5 + Float64(0.5 / exp(x))); elseif (x <= 1.8e+35) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(2.0 + Float64(eps_m * Float64(eps_m - 2.0))) / eps_m) - eps_m))) / 2.0); elseif (x <= 2e+166) tmp = 0.0; else tmp = Float64(1.0 + Float64(x * Float64(Float64(x * 0.25) - 0.5))); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 1.22e-32) tmp = 0.5 + (0.5 / exp(x)); elseif (x <= 1.8e+35) tmp = (2.0 + (x * (((2.0 + (eps_m * (eps_m - 2.0))) / eps_m) - eps_m))) / 2.0; elseif (x <= 2e+166) tmp = 0.0; else tmp = 1.0 + (x * ((x * 0.25) - 0.5)); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 1.22e-32], N[(0.5 + N[(0.5 / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.8e+35], N[(N[(2.0 + N[(x * N[(N[(N[(2.0 + N[(eps$95$m * N[(eps$95$m - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2e+166], 0.0, N[(1.0 + N[(x * N[(N[(x * 0.25), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.22 \cdot 10^{-32}:\\
\;\;\;\;0.5 + \frac{0.5}{e^{x}}\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{+35}:\\
\;\;\;\;\frac{2 + x \cdot \left(\frac{2 + eps\_m \cdot \left(eps\_m - 2\right)}{eps\_m} - eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+166}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(x \cdot 0.25 - 0.5\right)\\
\end{array}
\end{array}
if x < 1.22e-32Initial program 62.2%
Simplified52.2%
Taylor expanded in eps around inf 98.8%
Taylor expanded in x around 0 80.6%
Taylor expanded in eps around 0 82.3%
neg-mul-182.3%
Simplified82.3%
Taylor expanded in x around inf 82.3%
distribute-lft-in82.3%
metadata-eval82.3%
rec-exp82.3%
associate-*r/82.3%
metadata-eval82.3%
Simplified82.3%
if 1.22e-32 < x < 1.8e35Initial program 90.8%
Simplified81.4%
Taylor expanded in x around 0 13.2%
add-sqr-sqrt5.9%
sqrt-unprod7.3%
frac-times7.3%
metadata-eval7.3%
metadata-eval7.3%
frac-times7.3%
sqrt-unprod1.4%
add-sqr-sqrt7.1%
div-inv7.1%
Applied egg-rr7.1%
Taylor expanded in eps around 0 20.0%
if 1.8e35 < x < 1.99999999999999988e166Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 61.9%
div-sub61.9%
mul-1-neg61.9%
rec-exp61.9%
+-inverses61.9%
metadata-eval61.9%
Simplified61.9%
if 1.99999999999999988e166 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 37.0%
Taylor expanded in eps around 0 3.1%
neg-mul-13.1%
Simplified3.1%
Taylor expanded in x around 0 58.2%
Final simplification70.9%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 9e-29)
(+ 1.0 (* x (- (* x (+ 0.25 (* x -0.08333333333333333))) 0.5)))
(if (<= x 3.1e+35)
(/ (+ 2.0 (* x (- (/ (+ 2.0 (* eps_m (- eps_m 2.0))) eps_m) eps_m))) 2.0)
(if (<= x 4.2e+166) 0.0 (+ 1.0 (* x (- (* x 0.25) 0.5)))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 9e-29) {
tmp = 1.0 + (x * ((x * (0.25 + (x * -0.08333333333333333))) - 0.5));
} else if (x <= 3.1e+35) {
tmp = (2.0 + (x * (((2.0 + (eps_m * (eps_m - 2.0))) / eps_m) - eps_m))) / 2.0;
} else if (x <= 4.2e+166) {
tmp = 0.0;
} else {
tmp = 1.0 + (x * ((x * 0.25) - 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 <= 9d-29) then
tmp = 1.0d0 + (x * ((x * (0.25d0 + (x * (-0.08333333333333333d0)))) - 0.5d0))
else if (x <= 3.1d+35) then
tmp = (2.0d0 + (x * (((2.0d0 + (eps_m * (eps_m - 2.0d0))) / eps_m) - eps_m))) / 2.0d0
else if (x <= 4.2d+166) then
tmp = 0.0d0
else
tmp = 1.0d0 + (x * ((x * 0.25d0) - 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 <= 9e-29) {
tmp = 1.0 + (x * ((x * (0.25 + (x * -0.08333333333333333))) - 0.5));
} else if (x <= 3.1e+35) {
tmp = (2.0 + (x * (((2.0 + (eps_m * (eps_m - 2.0))) / eps_m) - eps_m))) / 2.0;
} else if (x <= 4.2e+166) {
tmp = 0.0;
} else {
tmp = 1.0 + (x * ((x * 0.25) - 0.5));
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 9e-29: tmp = 1.0 + (x * ((x * (0.25 + (x * -0.08333333333333333))) - 0.5)) elif x <= 3.1e+35: tmp = (2.0 + (x * (((2.0 + (eps_m * (eps_m - 2.0))) / eps_m) - eps_m))) / 2.0 elif x <= 4.2e+166: tmp = 0.0 else: tmp = 1.0 + (x * ((x * 0.25) - 0.5)) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 9e-29) tmp = Float64(1.0 + Float64(x * Float64(Float64(x * Float64(0.25 + Float64(x * -0.08333333333333333))) - 0.5))); elseif (x <= 3.1e+35) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(2.0 + Float64(eps_m * Float64(eps_m - 2.0))) / eps_m) - eps_m))) / 2.0); elseif (x <= 4.2e+166) tmp = 0.0; else tmp = Float64(1.0 + Float64(x * Float64(Float64(x * 0.25) - 0.5))); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 9e-29) tmp = 1.0 + (x * ((x * (0.25 + (x * -0.08333333333333333))) - 0.5)); elseif (x <= 3.1e+35) tmp = (2.0 + (x * (((2.0 + (eps_m * (eps_m - 2.0))) / eps_m) - eps_m))) / 2.0; elseif (x <= 4.2e+166) tmp = 0.0; else tmp = 1.0 + (x * ((x * 0.25) - 0.5)); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 9e-29], 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, 3.1e+35], N[(N[(2.0 + N[(x * N[(N[(N[(2.0 + N[(eps$95$m * N[(eps$95$m - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 4.2e+166], 0.0, N[(1.0 + N[(x * N[(N[(x * 0.25), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 9 \cdot 10^{-29}:\\
\;\;\;\;1 + x \cdot \left(x \cdot \left(0.25 + x \cdot -0.08333333333333333\right) - 0.5\right)\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{+35}:\\
\;\;\;\;\frac{2 + x \cdot \left(\frac{2 + eps\_m \cdot \left(eps\_m - 2\right)}{eps\_m} - eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{+166}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(x \cdot 0.25 - 0.5\right)\\
\end{array}
\end{array}
if x < 8.9999999999999996e-29Initial program 62.2%
Simplified52.2%
Taylor expanded in eps around inf 98.8%
Taylor expanded in x around 0 80.6%
Taylor expanded in eps around 0 82.3%
neg-mul-182.3%
Simplified82.3%
Taylor expanded in x around 0 75.4%
if 8.9999999999999996e-29 < x < 3.09999999999999987e35Initial program 90.8%
Simplified81.4%
Taylor expanded in x around 0 13.2%
add-sqr-sqrt5.9%
sqrt-unprod7.3%
frac-times7.3%
metadata-eval7.3%
metadata-eval7.3%
frac-times7.3%
sqrt-unprod1.4%
add-sqr-sqrt7.1%
div-inv7.1%
Applied egg-rr7.1%
Taylor expanded in eps around 0 20.0%
if 3.09999999999999987e35 < x < 4.2000000000000001e166Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 61.9%
div-sub61.9%
mul-1-neg61.9%
rec-exp61.9%
+-inverses61.9%
metadata-eval61.9%
Simplified61.9%
if 4.2000000000000001e166 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 37.0%
Taylor expanded in eps around 0 3.1%
neg-mul-13.1%
Simplified3.1%
Taylor expanded in x around 0 58.2%
Final simplification66.5%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (or (<= x 560.0) (not (<= x 1e+170))) (+ 1.0 (* x (- (* x 0.25) 0.5))) 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if ((x <= 560.0) || !(x <= 1e+170)) {
tmp = 1.0 + (x * ((x * 0.25) - 0.5));
} else {
tmp = 0.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 <= 560.0d0) .or. (.not. (x <= 1d+170))) then
tmp = 1.0d0 + (x * ((x * 0.25d0) - 0.5d0))
else
tmp = 0.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 <= 560.0) || !(x <= 1e+170)) {
tmp = 1.0 + (x * ((x * 0.25) - 0.5));
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if (x <= 560.0) or not (x <= 1e+170): tmp = 1.0 + (x * ((x * 0.25) - 0.5)) else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if ((x <= 560.0) || !(x <= 1e+170)) tmp = Float64(1.0 + Float64(x * Float64(Float64(x * 0.25) - 0.5))); else tmp = 0.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if ((x <= 560.0) || ~((x <= 1e+170))) tmp = 1.0 + (x * ((x * 0.25) - 0.5)); else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[Or[LessEqual[x, 560.0], N[Not[LessEqual[x, 1e+170]], $MachinePrecision]], N[(1.0 + N[(x * N[(N[(x * 0.25), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 560 \lor \neg \left(x \leq 10^{+170}\right):\\
\;\;\;\;1 + x \cdot \left(x \cdot 0.25 - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 560 or 1.00000000000000003e170 < x Initial program 70.1%
Simplified61.6%
Taylor expanded in eps around inf 98.6%
Taylor expanded in x around 0 71.5%
Taylor expanded in eps around 0 64.7%
neg-mul-164.7%
Simplified64.7%
Taylor expanded in x around 0 67.0%
if 560 < x < 1.00000000000000003e170Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 53.1%
div-sub53.1%
mul-1-neg53.1%
rec-exp53.1%
+-inverses53.1%
metadata-eval53.1%
Simplified53.1%
Final simplification64.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 2.5) (+ 1.0 (* x (- (* x (+ 0.25 (* x -0.08333333333333333))) 0.5))) (if (<= x 1.5e+166) 0.0 (+ 1.0 (* x (- (* x 0.25) 0.5))))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 2.5) {
tmp = 1.0 + (x * ((x * (0.25 + (x * -0.08333333333333333))) - 0.5));
} else if (x <= 1.5e+166) {
tmp = 0.0;
} else {
tmp = 1.0 + (x * ((x * 0.25) - 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.5d0) then
tmp = 1.0d0 + (x * ((x * (0.25d0 + (x * (-0.08333333333333333d0)))) - 0.5d0))
else if (x <= 1.5d+166) then
tmp = 0.0d0
else
tmp = 1.0d0 + (x * ((x * 0.25d0) - 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.5) {
tmp = 1.0 + (x * ((x * (0.25 + (x * -0.08333333333333333))) - 0.5));
} else if (x <= 1.5e+166) {
tmp = 0.0;
} else {
tmp = 1.0 + (x * ((x * 0.25) - 0.5));
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 2.5: tmp = 1.0 + (x * ((x * (0.25 + (x * -0.08333333333333333))) - 0.5)) elif x <= 1.5e+166: tmp = 0.0 else: tmp = 1.0 + (x * ((x * 0.25) - 0.5)) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 2.5) tmp = Float64(1.0 + Float64(x * Float64(Float64(x * Float64(0.25 + Float64(x * -0.08333333333333333))) - 0.5))); elseif (x <= 1.5e+166) tmp = 0.0; else tmp = Float64(1.0 + Float64(x * Float64(Float64(x * 0.25) - 0.5))); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 2.5) tmp = 1.0 + (x * ((x * (0.25 + (x * -0.08333333333333333))) - 0.5)); elseif (x <= 1.5e+166) tmp = 0.0; else tmp = 1.0 + (x * ((x * 0.25) - 0.5)); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 2.5], 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, 1.5e+166], 0.0, N[(1.0 + N[(x * N[(N[(x * 0.25), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.5:\\
\;\;\;\;1 + x \cdot \left(x \cdot \left(0.25 + x \cdot -0.08333333333333333\right) - 0.5\right)\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{+166}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(x \cdot 0.25 - 0.5\right)\\
\end{array}
\end{array}
if x < 2.5Initial program 63.0%
Simplified52.5%
Taylor expanded in eps around inf 98.3%
Taylor expanded in x around 0 79.3%
Taylor expanded in eps around 0 79.3%
neg-mul-179.3%
Simplified79.3%
Taylor expanded in x around 0 72.7%
if 2.5 < x < 1.49999999999999999e166Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 51.9%
div-sub51.9%
mul-1-neg51.9%
rec-exp51.9%
+-inverses51.9%
metadata-eval51.9%
Simplified51.9%
if 1.49999999999999999e166 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 37.0%
Taylor expanded in eps around 0 3.1%
neg-mul-13.1%
Simplified3.1%
Taylor expanded in x around 0 58.2%
Final simplification67.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.0) (/ (* x (- 1.0 eps_m)) eps_m) (if (<= x 480.0) 1.0 0.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.0) {
tmp = (x * (1.0 - eps_m)) / eps_m;
} else if (x <= 480.0) {
tmp = 1.0;
} else {
tmp = 0.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 * (1.0d0 - eps_m)) / eps_m
else if (x <= 480.0d0) then
tmp = 1.0d0
else
tmp = 0.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 * (1.0 - eps_m)) / eps_m;
} else if (x <= 480.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.0: tmp = (x * (1.0 - eps_m)) / eps_m elif x <= 480.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.0) tmp = Float64(Float64(x * Float64(1.0 - eps_m)) / eps_m); elseif (x <= 480.0) tmp = 1.0; else tmp = 0.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 * (1.0 - eps_m)) / eps_m; elseif (x <= 480.0) tmp = 1.0; else tmp = 0.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 * N[(1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision], If[LessEqual[x, 480.0], 1.0, 0.0]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{x \cdot \left(1 - eps\_m\right)}{eps\_m}\\
\mathbf{elif}\;x \leq 480:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -1Initial program 94.9%
Simplified94.9%
Taylor expanded in x around 0 3.0%
add-sqr-sqrt1.4%
sqrt-unprod3.0%
frac-times3.0%
metadata-eval3.0%
metadata-eval3.0%
frac-times3.0%
sqrt-unprod1.6%
add-sqr-sqrt3.1%
div-inv3.1%
Applied egg-rr3.1%
Taylor expanded in eps around 0 53.1%
*-commutative53.1%
associate-*l*53.1%
*-commutative53.1%
distribute-lft-in53.1%
metadata-eval53.1%
associate-*r*53.1%
metadata-eval53.1%
mul-1-neg53.1%
Simplified53.1%
Taylor expanded in x around inf 53.1%
neg-mul-153.1%
sub-neg53.1%
Simplified53.1%
if -1 < x < 480Initial program 54.1%
Simplified40.6%
Taylor expanded in x around 0 75.0%
add-sqr-sqrt38.7%
sqrt-unprod52.5%
frac-times51.2%
metadata-eval51.2%
metadata-eval51.2%
frac-times52.5%
sqrt-unprod22.6%
add-sqr-sqrt57.4%
div-inv57.4%
Applied egg-rr57.4%
Taylor expanded in x around 0 75.0%
if 480 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 48.4%
div-sub48.4%
mul-1-neg48.4%
rec-exp48.4%
+-inverses48.4%
metadata-eval48.4%
Simplified48.4%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 1.0) (- 1.0 x) 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1.0) {
tmp = 1.0 - x;
} else {
tmp = 0.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 = 1.0d0 - x
else
tmp = 0.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 = 1.0 - x;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1.0: tmp = 1.0 - x else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1.0) tmp = Float64(1.0 - x); else tmp = 0.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 1.0) tmp = 1.0 - x; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 1.0], N[(1.0 - x), $MachinePrecision], 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;1 - x\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1Initial program 63.0%
Simplified52.5%
Taylor expanded in x around 0 59.2%
add-sqr-sqrt30.5%
sqrt-unprod41.6%
frac-times40.6%
metadata-eval40.6%
metadata-eval40.6%
frac-times41.6%
sqrt-unprod18.0%
add-sqr-sqrt45.5%
div-inv45.5%
Applied egg-rr45.5%
Taylor expanded in eps around 0 56.8%
*-commutative56.8%
associate-*l*56.8%
*-commutative56.8%
distribute-lft-in56.8%
metadata-eval56.8%
associate-*r*56.8%
metadata-eval56.8%
mul-1-neg56.8%
Simplified56.8%
Taylor expanded in eps around inf 59.6%
if 1 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 47.8%
div-sub47.8%
mul-1-neg47.8%
rec-exp47.8%
+-inverses47.8%
metadata-eval47.8%
Simplified47.8%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 500.0) 1.0 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 500.0) {
tmp = 1.0;
} else {
tmp = 0.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 <= 500.0d0) then
tmp = 1.0d0
else
tmp = 0.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 <= 500.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 500.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 500.0) tmp = 1.0; else tmp = 0.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 500.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 500.0], 1.0, 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 500:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 500Initial program 63.2%
Simplified52.7%
Taylor expanded in x around 0 58.9%
add-sqr-sqrt30.4%
sqrt-unprod41.4%
frac-times40.4%
metadata-eval40.4%
metadata-eval40.4%
frac-times41.4%
sqrt-unprod17.9%
add-sqr-sqrt45.3%
div-inv45.3%
Applied egg-rr45.3%
Taylor expanded in x around 0 58.9%
if 500 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 48.4%
div-sub48.4%
mul-1-neg48.4%
rec-exp48.4%
+-inverses48.4%
metadata-eval48.4%
Simplified48.4%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 0.0)
eps_m = fabs(eps);
double code(double x, double eps_m) {
return 0.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = 0.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return 0.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return 0.0
eps_m = abs(eps) function code(x, eps_m) return 0.0 end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = 0.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := 0.0
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
0
\end{array}
Initial program 75.0%
Simplified67.9%
Taylor expanded in eps around 0 17.0%
div-sub17.0%
mul-1-neg17.0%
rec-exp17.0%
+-inverses17.2%
metadata-eval17.2%
Simplified17.2%
herbie shell --seed 2024136
(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))