
(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 5e-39) (* (exp (- x)) (+ x 1.0)) (/ (+ (exp (* x (+ eps_m -1.0))) (/ 1.0 (pow E (fma x eps_m x)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 5e-39) {
tmp = exp(-x) * (x + 1.0);
} else {
tmp = (exp((x * (eps_m + -1.0))) + (1.0 / pow(((double) M_E), fma(x, eps_m, x)))) / 2.0;
}
return tmp;
}
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 5e-39) tmp = Float64(exp(Float64(-x)) * Float64(x + 1.0)); else tmp = Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + Float64(1.0 / (exp(1) ^ fma(x, eps_m, x)))) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 5e-39], N[(N[Exp[(-x)], $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[Power[E, N[(x * eps$95$m + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 5 \cdot 10^{-39}:\\
\;\;\;\;e^{-x} \cdot \left(x + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(eps\_m + -1\right)} + \frac{1}{{e}^{\left(\mathsf{fma}\left(x, eps\_m, x\right)\right)}}}{2}\\
\end{array}
\end{array}
if eps < 4.9999999999999998e-39Initial program 62.0%
Simplified53.4%
Taylor expanded in eps around 0 35.1%
associate-+r+72.5%
mul-1-neg72.5%
sub-neg72.5%
+-inverses72.5%
distribute-lft-out72.5%
distribute-rgt1-in73.1%
mul-1-neg73.1%
Simplified73.1%
Taylor expanded in eps around 0 73.1%
+-commutative73.1%
Simplified73.1%
if 4.9999999999999998e-39 < eps Initial program 95.0%
Simplified84.7%
Taylor expanded in eps around inf 99.9%
*-un-lft-identity99.9%
exp-prod99.9%
+-commutative99.9%
*-commutative99.9%
fma-define99.9%
Applied egg-rr99.9%
exp-1-e99.9%
Simplified99.9%
Final simplification81.5%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 5e-39) (* (exp (- x)) (+ x 1.0)) (/ (+ (exp (* x (+ eps_m -1.0))) (/ 1.0 (exp (+ x (* eps_m x))))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 5e-39) {
tmp = exp(-x) * (x + 1.0);
} else {
tmp = (exp((x * (eps_m + -1.0))) + (1.0 / exp((x + (eps_m * 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 (eps_m <= 5d-39) then
tmp = exp(-x) * (x + 1.0d0)
else
tmp = (exp((x * (eps_m + (-1.0d0)))) + (1.0d0 / exp((x + (eps_m * 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 (eps_m <= 5e-39) {
tmp = Math.exp(-x) * (x + 1.0);
} else {
tmp = (Math.exp((x * (eps_m + -1.0))) + (1.0 / Math.exp((x + (eps_m * x))))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 5e-39: tmp = math.exp(-x) * (x + 1.0) else: tmp = (math.exp((x * (eps_m + -1.0))) + (1.0 / math.exp((x + (eps_m * x))))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 5e-39) tmp = Float64(exp(Float64(-x)) * Float64(x + 1.0)); else tmp = Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + Float64(1.0 / exp(Float64(x + Float64(eps_m * x))))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 5e-39) tmp = exp(-x) * (x + 1.0); else tmp = (exp((x * (eps_m + -1.0))) + (1.0 / exp((x + (eps_m * x))))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 5e-39], N[(N[Exp[(-x)], $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[Exp[N[(x + N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 5 \cdot 10^{-39}:\\
\;\;\;\;e^{-x} \cdot \left(x + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(eps\_m + -1\right)} + \frac{1}{e^{x + eps\_m \cdot x}}}{2}\\
\end{array}
\end{array}
if eps < 4.9999999999999998e-39Initial program 62.0%
Simplified53.4%
Taylor expanded in eps around 0 35.1%
associate-+r+72.5%
mul-1-neg72.5%
sub-neg72.5%
+-inverses72.5%
distribute-lft-out72.5%
distribute-rgt1-in73.1%
mul-1-neg73.1%
Simplified73.1%
Taylor expanded in eps around 0 73.1%
+-commutative73.1%
Simplified73.1%
if 4.9999999999999998e-39 < eps Initial program 95.0%
Simplified84.7%
Taylor expanded in eps around inf 99.9%
Final simplification81.5%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 2.35e-12) (* (exp (- x)) (+ x 1.0)) (/ (+ (/ 1.0 (exp (+ x (* eps_m x)))) (exp (* eps_m x))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 2.35e-12) {
tmp = exp(-x) * (x + 1.0);
} else {
tmp = ((1.0 / exp((x + (eps_m * x)))) + exp((eps_m * 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 (eps_m <= 2.35d-12) then
tmp = exp(-x) * (x + 1.0d0)
else
tmp = ((1.0d0 / exp((x + (eps_m * x)))) + exp((eps_m * 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 (eps_m <= 2.35e-12) {
tmp = Math.exp(-x) * (x + 1.0);
} else {
tmp = ((1.0 / Math.exp((x + (eps_m * x)))) + Math.exp((eps_m * x))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 2.35e-12: tmp = math.exp(-x) * (x + 1.0) else: tmp = ((1.0 / math.exp((x + (eps_m * x)))) + math.exp((eps_m * x))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 2.35e-12) tmp = Float64(exp(Float64(-x)) * Float64(x + 1.0)); else tmp = Float64(Float64(Float64(1.0 / exp(Float64(x + Float64(eps_m * x)))) + exp(Float64(eps_m * x))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 2.35e-12) tmp = exp(-x) * (x + 1.0); else tmp = ((1.0 / exp((x + (eps_m * x)))) + exp((eps_m * x))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 2.35e-12], N[(N[Exp[(-x)], $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[Exp[N[(x + N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Exp[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 2.35 \cdot 10^{-12}:\\
\;\;\;\;e^{-x} \cdot \left(x + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{e^{x + eps\_m \cdot x}} + e^{eps\_m \cdot x}}{2}\\
\end{array}
\end{array}
if eps < 2.34999999999999988e-12Initial program 60.9%
Simplified52.6%
Taylor expanded in eps around 0 34.7%
associate-+r+73.3%
mul-1-neg73.3%
sub-neg73.3%
+-inverses73.3%
distribute-lft-out73.3%
distribute-rgt1-in73.9%
mul-1-neg73.9%
Simplified73.9%
Taylor expanded in eps around 0 73.9%
+-commutative73.9%
Simplified73.9%
if 2.34999999999999988e-12 < eps Initial program 99.9%
Simplified88.8%
Taylor expanded in eps around inf 99.9%
Taylor expanded in eps around inf 99.9%
*-commutative99.9%
Simplified99.9%
Final simplification81.5%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 2.35e-12) (* (exp (- x)) (+ x 1.0)) (/ (+ (exp (* eps_m x)) (exp (* x (- -1.0 eps_m)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 2.35e-12) {
tmp = exp(-x) * (x + 1.0);
} else {
tmp = (exp((eps_m * x)) + exp((x * (-1.0 - eps_m)))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (eps_m <= 2.35d-12) then
tmp = exp(-x) * (x + 1.0d0)
else
tmp = (exp((eps_m * x)) + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (eps_m <= 2.35e-12) {
tmp = Math.exp(-x) * (x + 1.0);
} else {
tmp = (Math.exp((eps_m * x)) + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 2.35e-12: tmp = math.exp(-x) * (x + 1.0) else: tmp = (math.exp((eps_m * x)) + math.exp((x * (-1.0 - eps_m)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 2.35e-12) tmp = Float64(exp(Float64(-x)) * Float64(x + 1.0)); else tmp = Float64(Float64(exp(Float64(eps_m * x)) + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 2.35e-12) tmp = exp(-x) * (x + 1.0); else tmp = (exp((eps_m * x)) + exp((x * (-1.0 - eps_m)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 2.35e-12], N[(N[Exp[(-x)], $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Exp[N[(eps$95$m * x), $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|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 2.35 \cdot 10^{-12}:\\
\;\;\;\;e^{-x} \cdot \left(x + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{eps\_m \cdot x} + e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\end{array}
\end{array}
if eps < 2.34999999999999988e-12Initial program 60.9%
Simplified52.6%
Taylor expanded in eps around 0 34.7%
associate-+r+73.3%
mul-1-neg73.3%
sub-neg73.3%
+-inverses73.3%
distribute-lft-out73.3%
distribute-rgt1-in73.9%
mul-1-neg73.9%
Simplified73.9%
Taylor expanded in eps around 0 73.9%
+-commutative73.9%
Simplified73.9%
if 2.34999999999999988e-12 < eps Initial program 99.9%
Simplified88.8%
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%
*-commutative99.9%
neg-mul-199.9%
fma-neg99.9%
remove-double-neg99.9%
*-rgt-identity99.9%
exp-neg99.9%
*-rgt-identity99.9%
fma-undefine99.9%
*-commutative99.9%
+-commutative99.9%
*-lft-identity99.9%
distribute-rgt-in99.9%
distribute-rgt-neg-in99.9%
distribute-neg-in99.9%
metadata-eval99.9%
unsub-neg99.9%
Simplified99.9%
Final simplification81.5%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -2e-228) (/ (+ 1.0 (exp (* eps_m (- x)))) 2.0) (if (<= x 5.8e+119) (/ (+ 1.0 (exp (* eps_m x))) 2.0) 0.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -2e-228) {
tmp = (1.0 + exp((eps_m * -x))) / 2.0;
} else if (x <= 5.8e+119) {
tmp = (1.0 + exp((eps_m * x))) / 2.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 <= (-2d-228)) then
tmp = (1.0d0 + exp((eps_m * -x))) / 2.0d0
else if (x <= 5.8d+119) then
tmp = (1.0d0 + exp((eps_m * x))) / 2.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 <= -2e-228) {
tmp = (1.0 + Math.exp((eps_m * -x))) / 2.0;
} else if (x <= 5.8e+119) {
tmp = (1.0 + Math.exp((eps_m * x))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -2e-228: tmp = (1.0 + math.exp((eps_m * -x))) / 2.0 elif x <= 5.8e+119: tmp = (1.0 + math.exp((eps_m * x))) / 2.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -2e-228) tmp = Float64(Float64(1.0 + exp(Float64(eps_m * Float64(-x)))) / 2.0); elseif (x <= 5.8e+119) tmp = Float64(Float64(1.0 + exp(Float64(eps_m * x))) / 2.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 <= -2e-228) tmp = (1.0 + exp((eps_m * -x))) / 2.0; elseif (x <= 5.8e+119) tmp = (1.0 + exp((eps_m * x))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -2e-228], N[(N[(1.0 + N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5.8e+119], N[(N[(1.0 + N[Exp[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-228}:\\
\;\;\;\;\frac{1 + e^{eps\_m \cdot \left(-x\right)}}{2}\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{+119}:\\
\;\;\;\;\frac{1 + e^{eps\_m \cdot x}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -2.00000000000000007e-228Initial program 74.2%
Simplified74.2%
Taylor expanded in x around 0 46.2%
Taylor expanded in eps around inf 67.0%
cancel-sign-sub-inv67.0%
metadata-eval67.0%
mul-1-neg67.0%
distribute-rgt-in67.0%
*-lft-identity67.0%
+-commutative67.0%
*-commutative67.0%
fma-undefine67.0%
*-lft-identity67.0%
fma-undefine67.0%
*-commutative67.0%
+-commutative67.0%
*-lft-identity67.0%
distribute-rgt-in67.0%
distribute-rgt-neg-in67.0%
distribute-neg-in67.0%
metadata-eval67.0%
unsub-neg67.0%
Simplified67.0%
Taylor expanded in eps around inf 67.9%
neg-mul-167.9%
Simplified67.9%
if -2.00000000000000007e-228 < x < 5.80000000000000014e119Initial program 60.6%
Simplified53.8%
Taylor expanded in eps around inf 98.6%
Taylor expanded in eps around inf 90.0%
*-commutative90.0%
Simplified90.0%
Taylor expanded in x around 0 76.6%
if 5.80000000000000014e119 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 70.0%
div-sub70.0%
mul-1-neg70.0%
rec-exp70.0%
+-inverses70.0%
metadata-eval70.0%
Simplified70.0%
Final simplification72.5%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (- x))))
(if (<= eps_m 2.35e-12)
(* t_0 (+ x 1.0))
(if (<= eps_m 5e+196)
(+ 1.0 (* x (- (* x 0.25) 0.5)))
(/ (+ t_0 1.0) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp(-x);
double tmp;
if (eps_m <= 2.35e-12) {
tmp = t_0 * (x + 1.0);
} else if (eps_m <= 5e+196) {
tmp = 1.0 + (x * ((x * 0.25) - 0.5));
} else {
tmp = (t_0 + 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) :: t_0
real(8) :: tmp
t_0 = exp(-x)
if (eps_m <= 2.35d-12) then
tmp = t_0 * (x + 1.0d0)
else if (eps_m <= 5d+196) then
tmp = 1.0d0 + (x * ((x * 0.25d0) - 0.5d0))
else
tmp = (t_0 + 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 t_0 = Math.exp(-x);
double tmp;
if (eps_m <= 2.35e-12) {
tmp = t_0 * (x + 1.0);
} else if (eps_m <= 5e+196) {
tmp = 1.0 + (x * ((x * 0.25) - 0.5));
} else {
tmp = (t_0 + 1.0) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp(-x) tmp = 0 if eps_m <= 2.35e-12: tmp = t_0 * (x + 1.0) elif eps_m <= 5e+196: tmp = 1.0 + (x * ((x * 0.25) - 0.5)) else: tmp = (t_0 + 1.0) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(-x)) tmp = 0.0 if (eps_m <= 2.35e-12) tmp = Float64(t_0 * Float64(x + 1.0)); elseif (eps_m <= 5e+196) tmp = Float64(1.0 + Float64(x * Float64(Float64(x * 0.25) - 0.5))); else tmp = Float64(Float64(t_0 + 1.0) / 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 <= 2.35e-12) tmp = t_0 * (x + 1.0); elseif (eps_m <= 5e+196) tmp = 1.0 + (x * ((x * 0.25) - 0.5)); else tmp = (t_0 + 1.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[(-x)], $MachinePrecision]}, If[LessEqual[eps$95$m, 2.35e-12], N[(t$95$0 * N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[eps$95$m, 5e+196], N[(1.0 + N[(x * N[(N[(x * 0.25), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 + 1.0), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{-x}\\
\mathbf{if}\;eps\_m \leq 2.35 \cdot 10^{-12}:\\
\;\;\;\;t\_0 \cdot \left(x + 1\right)\\
\mathbf{elif}\;eps\_m \leq 5 \cdot 10^{+196}:\\
\;\;\;\;1 + x \cdot \left(x \cdot 0.25 - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 + 1}{2}\\
\end{array}
\end{array}
if eps < 2.34999999999999988e-12Initial program 60.9%
Simplified52.6%
Taylor expanded in eps around 0 34.7%
associate-+r+73.3%
mul-1-neg73.3%
sub-neg73.3%
+-inverses73.3%
distribute-lft-out73.3%
distribute-rgt1-in73.9%
mul-1-neg73.9%
Simplified73.9%
Taylor expanded in eps around 0 73.9%
+-commutative73.9%
Simplified73.9%
if 2.34999999999999988e-12 < eps < 4.9999999999999998e196Initial program 99.8%
Simplified99.8%
Taylor expanded in x around 0 70.5%
Taylor expanded in eps around inf 70.5%
cancel-sign-sub-inv70.5%
metadata-eval70.5%
mul-1-neg70.5%
distribute-rgt-in70.5%
*-lft-identity70.5%
+-commutative70.5%
*-commutative70.5%
fma-undefine70.5%
*-lft-identity70.5%
fma-undefine70.5%
*-commutative70.5%
+-commutative70.5%
*-lft-identity70.5%
distribute-rgt-in70.5%
distribute-rgt-neg-in70.5%
distribute-neg-in70.5%
metadata-eval70.5%
unsub-neg70.5%
Simplified70.5%
Taylor expanded in eps around 0 57.8%
mul-1-neg57.8%
Simplified57.8%
Taylor expanded in x around 0 64.7%
if 4.9999999999999998e196 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 65.8%
Taylor expanded in eps around inf 65.8%
cancel-sign-sub-inv65.8%
metadata-eval65.8%
mul-1-neg65.8%
distribute-rgt-in65.8%
*-lft-identity65.8%
+-commutative65.8%
*-commutative65.8%
fma-undefine65.8%
*-lft-identity65.8%
fma-undefine65.8%
*-commutative65.8%
+-commutative65.8%
*-lft-identity65.8%
distribute-rgt-in65.8%
distribute-rgt-neg-in65.8%
distribute-neg-in65.8%
metadata-eval65.8%
unsub-neg65.8%
Simplified65.8%
Taylor expanded in eps around 0 60.1%
mul-1-neg60.1%
Simplified60.1%
Final simplification70.9%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (- x))))
(if (<= eps_m 2.35e-12)
(* t_0 (+ x 1.0))
(if (<= eps_m 1.55e+196)
(+ 1.0 (* x (- (* x 0.25) 0.5)))
(/ (* t_0 2.0) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp(-x);
double tmp;
if (eps_m <= 2.35e-12) {
tmp = t_0 * (x + 1.0);
} else if (eps_m <= 1.55e+196) {
tmp = 1.0 + (x * ((x * 0.25) - 0.5));
} else {
tmp = (t_0 * 2.0) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: tmp
t_0 = exp(-x)
if (eps_m <= 2.35d-12) then
tmp = t_0 * (x + 1.0d0)
else if (eps_m <= 1.55d+196) then
tmp = 1.0d0 + (x * ((x * 0.25d0) - 0.5d0))
else
tmp = (t_0 * 2.0d0) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = Math.exp(-x);
double tmp;
if (eps_m <= 2.35e-12) {
tmp = t_0 * (x + 1.0);
} else if (eps_m <= 1.55e+196) {
tmp = 1.0 + (x * ((x * 0.25) - 0.5));
} else {
tmp = (t_0 * 2.0) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp(-x) tmp = 0 if eps_m <= 2.35e-12: tmp = t_0 * (x + 1.0) elif eps_m <= 1.55e+196: tmp = 1.0 + (x * ((x * 0.25) - 0.5)) else: tmp = (t_0 * 2.0) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(-x)) tmp = 0.0 if (eps_m <= 2.35e-12) tmp = Float64(t_0 * Float64(x + 1.0)); elseif (eps_m <= 1.55e+196) tmp = Float64(1.0 + Float64(x * Float64(Float64(x * 0.25) - 0.5))); else tmp = Float64(Float64(t_0 * 2.0) / 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 <= 2.35e-12) tmp = t_0 * (x + 1.0); elseif (eps_m <= 1.55e+196) tmp = 1.0 + (x * ((x * 0.25) - 0.5)); else tmp = (t_0 * 2.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[(-x)], $MachinePrecision]}, If[LessEqual[eps$95$m, 2.35e-12], N[(t$95$0 * N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[eps$95$m, 1.55e+196], N[(1.0 + N[(x * N[(N[(x * 0.25), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * 2.0), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{-x}\\
\mathbf{if}\;eps\_m \leq 2.35 \cdot 10^{-12}:\\
\;\;\;\;t\_0 \cdot \left(x + 1\right)\\
\mathbf{elif}\;eps\_m \leq 1.55 \cdot 10^{+196}:\\
\;\;\;\;1 + x \cdot \left(x \cdot 0.25 - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 \cdot 2}{2}\\
\end{array}
\end{array}
if eps < 2.34999999999999988e-12Initial program 60.9%
Simplified52.6%
Taylor expanded in eps around 0 34.7%
associate-+r+73.3%
mul-1-neg73.3%
sub-neg73.3%
+-inverses73.3%
distribute-lft-out73.3%
distribute-rgt1-in73.9%
mul-1-neg73.9%
Simplified73.9%
Taylor expanded in eps around 0 73.9%
+-commutative73.9%
Simplified73.9%
if 2.34999999999999988e-12 < eps < 1.55000000000000005e196Initial program 99.8%
Simplified99.8%
Taylor expanded in x around 0 70.5%
Taylor expanded in eps around inf 70.5%
cancel-sign-sub-inv70.5%
metadata-eval70.5%
mul-1-neg70.5%
distribute-rgt-in70.5%
*-lft-identity70.5%
+-commutative70.5%
*-commutative70.5%
fma-undefine70.5%
*-lft-identity70.5%
fma-undefine70.5%
*-commutative70.5%
+-commutative70.5%
*-lft-identity70.5%
distribute-rgt-in70.5%
distribute-rgt-neg-in70.5%
distribute-neg-in70.5%
metadata-eval70.5%
unsub-neg70.5%
Simplified70.5%
Taylor expanded in eps around 0 57.8%
mul-1-neg57.8%
Simplified57.8%
Taylor expanded in x around 0 64.7%
if 1.55000000000000005e196 < eps Initial program 100.0%
Simplified82.9%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around 0 59.8%
rec-exp59.8%
neg-mul-159.8%
count-259.8%
neg-mul-159.8%
Simplified59.8%
Final simplification70.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 25500000.0) (* (exp (- x)) (+ x 1.0)) (/ (+ 1.0 (exp (* eps_m x))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 25500000.0) {
tmp = exp(-x) * (x + 1.0);
} else {
tmp = (1.0 + exp((eps_m * 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 (eps_m <= 25500000.0d0) then
tmp = exp(-x) * (x + 1.0d0)
else
tmp = (1.0d0 + exp((eps_m * 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 (eps_m <= 25500000.0) {
tmp = Math.exp(-x) * (x + 1.0);
} else {
tmp = (1.0 + Math.exp((eps_m * x))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 25500000.0: tmp = math.exp(-x) * (x + 1.0) else: tmp = (1.0 + math.exp((eps_m * x))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 25500000.0) tmp = Float64(exp(Float64(-x)) * Float64(x + 1.0)); else tmp = Float64(Float64(1.0 + exp(Float64(eps_m * x))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 25500000.0) tmp = exp(-x) * (x + 1.0); else tmp = (1.0 + exp((eps_m * x))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 25500000.0], N[(N[Exp[(-x)], $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[Exp[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 25500000:\\
\;\;\;\;e^{-x} \cdot \left(x + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{eps\_m \cdot x}}{2}\\
\end{array}
\end{array}
if eps < 2.55e7Initial program 62.4%
Simplified53.4%
Taylor expanded in eps around 0 35.8%
associate-+r+73.8%
mul-1-neg73.8%
sub-neg73.8%
+-inverses73.8%
distribute-lft-out73.8%
distribute-rgt1-in74.3%
mul-1-neg74.3%
Simplified74.3%
Taylor expanded in eps around 0 74.3%
+-commutative74.3%
Simplified74.3%
if 2.55e7 < eps Initial program 99.9%
Simplified87.7%
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 0 63.6%
Final simplification71.5%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 2.35e-12) (* (exp (- x)) (+ x 1.0)) (+ 1.0 (* x (- (* x 0.25) 0.5)))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 2.35e-12) {
tmp = exp(-x) * (x + 1.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 (eps_m <= 2.35d-12) then
tmp = exp(-x) * (x + 1.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 (eps_m <= 2.35e-12) {
tmp = Math.exp(-x) * (x + 1.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 eps_m <= 2.35e-12: tmp = math.exp(-x) * (x + 1.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 (eps_m <= 2.35e-12) tmp = Float64(exp(Float64(-x)) * Float64(x + 1.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 (eps_m <= 2.35e-12) tmp = exp(-x) * (x + 1.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[eps$95$m, 2.35e-12], N[(N[Exp[(-x)], $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 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}\;eps\_m \leq 2.35 \cdot 10^{-12}:\\
\;\;\;\;e^{-x} \cdot \left(x + 1\right)\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(x \cdot 0.25 - 0.5\right)\\
\end{array}
\end{array}
if eps < 2.34999999999999988e-12Initial program 60.9%
Simplified52.6%
Taylor expanded in eps around 0 34.7%
associate-+r+73.3%
mul-1-neg73.3%
sub-neg73.3%
+-inverses73.3%
distribute-lft-out73.3%
distribute-rgt1-in73.9%
mul-1-neg73.9%
Simplified73.9%
Taylor expanded in eps around 0 73.9%
+-commutative73.9%
Simplified73.9%
if 2.34999999999999988e-12 < eps Initial program 99.9%
Simplified99.9%
Taylor expanded in x around 0 69.5%
Taylor expanded in eps around inf 69.5%
cancel-sign-sub-inv69.5%
metadata-eval69.5%
mul-1-neg69.5%
distribute-rgt-in69.5%
*-lft-identity69.5%
+-commutative69.5%
*-commutative69.5%
fma-undefine69.5%
*-lft-identity69.5%
fma-undefine69.5%
*-commutative69.5%
+-commutative69.5%
*-lft-identity69.5%
distribute-rgt-in69.5%
distribute-rgt-neg-in69.5%
distribute-neg-in69.5%
metadata-eval69.5%
unsub-neg69.5%
Simplified69.5%
Taylor expanded in eps around 0 58.3%
mul-1-neg58.3%
Simplified58.3%
Taylor expanded in x around 0 60.0%
Final simplification69.8%
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))) (* x (exp (- x)))))
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 {
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.2d0) then
tmp = 1.0d0 + (x * ((x * (0.25d0 + (x * (-0.08333333333333333d0)))) - 0.5d0))
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.2) {
tmp = 1.0 + (x * ((x * (0.25 + (x * -0.08333333333333333))) - 0.5));
} else {
tmp = x * Math.exp(-x);
}
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)) else: tmp = x * math.exp(-x) 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))); else tmp = Float64(x * exp(Float64(-x))); 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)); else tmp = x * exp(-x); 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], N[(x * N[Exp[(-x)], $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{else}:\\
\;\;\;\;x \cdot e^{-x}\\
\end{array}
\end{array}
if x < 2.2000000000000002Initial program 62.2%
Simplified62.2%
Taylor expanded in x around 0 44.0%
Taylor expanded in eps around inf 79.0%
cancel-sign-sub-inv79.0%
metadata-eval79.0%
mul-1-neg79.0%
distribute-rgt-in79.0%
*-lft-identity79.0%
+-commutative79.0%
*-commutative79.0%
fma-undefine79.0%
*-lft-identity79.0%
fma-undefine79.0%
*-commutative79.0%
+-commutative79.0%
*-lft-identity79.0%
distribute-rgt-in79.0%
distribute-rgt-neg-in79.0%
distribute-neg-in79.0%
metadata-eval79.0%
unsub-neg79.0%
Simplified79.0%
Taylor expanded in eps around 0 77.2%
mul-1-neg77.2%
Simplified77.2%
Taylor expanded in x around 0 72.1%
if 2.2000000000000002 < x Initial program 98.6%
Simplified98.7%
Taylor expanded in eps around 0 61.2%
associate-+r+62.6%
mul-1-neg62.6%
sub-neg62.6%
+-inverses62.6%
distribute-lft-out62.6%
distribute-rgt1-in62.6%
mul-1-neg62.6%
Simplified62.6%
Taylor expanded in x around inf 61.5%
Final simplification69.1%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -2.8e+154) (+ 1.0 (* x (- (* x 0.25) 0.5))) (if (<= x 0.022) (/ (+ 2.0 (* x (- -1.0 eps_m))) 2.0) 0.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -2.8e+154) {
tmp = 1.0 + (x * ((x * 0.25) - 0.5));
} else if (x <= 0.022) {
tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.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 <= (-2.8d+154)) then
tmp = 1.0d0 + (x * ((x * 0.25d0) - 0.5d0))
else if (x <= 0.022d0) then
tmp = (2.0d0 + (x * ((-1.0d0) - eps_m))) / 2.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 <= -2.8e+154) {
tmp = 1.0 + (x * ((x * 0.25) - 0.5));
} else if (x <= 0.022) {
tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -2.8e+154: tmp = 1.0 + (x * ((x * 0.25) - 0.5)) elif x <= 0.022: tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -2.8e+154) tmp = Float64(1.0 + Float64(x * Float64(Float64(x * 0.25) - 0.5))); elseif (x <= 0.022) tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 - eps_m))) / 2.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 <= -2.8e+154) tmp = 1.0 + (x * ((x * 0.25) - 0.5)); elseif (x <= 0.022) tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -2.8e+154], N[(1.0 + N[(x * N[(N[(x * 0.25), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.022], N[(N[(2.0 + N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.8 \cdot 10^{+154}:\\
\;\;\;\;1 + x \cdot \left(x \cdot 0.25 - 0.5\right)\\
\mathbf{elif}\;x \leq 0.022:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 - eps\_m\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -2.7999999999999999e154Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 63.7%
Taylor expanded in eps around inf 63.7%
cancel-sign-sub-inv63.7%
metadata-eval63.7%
mul-1-neg63.7%
distribute-rgt-in63.7%
*-lft-identity63.7%
+-commutative63.7%
*-commutative63.7%
fma-undefine63.7%
*-lft-identity63.7%
fma-undefine63.7%
*-commutative63.7%
+-commutative63.7%
*-lft-identity63.7%
distribute-rgt-in63.7%
distribute-rgt-neg-in63.7%
distribute-neg-in63.7%
metadata-eval63.7%
unsub-neg63.7%
Simplified63.7%
Taylor expanded in eps around 0 100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
if -2.7999999999999999e154 < x < 0.021999999999999999Initial program 58.4%
Simplified58.4%
Taylor expanded in x around 0 42.3%
Taylor expanded in eps around inf 80.9%
cancel-sign-sub-inv80.9%
metadata-eval80.9%
mul-1-neg80.9%
distribute-rgt-in80.9%
*-lft-identity80.9%
+-commutative80.9%
*-commutative80.9%
fma-undefine80.9%
*-lft-identity80.9%
fma-undefine80.9%
*-commutative80.9%
+-commutative80.9%
*-lft-identity80.9%
distribute-rgt-in80.9%
distribute-rgt-neg-in80.9%
distribute-neg-in80.9%
metadata-eval80.9%
unsub-neg80.9%
Simplified80.9%
Taylor expanded in x around 0 68.0%
mul-1-neg68.0%
distribute-rgt-neg-in68.0%
mul-1-neg68.0%
distribute-lft-in68.0%
metadata-eval68.0%
neg-mul-168.0%
sub-neg68.0%
Simplified68.0%
if 0.021999999999999999 < x Initial program 98.7%
Simplified98.6%
Taylor expanded in eps around 0 60.4%
div-sub60.4%
mul-1-neg60.4%
rec-exp60.4%
+-inverses60.4%
metadata-eval60.4%
Simplified60.4%
Final simplification67.8%
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))) 0.0))
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 {
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 <= 2.5d0) then
tmp = 1.0d0 + (x * ((x * (0.25d0 + (x * (-0.08333333333333333d0)))) - 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 <= 2.5) {
tmp = 1.0 + (x * ((x * (0.25 + (x * -0.08333333333333333))) - 0.5));
} else {
tmp = 0.0;
}
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)) else: tmp = 0.0 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))); else tmp = 0.0; 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)); else tmp = 0.0; 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], 0.0]
\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{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2.5Initial program 62.2%
Simplified62.2%
Taylor expanded in x around 0 44.0%
Taylor expanded in eps around inf 79.0%
cancel-sign-sub-inv79.0%
metadata-eval79.0%
mul-1-neg79.0%
distribute-rgt-in79.0%
*-lft-identity79.0%
+-commutative79.0%
*-commutative79.0%
fma-undefine79.0%
*-lft-identity79.0%
fma-undefine79.0%
*-commutative79.0%
+-commutative79.0%
*-lft-identity79.0%
distribute-rgt-in79.0%
distribute-rgt-neg-in79.0%
distribute-neg-in79.0%
metadata-eval79.0%
unsub-neg79.0%
Simplified79.0%
Taylor expanded in eps around 0 77.2%
mul-1-neg77.2%
Simplified77.2%
Taylor expanded in x around 0 72.1%
if 2.5 < x Initial program 98.6%
Simplified98.6%
Taylor expanded in eps around 0 61.2%
div-sub61.2%
mul-1-neg61.2%
rec-exp61.2%
+-inverses61.2%
metadata-eval61.2%
Simplified61.2%
Final simplification69.1%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 500.0) (+ 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 <= 500.0) {
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 <= 500.0d0) 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 <= 500.0) {
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 <= 500.0: 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 <= 500.0) 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 <= 500.0) 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[LessEqual[x, 500.0], 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 500:\\
\;\;\;\;1 + x \cdot \left(x \cdot 0.25 - 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 500Initial program 62.1%
Simplified62.1%
Taylor expanded in x around 0 44.0%
Taylor expanded in eps around inf 78.7%
cancel-sign-sub-inv78.7%
metadata-eval78.7%
mul-1-neg78.7%
distribute-rgt-in78.7%
*-lft-identity78.7%
+-commutative78.7%
*-commutative78.7%
fma-undefine78.7%
*-lft-identity78.7%
fma-undefine78.7%
*-commutative78.7%
+-commutative78.7%
*-lft-identity78.7%
distribute-rgt-in78.7%
distribute-rgt-neg-in78.7%
distribute-neg-in78.7%
metadata-eval78.7%
unsub-neg78.7%
Simplified78.7%
Taylor expanded in eps around 0 76.5%
mul-1-neg76.5%
Simplified76.5%
Taylor expanded in x around 0 68.8%
if 500 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 62.9%
div-sub62.9%
mul-1-neg62.9%
rec-exp62.9%
+-inverses62.9%
metadata-eval62.9%
Simplified62.9%
Final simplification67.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 490.0) 1.0 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 490.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 <= 490.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 <= 490.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 490.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 490.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 <= 490.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, 490.0], 1.0, 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 490:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 490Initial program 62.1%
Simplified51.7%
Taylor expanded in eps around inf 97.3%
Taylor expanded in eps around inf 97.4%
*-commutative97.4%
Simplified97.4%
Taylor expanded in x around 0 60.7%
mul-1-neg60.7%
unsub-neg60.7%
Simplified60.7%
Taylor expanded in x around 0 61.2%
if 490 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 62.9%
div-sub62.9%
mul-1-neg62.9%
rec-exp62.9%
+-inverses62.9%
metadata-eval62.9%
Simplified62.9%
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 72.3%
Simplified64.7%
Taylor expanded in eps around 0 18.7%
div-sub18.7%
mul-1-neg18.7%
rec-exp18.6%
+-inverses18.8%
metadata-eval18.8%
Simplified18.8%
herbie shell --seed 2024139
(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))