
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 0.00152) (/ (+ x 1.0) (exp x)) (/ (+ (/ 1.0 (exp (+ x (* 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.00152) {
tmp = (x + 1.0) / exp(x);
} else {
tmp = ((1.0 / exp((x + (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.00152d0) then
tmp = (x + 1.0d0) / exp(x)
else
tmp = ((1.0d0 / exp((x + (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.00152) {
tmp = (x + 1.0) / Math.exp(x);
} else {
tmp = ((1.0 / Math.exp((x + (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.00152: tmp = (x + 1.0) / math.exp(x) else: tmp = ((1.0 / math.exp((x + (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.00152) tmp = Float64(Float64(x + 1.0) / exp(x)); else tmp = Float64(Float64(Float64(1.0 / exp(Float64(x + Float64(x * eps_m)))) + 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 (eps_m <= 0.00152) tmp = (x + 1.0) / exp(x); else tmp = ((1.0 / exp((x + (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.00152], N[(N[(x + 1.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / N[Exp[N[(x + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 0.00152:\\
\;\;\;\;\frac{x + 1}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{e^{x + x \cdot eps\_m}} + e^{x \cdot eps\_m}}{2}\\
\end{array}
\end{array}
if eps < 0.0015200000000000001Initial program 66.1%
Simplified57.3%
Taylor expanded in eps around 0 31.3%
associate-+r+65.5%
mul-1-neg65.5%
sub-neg65.5%
+-inverses65.5%
distribute-lft-out65.5%
distribute-rgt1-in66.0%
mul-1-neg66.0%
Simplified66.0%
Taylor expanded in eps around 0 66.0%
+-commutative66.0%
*-commutative66.0%
exp-neg66.0%
un-div-inv66.1%
Applied egg-rr66.1%
if 0.0015200000000000001 < eps Initial program 100.0%
Simplified91.3%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification75.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 0.00152) (/ (+ x 1.0) (exp x)) (/ (+ (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.00152) {
tmp = (x + 1.0) / exp(x);
} 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.00152d0) then
tmp = (x + 1.0d0) / exp(x)
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.00152) {
tmp = (x + 1.0) / Math.exp(x);
} 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.00152: tmp = (x + 1.0) / math.exp(x) 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.00152) tmp = Float64(Float64(x + 1.0) / exp(x)); 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.00152) tmp = (x + 1.0) / exp(x); 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.00152], N[(N[(x + 1.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $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.00152:\\
\;\;\;\;\frac{x + 1}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot eps\_m} + e^{x \cdot \left(-eps\_m\right)}}{2}\\
\end{array}
\end{array}
if eps < 0.0015200000000000001Initial program 66.1%
Simplified57.3%
Taylor expanded in eps around 0 31.3%
associate-+r+65.5%
mul-1-neg65.5%
sub-neg65.5%
+-inverses65.5%
distribute-lft-out65.5%
distribute-rgt1-in66.0%
mul-1-neg66.0%
Simplified66.0%
Taylor expanded in eps around 0 66.0%
+-commutative66.0%
*-commutative66.0%
exp-neg66.0%
un-div-inv66.1%
Applied egg-rr66.1%
if 0.0015200000000000001 < eps Initial program 100.0%
Simplified91.3%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around -inf 100.0%
rec-exp100.0%
cancel-sign-sub-inv100.0%
metadata-eval100.0%
*-lft-identity100.0%
+-commutative100.0%
distribute-rgt1-in100.0%
+-commutative100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
+-commutative100.0%
neg-sub0100.0%
+-commutative100.0%
associate--r+100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
Simplified100.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (/ 1.0 (exp (+ x (* x eps_m)))) (exp (* x (+ eps_m -1.0)))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return ((1.0 / exp((x + (x * eps_m)))) + exp((x * (eps_m + -1.0)))) / 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 = ((1.0d0 / exp((x + (x * eps_m)))) + exp((x * (eps_m + (-1.0d0))))) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return ((1.0 / Math.exp((x + (x * eps_m)))) + Math.exp((x * (eps_m + -1.0)))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return ((1.0 / math.exp((x + (x * eps_m)))) + math.exp((x * (eps_m + -1.0)))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(Float64(1.0 / exp(Float64(x + Float64(x * eps_m)))) + exp(Float64(x * Float64(eps_m + -1.0)))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = ((1.0 / exp((x + (x * eps_m)))) + exp((x * (eps_m + -1.0)))) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(N[(1.0 / N[Exp[N[(x + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + 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|
\\
\frac{\frac{1}{e^{x + x \cdot eps\_m}} + e^{x \cdot \left(eps\_m + -1\right)}}{2}
\end{array}
Initial program 75.8%
Simplified69.9%
Taylor expanded in eps around inf 98.7%
Final simplification98.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -2.6e-208) (/ (+ 1.0 (/ 1.0 (exp (+ x (* x eps_m))))) 2.0) (if (<= x 1.22e+176) (/ (+ 1.0 (exp (* x (+ eps_m -1.0)))) 2.0) 0.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -2.6e-208) {
tmp = (1.0 + (1.0 / exp((x + (x * eps_m))))) / 2.0;
} else if (x <= 1.22e+176) {
tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 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.6d-208)) then
tmp = (1.0d0 + (1.0d0 / exp((x + (x * eps_m))))) / 2.0d0
else if (x <= 1.22d+176) then
tmp = (1.0d0 + exp((x * (eps_m + (-1.0d0))))) / 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.6e-208) {
tmp = (1.0 + (1.0 / Math.exp((x + (x * eps_m))))) / 2.0;
} else if (x <= 1.22e+176) {
tmp = (1.0 + Math.exp((x * (eps_m + -1.0)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -2.6e-208: tmp = (1.0 + (1.0 / math.exp((x + (x * eps_m))))) / 2.0 elif x <= 1.22e+176: tmp = (1.0 + math.exp((x * (eps_m + -1.0)))) / 2.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -2.6e-208) tmp = Float64(Float64(1.0 + Float64(1.0 / exp(Float64(x + Float64(x * eps_m))))) / 2.0); elseif (x <= 1.22e+176) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps_m + -1.0)))) / 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.6e-208) tmp = (1.0 + (1.0 / exp((x + (x * eps_m))))) / 2.0; elseif (x <= 1.22e+176) tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 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.6e-208], N[(N[(1.0 + N[(1.0 / N[Exp[N[(x + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.22e+176], N[(N[(1.0 + N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{-208}:\\
\;\;\;\;\frac{1 + \frac{1}{e^{x + x \cdot eps\_m}}}{2}\\
\mathbf{elif}\;x \leq 1.22 \cdot 10^{+176}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -2.60000000000000017e-208Initial program 81.4%
Simplified72.1%
Taylor expanded in eps around inf 96.4%
Taylor expanded in x around 0 61.4%
if -2.60000000000000017e-208 < x < 1.2199999999999999e176Initial program 66.5%
Simplified66.5%
Taylor expanded in x around 0 38.4%
Taylor expanded in eps around inf 72.0%
mul-1-neg72.0%
distribute-lft-neg-in72.0%
Simplified72.0%
if 1.2199999999999999e176 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 62.7%
div-sub62.7%
mul-1-neg62.7%
rec-exp62.7%
+-inverses62.7%
metadata-eval62.7%
Simplified62.7%
Final simplification67.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -2.6e-208) (/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) 2.0) (if (<= x 1.95e+176) (/ (+ 1.0 (exp (* x (+ eps_m -1.0)))) 2.0) 0.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -2.6e-208) {
tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 1.95e+176) {
tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 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.6d-208)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
else if (x <= 1.95d+176) then
tmp = (1.0d0 + exp((x * (eps_m + (-1.0d0))))) / 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.6e-208) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 1.95e+176) {
tmp = (1.0 + Math.exp((x * (eps_m + -1.0)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -2.6e-208: tmp = (1.0 + math.exp((x * (-1.0 - eps_m)))) / 2.0 elif x <= 1.95e+176: tmp = (1.0 + math.exp((x * (eps_m + -1.0)))) / 2.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -2.6e-208) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); elseif (x <= 1.95e+176) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps_m + -1.0)))) / 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.6e-208) tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0; elseif (x <= 1.95e+176) tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 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.6e-208], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.95e+176], N[(N[(1.0 + N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{-208}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\mathbf{elif}\;x \leq 1.95 \cdot 10^{+176}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -2.60000000000000017e-208Initial program 81.4%
Simplified72.1%
Taylor expanded in eps around inf 96.4%
Taylor expanded in x around 0 61.4%
Taylor expanded in x around -inf 61.4%
rec-exp96.4%
cancel-sign-sub-inv96.4%
metadata-eval96.4%
*-lft-identity96.4%
+-commutative96.4%
distribute-rgt1-in96.4%
+-commutative96.4%
*-commutative96.4%
distribute-rgt-neg-in96.4%
+-commutative96.4%
neg-sub096.4%
+-commutative96.4%
associate--r+96.4%
metadata-eval96.4%
Simplified61.4%
if -2.60000000000000017e-208 < x < 1.9500000000000001e176Initial program 66.5%
Simplified66.5%
Taylor expanded in x around 0 38.4%
Taylor expanded in eps around inf 72.0%
mul-1-neg72.0%
distribute-lft-neg-in72.0%
Simplified72.0%
if 1.9500000000000001e176 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 62.7%
div-sub62.7%
mul-1-neg62.7%
rec-exp62.7%
+-inverses62.7%
metadata-eval62.7%
Simplified62.7%
Final simplification67.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -2.6e-208) (/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) 2.0) (if (<= x 2e+176) (/ (+ 1.0 (exp (* x eps_m))) 2.0) 0.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -2.6e-208) {
tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 2e+176) {
tmp = (1.0 + exp((x * 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.6d-208)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
else if (x <= 2d+176) then
tmp = (1.0d0 + exp((x * 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.6e-208) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 2e+176) {
tmp = (1.0 + Math.exp((x * 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.6e-208: tmp = (1.0 + math.exp((x * (-1.0 - eps_m)))) / 2.0 elif x <= 2e+176: tmp = (1.0 + math.exp((x * 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.6e-208) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); elseif (x <= 2e+176) tmp = Float64(Float64(1.0 + exp(Float64(x * 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.6e-208) tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0; elseif (x <= 2e+176) tmp = (1.0 + exp((x * 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.6e-208], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2e+176], N[(N[(1.0 + N[Exp[N[(x * 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.6 \cdot 10^{-208}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+176}:\\
\;\;\;\;\frac{1 + e^{x \cdot eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -2.60000000000000017e-208Initial program 81.4%
Simplified72.1%
Taylor expanded in eps around inf 96.4%
Taylor expanded in x around 0 61.4%
Taylor expanded in x around -inf 61.4%
rec-exp96.4%
cancel-sign-sub-inv96.4%
metadata-eval96.4%
*-lft-identity96.4%
+-commutative96.4%
distribute-rgt1-in96.4%
+-commutative96.4%
*-commutative96.4%
distribute-rgt-neg-in96.4%
+-commutative96.4%
neg-sub096.4%
+-commutative96.4%
associate--r+96.4%
metadata-eval96.4%
Simplified61.4%
if -2.60000000000000017e-208 < x < 2e176Initial program 66.5%
Simplified61.7%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 91.2%
*-commutative91.2%
Simplified91.2%
Taylor expanded in x around 0 71.9%
if 2e176 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 62.7%
div-sub62.7%
mul-1-neg62.7%
rec-exp62.7%
+-inverses62.7%
metadata-eval62.7%
Simplified62.7%
Final simplification67.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -2.6e-208) (/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) 2.0) (if (<= x 1e+175) (* (+ x 1.0) (exp x)) 0.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -2.6e-208) {
tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 1e+175) {
tmp = (x + 1.0) * exp(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 <= (-2.6d-208)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
else if (x <= 1d+175) then
tmp = (x + 1.0d0) * exp(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 <= -2.6e-208) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 1e+175) {
tmp = (x + 1.0) * Math.exp(x);
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -2.6e-208: tmp = (1.0 + math.exp((x * (-1.0 - eps_m)))) / 2.0 elif x <= 1e+175: tmp = (x + 1.0) * math.exp(x) else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -2.6e-208) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); elseif (x <= 1e+175) tmp = Float64(Float64(x + 1.0) * exp(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 <= -2.6e-208) tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0; elseif (x <= 1e+175) tmp = (x + 1.0) * exp(x); else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -2.6e-208], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1e+175], N[(N[(x + 1.0), $MachinePrecision] * N[Exp[x], $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{-208}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\mathbf{elif}\;x \leq 10^{+175}:\\
\;\;\;\;\left(x + 1\right) \cdot e^{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -2.60000000000000017e-208Initial program 81.4%
Simplified72.1%
Taylor expanded in eps around inf 96.4%
Taylor expanded in x around 0 61.4%
Taylor expanded in x around -inf 61.4%
rec-exp96.4%
cancel-sign-sub-inv96.4%
metadata-eval96.4%
*-lft-identity96.4%
+-commutative96.4%
distribute-rgt1-in96.4%
+-commutative96.4%
*-commutative96.4%
distribute-rgt-neg-in96.4%
+-commutative96.4%
neg-sub096.4%
+-commutative96.4%
associate--r+96.4%
metadata-eval96.4%
Simplified61.4%
if -2.60000000000000017e-208 < x < 9.9999999999999994e174Initial program 66.5%
Simplified48.6%
Taylor expanded in eps around 0 35.5%
associate-+r+69.7%
mul-1-neg69.7%
sub-neg69.7%
+-inverses69.7%
distribute-lft-out69.7%
distribute-rgt1-in69.7%
mul-1-neg69.7%
Simplified69.7%
Taylor expanded in eps around 0 69.7%
distribute-lft-in69.7%
*-rgt-identity69.7%
add-sqr-sqrt16.5%
sqrt-unprod78.6%
sqr-neg78.6%
sqrt-unprod62.0%
add-sqr-sqrt78.6%
add-sqr-sqrt16.5%
sqrt-unprod78.6%
sqr-neg78.6%
sqrt-unprod62.0%
add-sqr-sqrt78.6%
Applied egg-rr78.6%
*-commutative78.6%
distribute-rgt1-in78.6%
Simplified78.6%
if 9.9999999999999994e174 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 62.7%
div-sub62.7%
mul-1-neg62.7%
rec-exp62.7%
+-inverses62.7%
metadata-eval62.7%
Simplified62.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 0.00152) (/ (+ x 1.0) (exp x)) (/ (/ (+ (* eps_m 2.0) (* x (+ (* x eps_m) (* eps_m 2.0)))) eps_m) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 0.00152) {
tmp = (x + 1.0) / exp(x);
} else {
tmp = (((eps_m * 2.0) + (x * ((x * eps_m) + (eps_m * 2.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 <= 0.00152d0) then
tmp = (x + 1.0d0) / exp(x)
else
tmp = (((eps_m * 2.0d0) + (x * ((x * eps_m) + (eps_m * 2.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 <= 0.00152) {
tmp = (x + 1.0) / Math.exp(x);
} else {
tmp = (((eps_m * 2.0) + (x * ((x * eps_m) + (eps_m * 2.0)))) / eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 0.00152: tmp = (x + 1.0) / math.exp(x) else: tmp = (((eps_m * 2.0) + (x * ((x * eps_m) + (eps_m * 2.0)))) / eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 0.00152) tmp = Float64(Float64(x + 1.0) / exp(x)); else tmp = Float64(Float64(Float64(Float64(eps_m * 2.0) + Float64(x * Float64(Float64(x * eps_m) + Float64(eps_m * 2.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 <= 0.00152) tmp = (x + 1.0) / exp(x); else tmp = (((eps_m * 2.0) + (x * ((x * eps_m) + (eps_m * 2.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, 0.00152], N[(N[(x + 1.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(eps$95$m * 2.0), $MachinePrecision] + N[(x * N[(N[(x * eps$95$m), $MachinePrecision] + N[(eps$95$m * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 0.00152:\\
\;\;\;\;\frac{x + 1}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{eps\_m \cdot 2 + x \cdot \left(x \cdot eps\_m + eps\_m \cdot 2\right)}{eps\_m}}{2}\\
\end{array}
\end{array}
if eps < 0.0015200000000000001Initial program 66.1%
Simplified57.3%
Taylor expanded in eps around 0 31.3%
associate-+r+65.5%
mul-1-neg65.5%
sub-neg65.5%
+-inverses65.5%
distribute-lft-out65.5%
distribute-rgt1-in66.0%
mul-1-neg66.0%
Simplified66.0%
Taylor expanded in eps around 0 66.0%
+-commutative66.0%
*-commutative66.0%
exp-neg66.0%
un-div-inv66.1%
Applied egg-rr66.1%
if 0.0015200000000000001 < eps Initial program 100.0%
Simplified79.8%
Taylor expanded in eps around 0 25.5%
associate-+r+25.6%
mul-1-neg25.6%
sub-neg25.6%
+-inverses25.6%
distribute-lft-out25.6%
distribute-rgt1-in25.6%
mul-1-neg25.6%
Simplified25.6%
Taylor expanded in x around 0 44.5%
Taylor expanded in x around inf 44.5%
*-commutative44.5%
Simplified44.5%
Taylor expanded in x around 0 64.0%
Final simplification65.5%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 0.00152) (/ (+ x 1.0) (+ 1.0 (* x (+ 1.0 (* x 0.5))))) (/ (/ (+ (* eps_m 2.0) (* x (+ (* x eps_m) (* eps_m 2.0)))) eps_m) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 0.00152) {
tmp = (x + 1.0) / (1.0 + (x * (1.0 + (x * 0.5))));
} else {
tmp = (((eps_m * 2.0) + (x * ((x * eps_m) + (eps_m * 2.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 <= 0.00152d0) then
tmp = (x + 1.0d0) / (1.0d0 + (x * (1.0d0 + (x * 0.5d0))))
else
tmp = (((eps_m * 2.0d0) + (x * ((x * eps_m) + (eps_m * 2.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 <= 0.00152) {
tmp = (x + 1.0) / (1.0 + (x * (1.0 + (x * 0.5))));
} else {
tmp = (((eps_m * 2.0) + (x * ((x * eps_m) + (eps_m * 2.0)))) / eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 0.00152: tmp = (x + 1.0) / (1.0 + (x * (1.0 + (x * 0.5)))) else: tmp = (((eps_m * 2.0) + (x * ((x * eps_m) + (eps_m * 2.0)))) / eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 0.00152) tmp = Float64(Float64(x + 1.0) / Float64(1.0 + Float64(x * Float64(1.0 + Float64(x * 0.5))))); else tmp = Float64(Float64(Float64(Float64(eps_m * 2.0) + Float64(x * Float64(Float64(x * eps_m) + Float64(eps_m * 2.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 <= 0.00152) tmp = (x + 1.0) / (1.0 + (x * (1.0 + (x * 0.5)))); else tmp = (((eps_m * 2.0) + (x * ((x * eps_m) + (eps_m * 2.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, 0.00152], N[(N[(x + 1.0), $MachinePrecision] / N[(1.0 + N[(x * N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(eps$95$m * 2.0), $MachinePrecision] + N[(x * N[(N[(x * eps$95$m), $MachinePrecision] + N[(eps$95$m * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 0.00152:\\
\;\;\;\;\frac{x + 1}{1 + x \cdot \left(1 + x \cdot 0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{eps\_m \cdot 2 + x \cdot \left(x \cdot eps\_m + eps\_m \cdot 2\right)}{eps\_m}}{2}\\
\end{array}
\end{array}
if eps < 0.0015200000000000001Initial program 66.1%
Simplified57.3%
Taylor expanded in eps around 0 31.3%
associate-+r+65.5%
mul-1-neg65.5%
sub-neg65.5%
+-inverses65.5%
distribute-lft-out65.5%
distribute-rgt1-in66.0%
mul-1-neg66.0%
Simplified66.0%
Taylor expanded in eps around 0 66.0%
+-commutative66.0%
*-commutative66.0%
exp-neg66.0%
un-div-inv66.1%
Applied egg-rr66.1%
Taylor expanded in x around 0 57.4%
*-commutative57.4%
Simplified57.4%
if 0.0015200000000000001 < eps Initial program 100.0%
Simplified79.8%
Taylor expanded in eps around 0 25.5%
associate-+r+25.6%
mul-1-neg25.6%
sub-neg25.6%
+-inverses25.6%
distribute-lft-out25.6%
distribute-rgt1-in25.6%
mul-1-neg25.6%
Simplified25.6%
Taylor expanded in x around 0 44.5%
Taylor expanded in x around inf 44.5%
*-commutative44.5%
Simplified44.5%
Taylor expanded in x around 0 64.0%
Final simplification59.3%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -5.8e+142) (/ (+ 2.0 (* x (+ x 2.0))) 2.0) (if (<= x 2.3e-6) (+ 1.0 (* -0.5 (* x (+ eps_m 1.0)))) 0.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -5.8e+142) {
tmp = (2.0 + (x * (x + 2.0))) / 2.0;
} else if (x <= 2.3e-6) {
tmp = 1.0 + (-0.5 * (x * (eps_m + 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 <= (-5.8d+142)) then
tmp = (2.0d0 + (x * (x + 2.0d0))) / 2.0d0
else if (x <= 2.3d-6) then
tmp = 1.0d0 + ((-0.5d0) * (x * (eps_m + 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 <= -5.8e+142) {
tmp = (2.0 + (x * (x + 2.0))) / 2.0;
} else if (x <= 2.3e-6) {
tmp = 1.0 + (-0.5 * (x * (eps_m + 1.0)));
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -5.8e+142: tmp = (2.0 + (x * (x + 2.0))) / 2.0 elif x <= 2.3e-6: tmp = 1.0 + (-0.5 * (x * (eps_m + 1.0))) else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -5.8e+142) tmp = Float64(Float64(2.0 + Float64(x * Float64(x + 2.0))) / 2.0); elseif (x <= 2.3e-6) tmp = Float64(1.0 + Float64(-0.5 * Float64(x * Float64(eps_m + 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 <= -5.8e+142) tmp = (2.0 + (x * (x + 2.0))) / 2.0; elseif (x <= 2.3e-6) tmp = 1.0 + (-0.5 * (x * (eps_m + 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, -5.8e+142], N[(N[(2.0 + N[(x * N[(x + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.3e-6], N[(1.0 + N[(-0.5 * N[(x * N[(eps$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.8 \cdot 10^{+142}:\\
\;\;\;\;\frac{2 + x \cdot \left(x + 2\right)}{2}\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-6}:\\
\;\;\;\;1 + -0.5 \cdot \left(x \cdot \left(eps\_m + 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -5.80000000000000027e142Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 0.0%
associate-+r+0.0%
mul-1-neg0.0%
sub-neg0.0%
+-inverses0.0%
distribute-lft-out0.0%
distribute-rgt1-in0.0%
mul-1-neg0.0%
Simplified0.0%
Taylor expanded in x around 0 0.0%
Taylor expanded in x around inf 0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in x around 0 93.3%
+-commutative93.3%
Simplified93.3%
if -5.80000000000000027e142 < x < 2.3e-6Initial program 60.5%
Simplified50.9%
Taylor expanded in eps around inf 97.8%
Taylor expanded in x around 0 82.1%
Taylor expanded in x around 0 67.6%
if 2.3e-6 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 46.7%
div-sub46.7%
mul-1-neg46.7%
rec-exp46.7%
+-inverses46.7%
metadata-eval46.7%
Simplified46.7%
Final simplification64.4%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 2.3e-6) (+ 1.0 (* -0.5 (* x (+ eps_m 1.0)))) 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 2.3e-6) {
tmp = 1.0 + (-0.5 * (x * (eps_m + 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 <= 2.3d-6) then
tmp = 1.0d0 + ((-0.5d0) * (x * (eps_m + 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 <= 2.3e-6) {
tmp = 1.0 + (-0.5 * (x * (eps_m + 1.0)));
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 2.3e-6: tmp = 1.0 + (-0.5 * (x * (eps_m + 1.0))) else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 2.3e-6) tmp = Float64(1.0 + Float64(-0.5 * Float64(x * Float64(eps_m + 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 <= 2.3e-6) tmp = 1.0 + (-0.5 * (x * (eps_m + 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, 2.3e-6], N[(1.0 + N[(-0.5 * N[(x * N[(eps$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.3 \cdot 10^{-6}:\\
\;\;\;\;1 + -0.5 \cdot \left(x \cdot \left(eps\_m + 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2.3e-6Initial program 66.3%
Simplified58.1%
Taylor expanded in eps around inf 98.2%
Taylor expanded in x around 0 76.8%
Taylor expanded in x around 0 62.3%
if 2.3e-6 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 46.7%
div-sub46.7%
mul-1-neg46.7%
rec-exp46.7%
+-inverses46.7%
metadata-eval46.7%
Simplified46.7%
Final simplification57.9%
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 66.4%
Simplified58.3%
Taylor expanded in eps around inf 98.2%
Taylor expanded in x around 0 56.8%
*-commutative56.8%
Simplified56.8%
Taylor expanded in x around 0 56.8%
neg-mul-156.8%
sub-neg56.8%
Simplified56.8%
if 1 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 47.3%
div-sub47.3%
mul-1-neg47.3%
rec-exp47.3%
+-inverses47.3%
metadata-eval47.3%
Simplified47.3%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 1.7e+22) 1.0 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1.7e+22) {
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.7d+22) 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.7e+22) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1.7e+22: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1.7e+22) 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.7e+22) 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.7e+22], 1.0, 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.7 \cdot 10^{+22}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.7e22Initial program 67.3%
Simplified51.1%
Taylor expanded in eps around 0 22.3%
associate-+r+55.3%
mul-1-neg55.3%
sub-neg55.3%
+-inverses55.3%
distribute-lft-out55.3%
distribute-rgt1-in55.8%
mul-1-neg55.8%
Simplified55.8%
Taylor expanded in eps around 0 55.8%
+-commutative55.8%
*-commutative55.8%
exp-neg55.8%
un-div-inv55.8%
Applied egg-rr55.8%
Taylor expanded in x around 0 55.0%
if 1.7e22 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 50.8%
div-sub50.8%
mul-1-neg50.8%
rec-exp50.8%
+-inverses50.8%
metadata-eval50.8%
Simplified50.8%
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.8%
Simplified69.9%
Taylor expanded in eps around 0 14.6%
div-sub14.6%
mul-1-neg14.6%
rec-exp14.6%
+-inverses14.9%
metadata-eval14.9%
Simplified14.9%
herbie shell --seed 2024148
(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))