
(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 12 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 1.15e-52) (/ (/ (* eps_m (* (exp (- x)) (+ 2.0 (* x 2.0)))) eps_m) 2.0) (/ (+ (exp (* x (- eps_m))) (exp (* x (+ eps_m -1.0)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 1.15e-52) {
tmp = ((eps_m * (exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 2.0;
} else {
tmp = (exp((x * -eps_m)) + 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 (eps_m <= 1.15d-52) then
tmp = ((eps_m * (exp(-x) * (2.0d0 + (x * 2.0d0)))) / eps_m) / 2.0d0
else
tmp = (exp((x * -eps_m)) + exp((x * (eps_m + (-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 (eps_m <= 1.15e-52) {
tmp = ((eps_m * (Math.exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 2.0;
} else {
tmp = (Math.exp((x * -eps_m)) + Math.exp((x * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 1.15e-52: tmp = ((eps_m * (math.exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 2.0 else: tmp = (math.exp((x * -eps_m)) + math.exp((x * (eps_m + -1.0)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 1.15e-52) tmp = Float64(Float64(Float64(eps_m * Float64(exp(Float64(-x)) * Float64(2.0 + Float64(x * 2.0)))) / eps_m) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(-eps_m))) + 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 (eps_m <= 1.15e-52) tmp = ((eps_m * (exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 2.0; else tmp = (exp((x * -eps_m)) + 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[eps$95$m, 1.15e-52], N[(N[(N[(eps$95$m * N[(N[Exp[(-x)], $MachinePrecision] * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * 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}\;eps\_m \leq 1.15 \cdot 10^{-52}:\\
\;\;\;\;\frac{\frac{eps\_m \cdot \left(e^{-x} \cdot \left(2 + x \cdot 2\right)\right)}{eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(-eps\_m\right)} + e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\end{array}
\end{array}
if eps < 1.14999999999999997e-52Initial program 64.1%
Simplified58.2%
Taylor expanded in eps around 0 29.4%
associate-+r+65.9%
distribute-rgt1-in65.9%
metadata-eval65.9%
mul0-lft65.9%
associate-*r*65.9%
distribute-rgt-out65.9%
mul-1-neg65.9%
Simplified65.9%
if 1.14999999999999997e-52 < eps Initial program 97.1%
Simplified81.2%
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%
*-commutative100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Final simplification74.8%
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 72.8%
Simplified65.0%
Taylor expanded in eps around inf 99.1%
Final simplification99.1%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -4e-239)
(/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) 2.0)
(if (or (<= x 2600000000000.0) (not (<= x 9.2e+180)))
(/ (+ 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 <= -4e-239) {
tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0;
} else if ((x <= 2600000000000.0) || !(x <= 9.2e+180)) {
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 <= (-4d-239)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
else if ((x <= 2600000000000.0d0) .or. (.not. (x <= 9.2d+180))) 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 <= -4e-239) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
} else if ((x <= 2600000000000.0) || !(x <= 9.2e+180)) {
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 <= -4e-239: tmp = (1.0 + math.exp((x * (-1.0 - eps_m)))) / 2.0 elif (x <= 2600000000000.0) or not (x <= 9.2e+180): 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 <= -4e-239) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); elseif ((x <= 2600000000000.0) || !(x <= 9.2e+180)) 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 <= -4e-239) tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0; elseif ((x <= 2600000000000.0) || ~((x <= 9.2e+180))) 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, -4e-239], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 2600000000000.0], N[Not[LessEqual[x, 9.2e+180]], $MachinePrecision]], 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 -4 \cdot 10^{-239}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\mathbf{elif}\;x \leq 2600000000000 \lor \neg \left(x \leq 9.2 \cdot 10^{+180}\right):\\
\;\;\;\;\frac{1 + e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -4.0000000000000003e-239Initial program 66.4%
Simplified66.4%
Taylor expanded in x around 0 30.0%
Taylor expanded in eps around inf 62.9%
Taylor expanded in eps around -inf 62.9%
sub-neg62.9%
mul-1-neg62.9%
remove-double-neg62.9%
mul-1-neg62.9%
distribute-rgt-neg-in62.9%
sub-neg62.9%
neg-mul-162.9%
remove-double-neg62.9%
distribute-neg-in62.9%
metadata-eval62.9%
unsub-neg62.9%
Simplified62.9%
if -4.0000000000000003e-239 < x < 2.6e12 or 9.1999999999999995e180 < x Initial program 70.3%
Simplified61.1%
Taylor expanded in eps around inf 98.9%
Taylor expanded in x around 0 67.0%
if 2.6e12 < x < 9.1999999999999995e180Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 65.3%
mul-1-neg65.3%
mul-1-neg65.3%
rec-exp65.3%
sub-neg65.3%
div-sub65.3%
mul-1-neg65.3%
rec-exp65.3%
+-inverses65.3%
Simplified65.3%
Final simplification65.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 4.9e-12) (/ (/ (* eps_m (* (exp (- x)) (+ 2.0 (* x 2.0)))) eps_m) 2.0) (/ (* eps_m (- (/ (- 1.0 (- x (exp (* x (+ eps_m -1.0))))) eps_m) x)) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 4.9e-12) {
tmp = ((eps_m * (exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 2.0;
} else {
tmp = (eps_m * (((1.0 - (x - exp((x * (eps_m + -1.0))))) / 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 <= 4.9d-12) then
tmp = ((eps_m * (exp(-x) * (2.0d0 + (x * 2.0d0)))) / eps_m) / 2.0d0
else
tmp = (eps_m * (((1.0d0 - (x - exp((x * (eps_m + (-1.0d0)))))) / 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 <= 4.9e-12) {
tmp = ((eps_m * (Math.exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 2.0;
} else {
tmp = (eps_m * (((1.0 - (x - Math.exp((x * (eps_m + -1.0))))) / eps_m) - x)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 4.9e-12: tmp = ((eps_m * (math.exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 2.0 else: tmp = (eps_m * (((1.0 - (x - math.exp((x * (eps_m + -1.0))))) / eps_m) - x)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 4.9e-12) tmp = Float64(Float64(Float64(eps_m * Float64(exp(Float64(-x)) * Float64(2.0 + Float64(x * 2.0)))) / eps_m) / 2.0); else tmp = Float64(Float64(eps_m * Float64(Float64(Float64(1.0 - Float64(x - exp(Float64(x * Float64(eps_m + -1.0))))) / 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 <= 4.9e-12) tmp = ((eps_m * (exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 2.0; else tmp = (eps_m * (((1.0 - (x - exp((x * (eps_m + -1.0))))) / 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, 4.9e-12], N[(N[(N[(eps$95$m * N[(N[Exp[(-x)], $MachinePrecision] * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(eps$95$m * N[(N[(N[(1.0 - N[(x - N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 4.9 \cdot 10^{-12}:\\
\;\;\;\;\frac{\frac{eps\_m \cdot \left(e^{-x} \cdot \left(2 + x \cdot 2\right)\right)}{eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{eps\_m \cdot \left(\frac{1 - \left(x - e^{x \cdot \left(eps\_m + -1\right)}\right)}{eps\_m} - x\right)}{2}\\
\end{array}
\end{array}
if eps < 4.89999999999999972e-12Initial program 63.9%
Simplified58.1%
Taylor expanded in eps around 0 29.8%
associate-+r+66.6%
distribute-rgt1-in66.6%
metadata-eval66.6%
mul0-lft66.6%
associate-*r*66.6%
distribute-rgt-out66.6%
mul-1-neg66.6%
Simplified66.6%
if 4.89999999999999972e-12 < eps Initial program 100.0%
Simplified83.1%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 64.4%
Taylor expanded in eps around -inf 81.8%
associate-*r*81.8%
neg-mul-181.8%
mul-1-neg81.8%
associate-*r*81.8%
neg-mul-181.8%
neg-mul-181.8%
neg-mul-181.8%
Simplified81.8%
Final simplification70.3%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 210000.0) (/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) 2.0) (if (<= x 8.2e+180) 0.0 (/ (+ 2.0 (* x (+ -1.0 (* x 0.5)))) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 210000.0) {
tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 8.2e+180) {
tmp = 0.0;
} else {
tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 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 <= 210000.0d0) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
else if (x <= 8.2d+180) then
tmp = 0.0d0
else
tmp = (2.0d0 + (x * ((-1.0d0) + (x * 0.5d0)))) / 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 <= 210000.0) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 8.2e+180) {
tmp = 0.0;
} else {
tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 210000.0: tmp = (1.0 + math.exp((x * (-1.0 - eps_m)))) / 2.0 elif x <= 8.2e+180: tmp = 0.0 else: tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 210000.0) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); elseif (x <= 8.2e+180) tmp = 0.0; else tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(x * 0.5)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 210000.0) tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0; elseif (x <= 8.2e+180) tmp = 0.0; else tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 210000.0], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 8.2e+180], 0.0, N[(N[(2.0 + N[(x * N[(-1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 210000:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{+180}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + x \cdot 0.5\right)}{2}\\
\end{array}
\end{array}
if x < 2.1e5Initial program 60.8%
Simplified60.8%
Taylor expanded in x around 0 33.8%
Taylor expanded in eps around inf 71.8%
Taylor expanded in eps around -inf 71.8%
sub-neg71.8%
mul-1-neg71.8%
remove-double-neg71.8%
mul-1-neg71.8%
distribute-rgt-neg-in71.8%
sub-neg71.8%
neg-mul-171.8%
remove-double-neg71.8%
distribute-neg-in71.8%
metadata-eval71.8%
unsub-neg71.8%
Simplified71.8%
if 2.1e5 < x < 8.2e180Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 62.8%
mul-1-neg62.8%
mul-1-neg62.8%
rec-exp62.8%
sub-neg62.8%
div-sub62.8%
mul-1-neg62.8%
rec-exp62.8%
+-inverses62.8%
Simplified62.8%
if 8.2e180 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 76.1%
*-commutative76.1%
Simplified76.1%
Taylor expanded in eps around 0 3.1%
neg-mul-13.1%
Simplified3.1%
Taylor expanded in x around 0 56.8%
Final simplification68.1%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 210000.0) (/ (+ 1.0 (exp (- x))) 2.0) (if (<= x 9.2e+180) 0.0 (/ (+ 2.0 (* x (+ -1.0 (* x 0.5)))) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 210000.0) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 9.2e+180) {
tmp = 0.0;
} else {
tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 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 <= 210000.0d0) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= 9.2d+180) then
tmp = 0.0d0
else
tmp = (2.0d0 + (x * ((-1.0d0) + (x * 0.5d0)))) / 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 <= 210000.0) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 9.2e+180) {
tmp = 0.0;
} else {
tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 210000.0: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 9.2e+180: tmp = 0.0 else: tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 210000.0) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 9.2e+180) tmp = 0.0; else tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(x * 0.5)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 210000.0) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= 9.2e+180) tmp = 0.0; else tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 210000.0], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 9.2e+180], 0.0, N[(N[(2.0 + N[(x * N[(-1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 210000:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 9.2 \cdot 10^{+180}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + x \cdot 0.5\right)}{2}\\
\end{array}
\end{array}
if x < 2.1e5Initial program 60.8%
Simplified49.6%
Taylor expanded in eps around inf 98.8%
Taylor expanded in eps around inf 98.8%
*-commutative98.8%
Simplified98.8%
Taylor expanded in eps around 0 77.9%
neg-mul-177.9%
Simplified77.9%
if 2.1e5 < x < 9.1999999999999995e180Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 62.8%
mul-1-neg62.8%
mul-1-neg62.8%
rec-exp62.8%
sub-neg62.8%
div-sub62.8%
mul-1-neg62.8%
rec-exp62.8%
+-inverses62.8%
Simplified62.8%
if 9.1999999999999995e180 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 76.1%
*-commutative76.1%
Simplified76.1%
Taylor expanded in eps around 0 3.1%
neg-mul-13.1%
Simplified3.1%
Taylor expanded in x around 0 56.8%
Final simplification72.3%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (or (<= x 210000.0) (not (<= x 8.8e+180))) (/ (+ 2.0 (* x (+ -1.0 (* x 0.5)))) 2.0) 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if ((x <= 210000.0) || !(x <= 8.8e+180)) {
tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 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 <= 210000.0d0) .or. (.not. (x <= 8.8d+180))) then
tmp = (2.0d0 + (x * ((-1.0d0) + (x * 0.5d0)))) / 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 <= 210000.0) || !(x <= 8.8e+180)) {
tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if (x <= 210000.0) or not (x <= 8.8e+180): tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if ((x <= 210000.0) || !(x <= 8.8e+180)) tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(x * 0.5)))) / 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 <= 210000.0) || ~((x <= 8.8e+180))) tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[Or[LessEqual[x, 210000.0], N[Not[LessEqual[x, 8.8e+180]], $MachinePrecision]], N[(N[(2.0 + N[(x * N[(-1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 210000 \lor \neg \left(x \leq 8.8 \cdot 10^{+180}\right):\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + x \cdot 0.5\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2.1e5 or 8.7999999999999997e180 < x Initial program 68.2%
Simplified59.1%
Taylor expanded in eps around inf 99.0%
Taylor expanded in eps around inf 94.5%
*-commutative94.5%
Simplified94.5%
Taylor expanded in eps around 0 63.9%
neg-mul-163.9%
Simplified63.9%
Taylor expanded in x around 0 65.7%
if 2.1e5 < x < 8.7999999999999997e180Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 62.8%
mul-1-neg62.8%
mul-1-neg62.8%
rec-exp62.8%
sub-neg62.8%
div-sub62.8%
mul-1-neg62.8%
rec-exp62.8%
+-inverses62.8%
Simplified62.8%
Final simplification65.3%
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 9.2e+180) 0.0 (/ (+ 2.0 (* x (+ -1.0 (* x 0.5)))) 2.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 <= 9.2e+180) {
tmp = 0.0;
} else {
tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 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 <= 2.5d0) then
tmp = (2.0d0 + (x * ((-1.0d0) + (x * (0.5d0 + (x * (-0.16666666666666666d0))))))) / 2.0d0
else if (x <= 9.2d+180) then
tmp = 0.0d0
else
tmp = (2.0d0 + (x * ((-1.0d0) + (x * 0.5d0)))) / 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 <= 2.5) {
tmp = (2.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) / 2.0;
} else if (x <= 9.2e+180) {
tmp = 0.0;
} else {
tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.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 <= 9.2e+180: tmp = 0.0 else: tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.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 <= 9.2e+180) tmp = 0.0; else tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(x * 0.5)))) / 2.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 <= 9.2e+180) tmp = 0.0; else tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.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, 9.2e+180], 0.0, N[(N[(2.0 + N[(x * N[(-1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\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 9.2 \cdot 10^{+180}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + x \cdot 0.5\right)}{2}\\
\end{array}
\end{array}
if x < 2.5Initial program 60.9%
Simplified49.6%
Taylor expanded in eps around inf 99.2%
Taylor expanded in eps around inf 99.2%
*-commutative99.2%
Simplified99.2%
Taylor expanded in eps around 0 78.7%
neg-mul-178.7%
Simplified78.7%
Taylor expanded in x around 0 71.6%
if 2.5 < x < 9.1999999999999995e180Initial program 97.5%
Simplified97.5%
Taylor expanded in eps around 0 59.7%
mul-1-neg59.7%
mul-1-neg59.7%
rec-exp59.6%
sub-neg59.6%
div-sub59.6%
mul-1-neg59.6%
rec-exp59.7%
+-inverses59.7%
Simplified59.7%
if 9.1999999999999995e180 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 76.1%
*-commutative76.1%
Simplified76.1%
Taylor expanded in eps around 0 3.1%
neg-mul-13.1%
Simplified3.1%
Taylor expanded in x around 0 56.8%
Final simplification67.4%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.0) (/ (* x eps_m) (- 2.0)) (if (<= x 210000.0) 1.0 0.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.0) {
tmp = (x * eps_m) / -2.0;
} else if (x <= 210000.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-1.0d0)) then
tmp = (x * eps_m) / -2.0d0
else if (x <= 210000.0d0) then
tmp = 1.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1.0) {
tmp = (x * eps_m) / -2.0;
} else if (x <= 210000.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.0: tmp = (x * eps_m) / -2.0 elif x <= 210000.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.0) tmp = Float64(Float64(x * eps_m) / Float64(-2.0)); elseif (x <= 210000.0) tmp = 1.0; else tmp = 0.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.0) tmp = (x * eps_m) / -2.0; elseif (x <= 210000.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.0], N[(N[(x * eps$95$m), $MachinePrecision] / (-2.0)), $MachinePrecision], If[LessEqual[x, 210000.0], 1.0, 0.0]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{x \cdot eps\_m}{-2}\\
\mathbf{elif}\;x \leq 210000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -1Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 48.5%
Taylor expanded in eps around inf 13.6%
mul-1-neg13.6%
*-commutative13.6%
distribute-rgt-neg-in13.6%
Simplified13.6%
if -1 < x < 2.1e5Initial program 49.5%
Simplified49.5%
Taylor expanded in x around 0 72.6%
if 2.1e5 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 53.3%
mul-1-neg53.3%
mul-1-neg53.3%
rec-exp53.3%
sub-neg53.3%
div-sub53.3%
mul-1-neg53.3%
rec-exp53.3%
+-inverses53.3%
Simplified53.3%
Final simplification57.5%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 2.0) (/ (- 2.0 x) 2.0) 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 2.0) {
tmp = (2.0 - 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.0d0) then
tmp = (2.0d0 - 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.0) {
tmp = (2.0 - x) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 2.0: tmp = (2.0 - x) / 2.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 2.0) tmp = Float64(Float64(2.0 - 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.0) tmp = (2.0 - 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.0], N[(N[(2.0 - x), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2:\\
\;\;\;\;\frac{2 - x}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2Initial program 60.9%
Simplified49.6%
Taylor expanded in eps around inf 99.2%
Taylor expanded in eps around inf 99.2%
*-commutative99.2%
Simplified99.2%
Taylor expanded in x around 0 57.7%
neg-mul-157.7%
unsub-neg57.7%
Simplified57.7%
if 2 < x Initial program 98.8%
Simplified98.8%
Taylor expanded in eps around 0 52.0%
mul-1-neg52.0%
mul-1-neg52.0%
rec-exp52.0%
sub-neg52.0%
div-sub52.0%
mul-1-neg52.0%
rec-exp52.0%
+-inverses52.0%
Simplified52.0%
Final simplification55.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 210000.0) 1.0 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 210000.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 210000.0d0) then
tmp = 1.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 210000.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 210000.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 210000.0) tmp = 1.0; else tmp = 0.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 210000.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 210000.0], 1.0, 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 210000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2.1e5Initial program 60.8%
Simplified60.8%
Taylor expanded in x around 0 57.0%
if 2.1e5 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 53.3%
mul-1-neg53.3%
mul-1-neg53.3%
rec-exp53.3%
sub-neg53.3%
div-sub53.3%
mul-1-neg53.3%
rec-exp53.3%
+-inverses53.3%
Simplified53.3%
Final simplification55.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 0.0)
eps_m = fabs(eps);
double code(double x, double eps_m) {
return 0.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = 0.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return 0.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return 0.0
eps_m = abs(eps) function code(x, eps_m) return 0.0 end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = 0.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := 0.0
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
0
\end{array}
Initial program 72.8%
Simplified63.4%
Taylor expanded in eps around 0 17.7%
mul-1-neg17.7%
mul-1-neg17.7%
rec-exp17.7%
sub-neg17.7%
div-sub17.7%
mul-1-neg17.7%
rec-exp17.7%
+-inverses18.0%
Simplified18.0%
Final simplification18.0%
herbie shell --seed 2024092
(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))