
(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 13 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 6e-6)
(/ (* (/ 2.0 (exp x)) (+ x 1.0)) 2.0)
(/
(-
(* (+ 1.0 (/ 1.0 eps_m)) (exp (* x (+ eps_m -1.0))))
(* (+ (/ 1.0 eps_m) -1.0) (exp (* x (- -1.0 eps_m)))))
2.0)))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 6e-6) {
tmp = ((2.0 / exp(x)) * (x + 1.0)) / 2.0;
} else {
tmp = (((1.0 + (1.0 / eps_m)) * exp((x * (eps_m + -1.0)))) - (((1.0 / eps_m) + -1.0) * 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 <= 6d-6) then
tmp = ((2.0d0 / exp(x)) * (x + 1.0d0)) / 2.0d0
else
tmp = (((1.0d0 + (1.0d0 / eps_m)) * exp((x * (eps_m + (-1.0d0))))) - (((1.0d0 / eps_m) + (-1.0d0)) * 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 <= 6e-6) {
tmp = ((2.0 / Math.exp(x)) * (x + 1.0)) / 2.0;
} else {
tmp = (((1.0 + (1.0 / eps_m)) * Math.exp((x * (eps_m + -1.0)))) - (((1.0 / eps_m) + -1.0) * 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 <= 6e-6: tmp = ((2.0 / math.exp(x)) * (x + 1.0)) / 2.0 else: tmp = (((1.0 + (1.0 / eps_m)) * math.exp((x * (eps_m + -1.0)))) - (((1.0 / eps_m) + -1.0) * 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 <= 6e-6) tmp = Float64(Float64(Float64(2.0 / exp(x)) * Float64(x + 1.0)) / 2.0); else tmp = Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) * exp(Float64(x * Float64(eps_m + -1.0)))) - Float64(Float64(Float64(1.0 / eps_m) + -1.0) * 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 <= 6e-6) tmp = ((2.0 / exp(x)) * (x + 1.0)) / 2.0; else tmp = (((1.0 + (1.0 / eps_m)) * exp((x * (eps_m + -1.0)))) - (((1.0 / eps_m) + -1.0) * 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, 6e-6], N[(N[(N[(2.0 / N[Exp[x], $MachinePrecision]), $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps$95$m), $MachinePrecision] + -1.0), $MachinePrecision] * N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 6 \cdot 10^{-6}:\\
\;\;\;\;\frac{\frac{2}{e^{x}} \cdot \left(x + 1\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) \cdot e^{x \cdot \left(eps\_m + -1\right)} - \left(\frac{1}{eps\_m} + -1\right) \cdot e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\end{array}
\end{array}
if eps < 6.0000000000000002e-6Initial program 61.9%
Simplified54.0%
Taylor expanded in eps around 0 31.1%
Simplified70.6%
Taylor expanded in eps around 0 70.6%
associate-*r*70.6%
exp-neg70.6%
associate-*r/70.6%
metadata-eval70.6%
Simplified70.6%
if 6.0000000000000002e-6 < eps Initial program 100.0%
Final simplification79.6%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -3.6e-187)
(/ (+ 1.0 (exp (- x (* eps_m x)))) 2.0)
(if (<= x 3.9e+148)
(/ (+ 1.0 (exp (* eps_m x))) 2.0)
(if (or (<= x 9.8e+219) (not (<= x 2.9e+296)))
(/ (* (/ 2.0 (exp x)) (+ x 1.0)) 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 <= -3.6e-187) {
tmp = (1.0 + exp((x - (eps_m * x)))) / 2.0;
} else if (x <= 3.9e+148) {
tmp = (1.0 + exp((eps_m * x))) / 2.0;
} else if ((x <= 9.8e+219) || !(x <= 2.9e+296)) {
tmp = ((2.0 / exp(x)) * (x + 1.0)) / 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 <= (-3.6d-187)) then
tmp = (1.0d0 + exp((x - (eps_m * x)))) / 2.0d0
else if (x <= 3.9d+148) then
tmp = (1.0d0 + exp((eps_m * x))) / 2.0d0
else if ((x <= 9.8d+219) .or. (.not. (x <= 2.9d+296))) then
tmp = ((2.0d0 / exp(x)) * (x + 1.0d0)) / 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 <= -3.6e-187) {
tmp = (1.0 + Math.exp((x - (eps_m * x)))) / 2.0;
} else if (x <= 3.9e+148) {
tmp = (1.0 + Math.exp((eps_m * x))) / 2.0;
} else if ((x <= 9.8e+219) || !(x <= 2.9e+296)) {
tmp = ((2.0 / Math.exp(x)) * (x + 1.0)) / 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 <= -3.6e-187: tmp = (1.0 + math.exp((x - (eps_m * x)))) / 2.0 elif x <= 3.9e+148: tmp = (1.0 + math.exp((eps_m * x))) / 2.0 elif (x <= 9.8e+219) or not (x <= 2.9e+296): tmp = ((2.0 / math.exp(x)) * (x + 1.0)) / 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 <= -3.6e-187) tmp = Float64(Float64(1.0 + exp(Float64(x - Float64(eps_m * x)))) / 2.0); elseif (x <= 3.9e+148) tmp = Float64(Float64(1.0 + exp(Float64(eps_m * x))) / 2.0); elseif ((x <= 9.8e+219) || !(x <= 2.9e+296)) tmp = Float64(Float64(Float64(2.0 / exp(x)) * Float64(x + 1.0)) / 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 <= -3.6e-187) tmp = (1.0 + exp((x - (eps_m * x)))) / 2.0; elseif (x <= 3.9e+148) tmp = (1.0 + exp((eps_m * x))) / 2.0; elseif ((x <= 9.8e+219) || ~((x <= 2.9e+296))) tmp = ((2.0 / exp(x)) * (x + 1.0)) / 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, -3.6e-187], N[(N[(1.0 + N[Exp[N[(x - N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 3.9e+148], N[(N[(1.0 + N[Exp[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 9.8e+219], N[Not[LessEqual[x, 2.9e+296]], $MachinePrecision]], N[(N[(N[(2.0 / N[Exp[x], $MachinePrecision]), $MachinePrecision] * N[(x + 1.0), $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 -3.6 \cdot 10^{-187}:\\
\;\;\;\;\frac{1 + e^{x - eps\_m \cdot x}}{2}\\
\mathbf{elif}\;x \leq 3.9 \cdot 10^{+148}:\\
\;\;\;\;\frac{1 + e^{eps\_m \cdot x}}{2}\\
\mathbf{elif}\;x \leq 9.8 \cdot 10^{+219} \lor \neg \left(x \leq 2.9 \cdot 10^{+296}\right):\\
\;\;\;\;\frac{\frac{2}{e^{x}} \cdot \left(x + 1\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\end{array}
\end{array}
if x < -3.59999999999999994e-187Initial program 78.2%
Simplified78.2%
Taylor expanded in x around 0 47.5%
Taylor expanded in eps around inf 65.4%
neg-mul-165.4%
distribute-rgt-neg-in65.4%
Simplified65.4%
add-sqr-sqrt3.5%
sqrt-unprod30.8%
sqr-neg30.8%
sqrt-unprod27.9%
add-sqr-sqrt62.9%
sub-neg62.9%
distribute-rgt-in62.9%
*-un-lft-identity62.9%
Applied egg-rr62.9%
if -3.59999999999999994e-187 < x < 3.90000000000000002e148Initial program 63.8%
Simplified63.8%
Taylor expanded in x around 0 40.7%
Taylor expanded in eps around inf 76.5%
neg-mul-176.5%
distribute-rgt-neg-in76.5%
Simplified76.5%
Taylor expanded in eps around inf 77.5%
*-commutative77.5%
Simplified77.5%
if 3.90000000000000002e148 < x < 9.80000000000000007e219 or 2.90000000000000004e296 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 82.1%
Simplified82.1%
Taylor expanded in eps around 0 82.1%
associate-*r*82.1%
exp-neg82.1%
associate-*r/82.1%
metadata-eval82.1%
Simplified82.1%
if 9.80000000000000007e219 < x < 2.90000000000000004e296Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 28.8%
Taylor expanded in eps around inf 29.0%
neg-mul-129.0%
distribute-rgt-neg-in29.0%
Simplified29.0%
Final simplification70.5%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= eps_m 1.0)
(/ (* (/ 2.0 (exp x)) (+ x 1.0)) 2.0)
(if (or (<= eps_m 4.1e+242) (not (<= eps_m 1.35e+253)))
(/ (+ 1.0 (exp (* eps_m x))) 2.0)
(/ (+ 2.0 (/ (- (* eps_m (- (* 2.0 x) (* eps_m x))) x) eps_m)) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 1.0) {
tmp = ((2.0 / exp(x)) * (x + 1.0)) / 2.0;
} else if ((eps_m <= 4.1e+242) || !(eps_m <= 1.35e+253)) {
tmp = (1.0 + exp((eps_m * x))) / 2.0;
} else {
tmp = (2.0 + (((eps_m * ((2.0 * x) - (eps_m * x))) - 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 <= 1.0d0) then
tmp = ((2.0d0 / exp(x)) * (x + 1.0d0)) / 2.0d0
else if ((eps_m <= 4.1d+242) .or. (.not. (eps_m <= 1.35d+253))) then
tmp = (1.0d0 + exp((eps_m * x))) / 2.0d0
else
tmp = (2.0d0 + (((eps_m * ((2.0d0 * x) - (eps_m * x))) - 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 <= 1.0) {
tmp = ((2.0 / Math.exp(x)) * (x + 1.0)) / 2.0;
} else if ((eps_m <= 4.1e+242) || !(eps_m <= 1.35e+253)) {
tmp = (1.0 + Math.exp((eps_m * x))) / 2.0;
} else {
tmp = (2.0 + (((eps_m * ((2.0 * x) - (eps_m * x))) - x) / eps_m)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 1.0: tmp = ((2.0 / math.exp(x)) * (x + 1.0)) / 2.0 elif (eps_m <= 4.1e+242) or not (eps_m <= 1.35e+253): tmp = (1.0 + math.exp((eps_m * x))) / 2.0 else: tmp = (2.0 + (((eps_m * ((2.0 * x) - (eps_m * x))) - x) / eps_m)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 1.0) tmp = Float64(Float64(Float64(2.0 / exp(x)) * Float64(x + 1.0)) / 2.0); elseif ((eps_m <= 4.1e+242) || !(eps_m <= 1.35e+253)) tmp = Float64(Float64(1.0 + exp(Float64(eps_m * x))) / 2.0); else tmp = Float64(Float64(2.0 + Float64(Float64(Float64(eps_m * Float64(Float64(2.0 * x) - Float64(eps_m * x))) - 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 <= 1.0) tmp = ((2.0 / exp(x)) * (x + 1.0)) / 2.0; elseif ((eps_m <= 4.1e+242) || ~((eps_m <= 1.35e+253))) tmp = (1.0 + exp((eps_m * x))) / 2.0; else tmp = (2.0 + (((eps_m * ((2.0 * x) - (eps_m * x))) - 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, 1.0], N[(N[(N[(2.0 / N[Exp[x], $MachinePrecision]), $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[eps$95$m, 4.1e+242], N[Not[LessEqual[eps$95$m, 1.35e+253]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(N[(N[(eps$95$m * N[(N[(2.0 * x), $MachinePrecision] - N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 1:\\
\;\;\;\;\frac{\frac{2}{e^{x}} \cdot \left(x + 1\right)}{2}\\
\mathbf{elif}\;eps\_m \leq 4.1 \cdot 10^{+242} \lor \neg \left(eps\_m \leq 1.35 \cdot 10^{+253}\right):\\
\;\;\;\;\frac{1 + e^{eps\_m \cdot x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \frac{eps\_m \cdot \left(2 \cdot x - eps\_m \cdot x\right) - x}{eps\_m}}{2}\\
\end{array}
\end{array}
if eps < 1Initial program 62.5%
Simplified54.7%
Taylor expanded in eps around 0 32.2%
Simplified71.1%
Taylor expanded in eps around 0 71.1%
associate-*r*71.1%
exp-neg71.1%
associate-*r/71.1%
metadata-eval71.1%
Simplified71.1%
if 1 < eps < 4.09999999999999979e242 or 1.35000000000000001e253 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 69.1%
Taylor expanded in eps around inf 69.1%
neg-mul-169.1%
distribute-rgt-neg-in69.1%
Simplified69.1%
Taylor expanded in eps around inf 69.1%
*-commutative69.1%
Simplified69.1%
if 4.09999999999999979e242 < eps < 1.35000000000000001e253Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 3.1%
Taylor expanded in x around 0 0.3%
*-commutative0.3%
associate-*r*0.3%
associate-*r*0.3%
associate-*l*0.3%
distribute-lft-in0.3%
metadata-eval0.3%
associate-*r/0.3%
metadata-eval0.3%
*-commutative0.3%
Simplified0.3%
*-commutative0.3%
distribute-lft-in0.3%
add-sqr-sqrt0.0%
sqrt-unprod100.0%
sqr-neg100.0%
sqrt-unprod5.9%
add-sqr-sqrt5.9%
neg-sub05.9%
associate--r-5.9%
metadata-eval5.9%
add-sqr-sqrt0.0%
sqrt-unprod100.0%
sqr-neg100.0%
sqrt-unprod5.9%
add-sqr-sqrt5.9%
neg-sub05.9%
associate--r-5.9%
metadata-eval5.9%
add-sqr-sqrt0.0%
Applied egg-rr5.9%
distribute-lft-out5.9%
*-commutative5.9%
associate-*l*5.9%
+-commutative5.9%
+-commutative5.9%
distribute-rgt-in5.9%
associate-*l/5.9%
*-lft-identity5.9%
neg-mul-15.9%
unsub-neg5.9%
Simplified5.9%
Taylor expanded in eps around 0 100.0%
Final simplification70.9%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= eps_m 1.0)
(/ (* (/ 2.0 (exp x)) (+ x 1.0)) 2.0)
(if (<= eps_m 2.6e+242)
(/ (+ 1.0 (exp (* x (+ eps_m -1.0)))) 2.0)
(if (<= eps_m 2.05e+253)
(/ (+ 2.0 (/ (- (* eps_m (- (* 2.0 x) (* eps_m x))) x) eps_m)) 2.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 <= 1.0) {
tmp = ((2.0 / exp(x)) * (x + 1.0)) / 2.0;
} else if (eps_m <= 2.6e+242) {
tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0;
} else if (eps_m <= 2.05e+253) {
tmp = (2.0 + (((eps_m * ((2.0 * x) - (eps_m * x))) - x) / eps_m)) / 2.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 <= 1.0d0) then
tmp = ((2.0d0 / exp(x)) * (x + 1.0d0)) / 2.0d0
else if (eps_m <= 2.6d+242) then
tmp = (1.0d0 + exp((x * (eps_m + (-1.0d0))))) / 2.0d0
else if (eps_m <= 2.05d+253) then
tmp = (2.0d0 + (((eps_m * ((2.0d0 * x) - (eps_m * x))) - x) / eps_m)) / 2.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 <= 1.0) {
tmp = ((2.0 / Math.exp(x)) * (x + 1.0)) / 2.0;
} else if (eps_m <= 2.6e+242) {
tmp = (1.0 + Math.exp((x * (eps_m + -1.0)))) / 2.0;
} else if (eps_m <= 2.05e+253) {
tmp = (2.0 + (((eps_m * ((2.0 * x) - (eps_m * x))) - x) / eps_m)) / 2.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 <= 1.0: tmp = ((2.0 / math.exp(x)) * (x + 1.0)) / 2.0 elif eps_m <= 2.6e+242: tmp = (1.0 + math.exp((x * (eps_m + -1.0)))) / 2.0 elif eps_m <= 2.05e+253: tmp = (2.0 + (((eps_m * ((2.0 * x) - (eps_m * x))) - x) / eps_m)) / 2.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 <= 1.0) tmp = Float64(Float64(Float64(2.0 / exp(x)) * Float64(x + 1.0)) / 2.0); elseif (eps_m <= 2.6e+242) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps_m + -1.0)))) / 2.0); elseif (eps_m <= 2.05e+253) tmp = Float64(Float64(2.0 + Float64(Float64(Float64(eps_m * Float64(Float64(2.0 * x) - Float64(eps_m * x))) - x) / eps_m)) / 2.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 <= 1.0) tmp = ((2.0 / exp(x)) * (x + 1.0)) / 2.0; elseif (eps_m <= 2.6e+242) tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0; elseif (eps_m <= 2.05e+253) tmp = (2.0 + (((eps_m * ((2.0 * x) - (eps_m * x))) - x) / eps_m)) / 2.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, 1.0], N[(N[(N[(2.0 / N[Exp[x], $MachinePrecision]), $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps$95$m, 2.6e+242], N[(N[(1.0 + N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps$95$m, 2.05e+253], N[(N[(2.0 + N[(N[(N[(eps$95$m * N[(N[(2.0 * x), $MachinePrecision] - N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $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 1:\\
\;\;\;\;\frac{\frac{2}{e^{x}} \cdot \left(x + 1\right)}{2}\\
\mathbf{elif}\;eps\_m \leq 2.6 \cdot 10^{+242}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\mathbf{elif}\;eps\_m \leq 2.05 \cdot 10^{+253}:\\
\;\;\;\;\frac{2 + \frac{eps\_m \cdot \left(2 \cdot x - eps\_m \cdot x\right) - x}{eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{eps\_m \cdot x}}{2}\\
\end{array}
\end{array}
if eps < 1Initial program 62.5%
Simplified54.7%
Taylor expanded in eps around 0 32.2%
Simplified71.1%
Taylor expanded in eps around 0 71.1%
associate-*r*71.1%
exp-neg71.1%
associate-*r/71.1%
metadata-eval71.1%
Simplified71.1%
if 1 < eps < 2.5999999999999998e242Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 68.3%
Taylor expanded in eps around inf 68.3%
neg-mul-168.3%
distribute-rgt-neg-in68.3%
Simplified68.3%
if 2.5999999999999998e242 < eps < 2.05e253Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 3.1%
Taylor expanded in x around 0 0.3%
*-commutative0.3%
associate-*r*0.3%
associate-*r*0.3%
associate-*l*0.3%
distribute-lft-in0.3%
metadata-eval0.3%
associate-*r/0.3%
metadata-eval0.3%
*-commutative0.3%
Simplified0.3%
*-commutative0.3%
distribute-lft-in0.3%
add-sqr-sqrt0.0%
sqrt-unprod100.0%
sqr-neg100.0%
sqrt-unprod5.9%
add-sqr-sqrt5.9%
neg-sub05.9%
associate--r-5.9%
metadata-eval5.9%
add-sqr-sqrt0.0%
sqrt-unprod100.0%
sqr-neg100.0%
sqrt-unprod5.9%
add-sqr-sqrt5.9%
neg-sub05.9%
associate--r-5.9%
metadata-eval5.9%
add-sqr-sqrt0.0%
Applied egg-rr5.9%
distribute-lft-out5.9%
*-commutative5.9%
associate-*l*5.9%
+-commutative5.9%
+-commutative5.9%
distribute-rgt-in5.9%
associate-*l/5.9%
*-lft-identity5.9%
neg-mul-15.9%
unsub-neg5.9%
Simplified5.9%
Taylor expanded in eps around 0 100.0%
if 2.05e253 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 72.3%
Taylor expanded in eps around inf 72.3%
neg-mul-172.3%
distribute-rgt-neg-in72.3%
Simplified72.3%
Taylor expanded in eps around inf 72.3%
*-commutative72.3%
Simplified72.3%
Final simplification70.9%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -4.2e-5)
(/ (+ 2.0 (/ (- (* eps_m (- (* 2.0 x) (* eps_m x))) x) eps_m)) 2.0)
(if (<= x 580.0)
1.0
(if (<= x 1e+146)
(/ (/ (expm1 x) eps_m) 2.0)
(if (<= x 2.5e+227)
0.0
(if (<= x 2.25e+296) (/ (+ 2.0 (* eps_m x)) 2.0) 0.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -4.2e-5) {
tmp = (2.0 + (((eps_m * ((2.0 * x) - (eps_m * x))) - x) / eps_m)) / 2.0;
} else if (x <= 580.0) {
tmp = 1.0;
} else if (x <= 1e+146) {
tmp = (expm1(x) / eps_m) / 2.0;
} else if (x <= 2.5e+227) {
tmp = 0.0;
} else if (x <= 2.25e+296) {
tmp = (2.0 + (eps_m * x)) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -4.2e-5) {
tmp = (2.0 + (((eps_m * ((2.0 * x) - (eps_m * x))) - x) / eps_m)) / 2.0;
} else if (x <= 580.0) {
tmp = 1.0;
} else if (x <= 1e+146) {
tmp = (Math.expm1(x) / eps_m) / 2.0;
} else if (x <= 2.5e+227) {
tmp = 0.0;
} else if (x <= 2.25e+296) {
tmp = (2.0 + (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 <= -4.2e-5: tmp = (2.0 + (((eps_m * ((2.0 * x) - (eps_m * x))) - x) / eps_m)) / 2.0 elif x <= 580.0: tmp = 1.0 elif x <= 1e+146: tmp = (math.expm1(x) / eps_m) / 2.0 elif x <= 2.5e+227: tmp = 0.0 elif x <= 2.25e+296: tmp = (2.0 + (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 <= -4.2e-5) tmp = Float64(Float64(2.0 + Float64(Float64(Float64(eps_m * Float64(Float64(2.0 * x) - Float64(eps_m * x))) - x) / eps_m)) / 2.0); elseif (x <= 580.0) tmp = 1.0; elseif (x <= 1e+146) tmp = Float64(Float64(expm1(x) / eps_m) / 2.0); elseif (x <= 2.5e+227) tmp = 0.0; elseif (x <= 2.25e+296) tmp = Float64(Float64(2.0 + Float64(eps_m * x)) / 2.0); else tmp = 0.0; end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -4.2e-5], N[(N[(2.0 + N[(N[(N[(eps$95$m * N[(N[(2.0 * x), $MachinePrecision] - N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 580.0], 1.0, If[LessEqual[x, 1e+146], N[(N[(N[(Exp[x] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.5e+227], 0.0, If[LessEqual[x, 2.25e+296], N[(N[(2.0 + N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.2 \cdot 10^{-5}:\\
\;\;\;\;\frac{2 + \frac{eps\_m \cdot \left(2 \cdot x - eps\_m \cdot x\right) - x}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq 580:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 10^{+146}:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(x\right)}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{+227}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 2.25 \cdot 10^{+296}:\\
\;\;\;\;\frac{2 + eps\_m \cdot x}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -4.19999999999999977e-5Initial program 97.3%
Simplified97.3%
Taylor expanded in x around 0 66.0%
Taylor expanded in x around 0 24.5%
*-commutative24.5%
associate-*r*24.5%
associate-*r*24.5%
associate-*l*24.5%
distribute-lft-in24.5%
metadata-eval24.5%
associate-*r/24.5%
metadata-eval24.5%
*-commutative24.5%
Simplified24.5%
*-commutative24.5%
distribute-lft-in2.9%
add-sqr-sqrt2.9%
sqrt-unprod31.7%
sqr-neg31.7%
sqrt-unprod1.5%
add-sqr-sqrt1.6%
neg-sub01.6%
associate--r-1.6%
metadata-eval1.6%
add-sqr-sqrt0.2%
sqrt-unprod22.6%
sqr-neg22.6%
sqrt-unprod15.0%
add-sqr-sqrt15.1%
neg-sub015.1%
associate--r-15.1%
metadata-eval15.1%
add-sqr-sqrt0.1%
Applied egg-rr1.6%
distribute-lft-out15.2%
*-commutative15.2%
associate-*l*15.2%
+-commutative15.2%
+-commutative15.2%
distribute-rgt-in15.2%
associate-*l/15.2%
*-lft-identity15.2%
neg-mul-115.2%
unsub-neg15.2%
Simplified15.2%
Taylor expanded in eps around 0 27.5%
if -4.19999999999999977e-5 < x < 580Initial program 53.6%
Simplified53.6%
Taylor expanded in x around 0 74.0%
if 580 < x < 9.99999999999999934e145Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 38.5%
Taylor expanded in eps around 0 1.9%
expm1-define1.9%
neg-mul-11.9%
Simplified1.9%
expm1-undefine1.9%
div-sub1.9%
add-sqr-sqrt0.0%
sqrt-unprod37.5%
sqr-neg37.5%
sqrt-unprod37.5%
add-sqr-sqrt37.5%
Applied egg-rr37.5%
div-sub37.5%
expm1-undefine37.5%
Simplified37.5%
if 9.99999999999999934e145 < x < 2.4999999999999998e227 or 2.2499999999999998e296 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 79.5%
mul-1-neg79.5%
mul-1-neg79.5%
rec-exp79.5%
sub-neg79.5%
div-sub79.5%
rec-exp79.5%
mul-1-neg79.5%
+-inverses79.5%
Simplified79.5%
if 2.4999999999999998e227 < x < 2.2499999999999998e296Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 25.4%
Taylor expanded in eps around inf 25.5%
neg-mul-125.5%
distribute-rgt-neg-in25.5%
Simplified25.5%
Taylor expanded in eps around inf 25.2%
*-commutative25.2%
Simplified25.2%
Taylor expanded in x around 0 23.5%
Final simplification59.8%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -6200.0)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (<= x 3.7e+148)
(/ (+ 1.0 (exp (* eps_m x))) 2.0)
(if (<= x 1.15e+228)
0.0
(if (<= x 2e+296) (/ (+ 2.0 (* eps_m x)) 2.0) 0.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -6200.0) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 3.7e+148) {
tmp = (1.0 + exp((eps_m * x))) / 2.0;
} else if (x <= 1.15e+228) {
tmp = 0.0;
} else if (x <= 2e+296) {
tmp = (2.0 + (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 <= (-6200.0d0)) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= 3.7d+148) then
tmp = (1.0d0 + exp((eps_m * x))) / 2.0d0
else if (x <= 1.15d+228) then
tmp = 0.0d0
else if (x <= 2d+296) then
tmp = (2.0d0 + (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 <= -6200.0) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 3.7e+148) {
tmp = (1.0 + Math.exp((eps_m * x))) / 2.0;
} else if (x <= 1.15e+228) {
tmp = 0.0;
} else if (x <= 2e+296) {
tmp = (2.0 + (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 <= -6200.0: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 3.7e+148: tmp = (1.0 + math.exp((eps_m * x))) / 2.0 elif x <= 1.15e+228: tmp = 0.0 elif x <= 2e+296: tmp = (2.0 + (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 <= -6200.0) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 3.7e+148) tmp = Float64(Float64(1.0 + exp(Float64(eps_m * x))) / 2.0); elseif (x <= 1.15e+228) tmp = 0.0; elseif (x <= 2e+296) tmp = Float64(Float64(2.0 + 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 <= -6200.0) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= 3.7e+148) tmp = (1.0 + exp((eps_m * x))) / 2.0; elseif (x <= 1.15e+228) tmp = 0.0; elseif (x <= 2e+296) tmp = (2.0 + (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, -6200.0], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 3.7e+148], N[(N[(1.0 + N[Exp[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.15e+228], 0.0, If[LessEqual[x, 2e+296], N[(N[(2.0 + N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6200:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 3.7 \cdot 10^{+148}:\\
\;\;\;\;\frac{1 + e^{eps\_m \cdot x}}{2}\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{+228}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+296}:\\
\;\;\;\;\frac{2 + eps\_m \cdot x}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -6200Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 63.0%
Taylor expanded in eps around inf 63.0%
neg-mul-163.0%
distribute-rgt-neg-in63.0%
Simplified63.0%
Taylor expanded in eps around 0 100.0%
neg-mul-1100.0%
Simplified100.0%
if -6200 < x < 3.7000000000000002e148Initial program 63.3%
Simplified63.3%
Taylor expanded in x around 0 39.6%
Taylor expanded in eps around inf 74.2%
neg-mul-174.2%
distribute-rgt-neg-in74.2%
Simplified74.2%
Taylor expanded in eps around inf 75.3%
*-commutative75.3%
Simplified75.3%
if 3.7000000000000002e148 < x < 1.15000000000000006e228 or 1.99999999999999996e296 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 79.5%
mul-1-neg79.5%
mul-1-neg79.5%
rec-exp79.5%
sub-neg79.5%
div-sub79.5%
rec-exp79.5%
mul-1-neg79.5%
+-inverses79.5%
Simplified79.5%
if 1.15000000000000006e228 < x < 1.99999999999999996e296Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 25.4%
Taylor expanded in eps around inf 25.5%
neg-mul-125.5%
distribute-rgt-neg-in25.5%
Simplified25.5%
Taylor expanded in eps around inf 25.2%
*-commutative25.2%
Simplified25.2%
Taylor expanded in x around 0 23.5%
Final simplification76.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 650.0)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (<= x 1e+148)
(/ (/ (expm1 x) eps_m) 2.0)
(if (<= x 8.2e+227)
0.0
(if (<= x 3e+296) (/ (+ 2.0 (* eps_m x)) 2.0) 0.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 650.0) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 1e+148) {
tmp = (expm1(x) / eps_m) / 2.0;
} else if (x <= 8.2e+227) {
tmp = 0.0;
} else if (x <= 3e+296) {
tmp = (2.0 + (eps_m * x)) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 650.0) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 1e+148) {
tmp = (Math.expm1(x) / eps_m) / 2.0;
} else if (x <= 8.2e+227) {
tmp = 0.0;
} else if (x <= 3e+296) {
tmp = (2.0 + (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 <= 650.0: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 1e+148: tmp = (math.expm1(x) / eps_m) / 2.0 elif x <= 8.2e+227: tmp = 0.0 elif x <= 3e+296: tmp = (2.0 + (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 <= 650.0) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 1e+148) tmp = Float64(Float64(expm1(x) / eps_m) / 2.0); elseif (x <= 8.2e+227) tmp = 0.0; elseif (x <= 3e+296) tmp = Float64(Float64(2.0 + Float64(eps_m * x)) / 2.0); else tmp = 0.0; end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 650.0], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1e+148], N[(N[(N[(Exp[x] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 8.2e+227], 0.0, If[LessEqual[x, 3e+296], N[(N[(2.0 + N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 650:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 10^{+148}:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(x\right)}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{+227}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 3 \cdot 10^{+296}:\\
\;\;\;\;\frac{2 + eps\_m \cdot x}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 650Initial program 62.5%
Simplified62.5%
Taylor expanded in x around 0 44.2%
Taylor expanded in eps around inf 79.5%
neg-mul-179.5%
distribute-rgt-neg-in79.5%
Simplified79.5%
Taylor expanded in eps around 0 76.5%
neg-mul-176.5%
Simplified76.5%
if 650 < x < 1e148Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 38.5%
Taylor expanded in eps around 0 1.9%
expm1-define1.9%
neg-mul-11.9%
Simplified1.9%
expm1-undefine1.9%
div-sub1.9%
add-sqr-sqrt0.0%
sqrt-unprod37.5%
sqr-neg37.5%
sqrt-unprod37.5%
add-sqr-sqrt37.5%
Applied egg-rr37.5%
div-sub37.5%
expm1-undefine37.5%
Simplified37.5%
if 1e148 < x < 8.19999999999999992e227 or 3.00000000000000013e296 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 79.5%
mul-1-neg79.5%
mul-1-neg79.5%
rec-exp79.5%
sub-neg79.5%
div-sub79.5%
rec-exp79.5%
mul-1-neg79.5%
+-inverses79.5%
Simplified79.5%
if 8.19999999999999992e227 < x < 3.00000000000000013e296Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 25.4%
Taylor expanded in eps around inf 25.5%
neg-mul-125.5%
distribute-rgt-neg-in25.5%
Simplified25.5%
Taylor expanded in eps around inf 25.2%
*-commutative25.2%
Simplified25.2%
Taylor expanded in x around 0 23.5%
Final simplification68.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -7e-5)
(/ (+ 2.0 (/ (- (* eps_m (- (* 2.0 x) (* eps_m x))) x) eps_m)) 2.0)
(if (<= x 2.7e+14)
1.0
(if (<= x 4.4e+226)
0.0
(if (<= x 2e+296) (/ (+ 2.0 (* eps_m x)) 2.0) 0.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -7e-5) {
tmp = (2.0 + (((eps_m * ((2.0 * x) - (eps_m * x))) - x) / eps_m)) / 2.0;
} else if (x <= 2.7e+14) {
tmp = 1.0;
} else if (x <= 4.4e+226) {
tmp = 0.0;
} else if (x <= 2e+296) {
tmp = (2.0 + (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 <= (-7d-5)) then
tmp = (2.0d0 + (((eps_m * ((2.0d0 * x) - (eps_m * x))) - x) / eps_m)) / 2.0d0
else if (x <= 2.7d+14) then
tmp = 1.0d0
else if (x <= 4.4d+226) then
tmp = 0.0d0
else if (x <= 2d+296) then
tmp = (2.0d0 + (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 <= -7e-5) {
tmp = (2.0 + (((eps_m * ((2.0 * x) - (eps_m * x))) - x) / eps_m)) / 2.0;
} else if (x <= 2.7e+14) {
tmp = 1.0;
} else if (x <= 4.4e+226) {
tmp = 0.0;
} else if (x <= 2e+296) {
tmp = (2.0 + (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 <= -7e-5: tmp = (2.0 + (((eps_m * ((2.0 * x) - (eps_m * x))) - x) / eps_m)) / 2.0 elif x <= 2.7e+14: tmp = 1.0 elif x <= 4.4e+226: tmp = 0.0 elif x <= 2e+296: tmp = (2.0 + (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 <= -7e-5) tmp = Float64(Float64(2.0 + Float64(Float64(Float64(eps_m * Float64(Float64(2.0 * x) - Float64(eps_m * x))) - x) / eps_m)) / 2.0); elseif (x <= 2.7e+14) tmp = 1.0; elseif (x <= 4.4e+226) tmp = 0.0; elseif (x <= 2e+296) tmp = Float64(Float64(2.0 + 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 <= -7e-5) tmp = (2.0 + (((eps_m * ((2.0 * x) - (eps_m * x))) - x) / eps_m)) / 2.0; elseif (x <= 2.7e+14) tmp = 1.0; elseif (x <= 4.4e+226) tmp = 0.0; elseif (x <= 2e+296) tmp = (2.0 + (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, -7e-5], N[(N[(2.0 + N[(N[(N[(eps$95$m * N[(N[(2.0 * x), $MachinePrecision] - N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.7e+14], 1.0, If[LessEqual[x, 4.4e+226], 0.0, If[LessEqual[x, 2e+296], N[(N[(2.0 + N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{-5}:\\
\;\;\;\;\frac{2 + \frac{eps\_m \cdot \left(2 \cdot x - eps\_m \cdot x\right) - x}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{+14}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 4.4 \cdot 10^{+226}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+296}:\\
\;\;\;\;\frac{2 + eps\_m \cdot x}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -6.9999999999999994e-5Initial program 97.3%
Simplified97.3%
Taylor expanded in x around 0 66.0%
Taylor expanded in x around 0 24.5%
*-commutative24.5%
associate-*r*24.5%
associate-*r*24.5%
associate-*l*24.5%
distribute-lft-in24.5%
metadata-eval24.5%
associate-*r/24.5%
metadata-eval24.5%
*-commutative24.5%
Simplified24.5%
*-commutative24.5%
distribute-lft-in2.9%
add-sqr-sqrt2.9%
sqrt-unprod31.7%
sqr-neg31.7%
sqrt-unprod1.5%
add-sqr-sqrt1.6%
neg-sub01.6%
associate--r-1.6%
metadata-eval1.6%
add-sqr-sqrt0.2%
sqrt-unprod22.6%
sqr-neg22.6%
sqrt-unprod15.0%
add-sqr-sqrt15.1%
neg-sub015.1%
associate--r-15.1%
metadata-eval15.1%
add-sqr-sqrt0.1%
Applied egg-rr1.6%
distribute-lft-out15.2%
*-commutative15.2%
associate-*l*15.2%
+-commutative15.2%
+-commutative15.2%
distribute-rgt-in15.2%
associate-*l/15.2%
*-lft-identity15.2%
neg-mul-115.2%
unsub-neg15.2%
Simplified15.2%
Taylor expanded in eps around 0 27.5%
if -6.9999999999999994e-5 < x < 2.7e14Initial program 53.9%
Simplified53.9%
Taylor expanded in x around 0 73.5%
if 2.7e14 < x < 4.39999999999999988e226 or 1.99999999999999996e296 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 56.4%
mul-1-neg56.4%
mul-1-neg56.4%
rec-exp56.4%
sub-neg56.4%
div-sub56.4%
rec-exp56.4%
mul-1-neg56.4%
+-inverses56.4%
Simplified56.4%
if 4.39999999999999988e226 < x < 1.99999999999999996e296Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 25.4%
Taylor expanded in eps around inf 25.5%
neg-mul-125.5%
distribute-rgt-neg-in25.5%
Simplified25.5%
Taylor expanded in eps around inf 25.2%
*-commutative25.2%
Simplified25.2%
Taylor expanded in x around 0 23.5%
Final simplification60.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 2.7e+14)
1.0
(if (<= x 4.5e+225)
0.0
(if (<= x 1.9e+296) (/ (+ 2.0 (* eps_m x)) 2.0) 0.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 2.7e+14) {
tmp = 1.0;
} else if (x <= 4.5e+225) {
tmp = 0.0;
} else if (x <= 1.9e+296) {
tmp = (2.0 + (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 <= 2.7d+14) then
tmp = 1.0d0
else if (x <= 4.5d+225) then
tmp = 0.0d0
else if (x <= 1.9d+296) then
tmp = (2.0d0 + (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 <= 2.7e+14) {
tmp = 1.0;
} else if (x <= 4.5e+225) {
tmp = 0.0;
} else if (x <= 1.9e+296) {
tmp = (2.0 + (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 <= 2.7e+14: tmp = 1.0 elif x <= 4.5e+225: tmp = 0.0 elif x <= 1.9e+296: tmp = (2.0 + (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 <= 2.7e+14) tmp = 1.0; elseif (x <= 4.5e+225) tmp = 0.0; elseif (x <= 1.9e+296) tmp = Float64(Float64(2.0 + 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 <= 2.7e+14) tmp = 1.0; elseif (x <= 4.5e+225) tmp = 0.0; elseif (x <= 1.9e+296) tmp = (2.0 + (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, 2.7e+14], 1.0, If[LessEqual[x, 4.5e+225], 0.0, If[LessEqual[x, 1.9e+296], N[(N[(2.0 + N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.7 \cdot 10^{+14}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{+225}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{+296}:\\
\;\;\;\;\frac{2 + eps\_m \cdot x}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2.7e14Initial program 62.7%
Simplified62.7%
Taylor expanded in x around 0 59.2%
if 2.7e14 < x < 4.49999999999999976e225 or 1.89999999999999987e296 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 56.4%
mul-1-neg56.4%
mul-1-neg56.4%
rec-exp56.4%
sub-neg56.4%
div-sub56.4%
rec-exp56.4%
mul-1-neg56.4%
+-inverses56.4%
Simplified56.4%
if 4.49999999999999976e225 < x < 1.89999999999999987e296Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 25.4%
Taylor expanded in eps around inf 25.5%
neg-mul-125.5%
distribute-rgt-neg-in25.5%
Simplified25.5%
Taylor expanded in eps around inf 25.2%
*-commutative25.2%
Simplified25.2%
Taylor expanded in x around 0 23.5%
Final simplification56.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 165.0)
(/ (- 2.0 (* eps_m x)) 2.0)
(if (<= x 1.18e+228)
0.0
(if (<= x 2.95e+296) (/ (+ 2.0 (* eps_m x)) 2.0) 0.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 165.0) {
tmp = (2.0 - (eps_m * x)) / 2.0;
} else if (x <= 1.18e+228) {
tmp = 0.0;
} else if (x <= 2.95e+296) {
tmp = (2.0 + (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 <= 165.0d0) then
tmp = (2.0d0 - (eps_m * x)) / 2.0d0
else if (x <= 1.18d+228) then
tmp = 0.0d0
else if (x <= 2.95d+296) then
tmp = (2.0d0 + (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 <= 165.0) {
tmp = (2.0 - (eps_m * x)) / 2.0;
} else if (x <= 1.18e+228) {
tmp = 0.0;
} else if (x <= 2.95e+296) {
tmp = (2.0 + (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 <= 165.0: tmp = (2.0 - (eps_m * x)) / 2.0 elif x <= 1.18e+228: tmp = 0.0 elif x <= 2.95e+296: tmp = (2.0 + (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 <= 165.0) tmp = Float64(Float64(2.0 - Float64(eps_m * x)) / 2.0); elseif (x <= 1.18e+228) tmp = 0.0; elseif (x <= 2.95e+296) tmp = Float64(Float64(2.0 + 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 <= 165.0) tmp = (2.0 - (eps_m * x)) / 2.0; elseif (x <= 1.18e+228) tmp = 0.0; elseif (x <= 2.95e+296) tmp = (2.0 + (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, 165.0], N[(N[(2.0 - N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.18e+228], 0.0, If[LessEqual[x, 2.95e+296], N[(N[(2.0 + N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 165:\\
\;\;\;\;\frac{2 - eps\_m \cdot x}{2}\\
\mathbf{elif}\;x \leq 1.18 \cdot 10^{+228}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 2.95 \cdot 10^{+296}:\\
\;\;\;\;\frac{2 + eps\_m \cdot x}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 165Initial program 62.1%
Simplified62.1%
Taylor expanded in x around 0 44.1%
Taylor expanded in x around 0 44.9%
*-commutative44.9%
associate-*r*44.9%
associate-*r*44.9%
associate-*l*44.9%
distribute-lft-in44.9%
metadata-eval44.9%
associate-*r/44.9%
metadata-eval44.9%
*-commutative44.9%
Simplified44.9%
*-commutative44.9%
distribute-lft-in40.4%
add-sqr-sqrt30.6%
sqrt-unprod49.1%
sqr-neg49.1%
sqrt-unprod10.1%
add-sqr-sqrt40.2%
neg-sub040.2%
associate--r-40.2%
metadata-eval40.2%
add-sqr-sqrt30.1%
sqrt-unprod48.4%
sqr-neg48.4%
sqrt-unprod12.9%
add-sqr-sqrt43.1%
neg-sub043.1%
associate--r-43.1%
metadata-eval43.1%
add-sqr-sqrt17.6%
Applied egg-rr40.2%
distribute-lft-out43.0%
*-commutative43.0%
associate-*l*43.0%
+-commutative43.0%
+-commutative43.0%
distribute-rgt-in43.0%
associate-*l/43.0%
*-lft-identity43.0%
neg-mul-143.0%
unsub-neg43.0%
Simplified43.0%
Taylor expanded in eps around inf 62.2%
mul-1-neg62.2%
distribute-rgt-neg-in62.2%
Simplified62.2%
if 165 < x < 1.18e228 or 2.95000000000000008e296 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 53.9%
mul-1-neg53.9%
mul-1-neg53.9%
rec-exp53.9%
sub-neg53.9%
div-sub53.9%
rec-exp53.9%
mul-1-neg53.9%
+-inverses53.9%
Simplified53.9%
if 1.18e228 < x < 2.95000000000000008e296Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 25.4%
Taylor expanded in eps around inf 25.5%
neg-mul-125.5%
distribute-rgt-neg-in25.5%
Simplified25.5%
Taylor expanded in eps around inf 25.2%
*-commutative25.2%
Simplified25.2%
Taylor expanded in x around 0 23.5%
Final simplification58.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 2.5)
(/ (+ 2.0 (* x (+ -1.0 (* x (+ 0.5 (* x -0.16666666666666666)))))) 2.0)
(if (<= x 4.4e+225)
0.0
(if (<= x 3e+296) (/ (+ 2.0 (* eps_m x)) 2.0) 0.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 2.5) {
tmp = (2.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) / 2.0;
} else if (x <= 4.4e+225) {
tmp = 0.0;
} else if (x <= 3e+296) {
tmp = (2.0 + (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 <= 2.5d0) then
tmp = (2.0d0 + (x * ((-1.0d0) + (x * (0.5d0 + (x * (-0.16666666666666666d0))))))) / 2.0d0
else if (x <= 4.4d+225) then
tmp = 0.0d0
else if (x <= 3d+296) then
tmp = (2.0d0 + (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 <= 2.5) {
tmp = (2.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) / 2.0;
} else if (x <= 4.4e+225) {
tmp = 0.0;
} else if (x <= 3e+296) {
tmp = (2.0 + (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 <= 2.5: tmp = (2.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) / 2.0 elif x <= 4.4e+225: tmp = 0.0 elif x <= 3e+296: tmp = (2.0 + (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 <= 2.5) tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(x * Float64(0.5 + Float64(x * -0.16666666666666666)))))) / 2.0); elseif (x <= 4.4e+225) tmp = 0.0; elseif (x <= 3e+296) tmp = Float64(Float64(2.0 + 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 <= 2.5) tmp = (2.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) / 2.0; elseif (x <= 4.4e+225) tmp = 0.0; elseif (x <= 3e+296) tmp = (2.0 + (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, 2.5], N[(N[(2.0 + N[(x * N[(-1.0 + N[(x * N[(0.5 + N[(x * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 4.4e+225], 0.0, If[LessEqual[x, 3e+296], N[(N[(2.0 + N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.5:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + x \cdot \left(0.5 + x \cdot -0.16666666666666666\right)\right)}{2}\\
\mathbf{elif}\;x \leq 4.4 \cdot 10^{+225}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 3 \cdot 10^{+296}:\\
\;\;\;\;\frac{2 + eps\_m \cdot x}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2.5Initial program 62.4%
Simplified62.4%
Taylor expanded in x around 0 44.4%
Taylor expanded in eps around 0 41.9%
neg-mul-141.9%
Simplified41.9%
Taylor expanded in x around 0 51.1%
Taylor expanded in eps around inf 69.2%
if 2.5 < x < 4.40000000000000028e225 or 3.00000000000000013e296 < x Initial program 98.5%
Simplified98.5%
Taylor expanded in eps around 0 53.1%
mul-1-neg53.1%
mul-1-neg53.1%
rec-exp53.1%
sub-neg53.1%
div-sub53.1%
rec-exp53.1%
mul-1-neg53.1%
+-inverses53.1%
Simplified53.1%
if 4.40000000000000028e225 < x < 3.00000000000000013e296Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 25.4%
Taylor expanded in eps around inf 25.5%
neg-mul-125.5%
distribute-rgt-neg-in25.5%
Simplified25.5%
Taylor expanded in eps around inf 25.2%
*-commutative25.2%
Simplified25.2%
Taylor expanded in x around 0 23.5%
Final simplification62.8%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 2.7e+14) 1.0 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 2.7e+14) {
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 <= 2.7d+14) 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 <= 2.7e+14) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 2.7e+14: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 2.7e+14) 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 <= 2.7e+14) 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, 2.7e+14], 1.0, 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.7 \cdot 10^{+14}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2.7e14Initial program 62.7%
Simplified62.7%
Taylor expanded in x around 0 59.2%
if 2.7e14 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 50.8%
mul-1-neg50.8%
mul-1-neg50.8%
rec-exp50.8%
sub-neg50.8%
div-sub50.8%
rec-exp50.8%
mul-1-neg50.8%
+-inverses50.8%
Simplified50.8%
Final simplification56.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 73.5%
Simplified62.1%
Taylor expanded in eps around 0 16.2%
mul-1-neg16.2%
mul-1-neg16.2%
rec-exp16.3%
sub-neg16.3%
div-sub16.3%
rec-exp16.2%
mul-1-neg16.2%
+-inverses16.4%
Simplified16.4%
Final simplification16.4%
herbie shell --seed 2024050
(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))