
(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 (<= x 2.5) (/ (+ (exp (* x eps_m)) (exp (* x (- eps_m)))) 2.0) (/ (+ (exp (* x (+ eps_m -1.0))) (exp (- x))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 2.5) {
tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0;
} else {
tmp = (exp((x * (eps_m + -1.0))) + exp(-x)) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 2.5d0) then
tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0d0
else
tmp = (exp((x * (eps_m + (-1.0d0)))) + exp(-x)) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 2.5) {
tmp = (Math.exp((x * eps_m)) + Math.exp((x * -eps_m))) / 2.0;
} else {
tmp = (Math.exp((x * (eps_m + -1.0))) + Math.exp(-x)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 2.5: tmp = (math.exp((x * eps_m)) + math.exp((x * -eps_m))) / 2.0 else: tmp = (math.exp((x * (eps_m + -1.0))) + math.exp(-x)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 2.5) tmp = Float64(Float64(exp(Float64(x * eps_m)) + exp(Float64(x * Float64(-eps_m)))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + exp(Float64(-x))) / 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 = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0; else tmp = (exp((x * (eps_m + -1.0))) + exp(-x)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 2.5], N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.5:\\
\;\;\;\;\frac{e^{x \cdot eps_m} + e^{x \cdot \left(-eps_m\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(eps_m + -1\right)} + e^{-x}}{2}\\
\end{array}
\end{array}
if x < 2.5Initial program 62.8%
fma-neg62.7%
/-rgt-identity62.7%
fma-neg62.8%
/-rgt-identity62.8%
distribute-rgt-neg-in62.8%
sub-neg62.8%
metadata-eval62.8%
distribute-rgt-neg-in62.8%
Simplified62.8%
Taylor expanded in eps around inf 98.8%
Simplified98.8%
Taylor expanded in eps around inf 98.8%
*-commutative98.8%
Simplified98.8%
Taylor expanded in eps around inf 99.5%
associate-*r*99.5%
neg-mul-199.5%
Simplified99.5%
if 2.5 < x Initial program 97.7%
fma-neg97.7%
/-rgt-identity97.7%
fma-neg97.7%
/-rgt-identity97.7%
distribute-rgt-neg-in97.7%
sub-neg97.7%
metadata-eval97.7%
distribute-rgt-neg-in97.7%
Simplified97.7%
Taylor expanded in eps around inf 98.0%
Simplified98.0%
Taylor expanded in eps around 0 72.2%
neg-mul-172.2%
Simplified72.2%
Final simplification90.6%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 3e-10) (/ (* 2.0 (exp (- x))) 2.0) (/ (+ (exp (* x eps_m)) (exp (* x (- eps_m)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 3e-10) {
tmp = (2.0 * exp(-x)) / 2.0;
} else {
tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (eps_m <= 3d-10) then
tmp = (2.0d0 * exp(-x)) / 2.0d0
else
tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (eps_m <= 3e-10) {
tmp = (2.0 * Math.exp(-x)) / 2.0;
} else {
tmp = (Math.exp((x * eps_m)) + Math.exp((x * -eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 3e-10: tmp = (2.0 * math.exp(-x)) / 2.0 else: tmp = (math.exp((x * eps_m)) + math.exp((x * -eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 3e-10) tmp = Float64(Float64(2.0 * exp(Float64(-x))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * eps_m)) + exp(Float64(x * Float64(-eps_m)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 3e-10) tmp = (2.0 * exp(-x)) / 2.0; else tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 3e-10], N[(N[(2.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps_m \leq 3 \cdot 10^{-10}:\\
\;\;\;\;\frac{2 \cdot e^{-x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot eps_m} + e^{x \cdot \left(-eps_m\right)}}{2}\\
\end{array}
\end{array}
if eps < 3e-10Initial program 65.2%
fma-neg65.0%
/-rgt-identity65.0%
fma-neg65.2%
/-rgt-identity65.2%
distribute-rgt-neg-in65.2%
sub-neg65.2%
metadata-eval65.2%
distribute-rgt-neg-in65.2%
Simplified65.2%
Taylor expanded in eps around inf 98.0%
Simplified98.0%
Taylor expanded in eps around 0 80.5%
neg-mul-180.5%
Simplified80.5%
Taylor expanded in eps around 0 76.6%
neg-mul-176.6%
count-276.6%
Simplified76.6%
if 3e-10 < eps Initial program 99.9%
fma-neg99.9%
/-rgt-identity99.9%
fma-neg99.9%
/-rgt-identity99.9%
distribute-rgt-neg-in99.9%
sub-neg99.9%
metadata-eval99.9%
distribute-rgt-neg-in99.9%
Simplified99.9%
Taylor expanded in eps around inf 99.9%
Simplified99.9%
Taylor expanded in eps around inf 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in eps around inf 99.9%
associate-*r*99.9%
neg-mul-199.9%
Simplified99.9%
Final simplification82.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* x (+ eps_m -1.0))) (exp (* x (- -1.0 eps_m)))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * (eps_m + -1.0))) + exp((x * (-1.0 - eps_m)))) / 2.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = (exp((x * (eps_m + (-1.0d0)))) + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return (Math.exp((x * (eps_m + -1.0))) + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.exp((x * (eps_m + -1.0))) + math.exp((x * (-1.0 - eps_m)))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((x * (eps_m + -1.0))) + exp((x * (-1.0 - eps_m)))) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\frac{e^{x \cdot \left(eps_m + -1\right)} + e^{x \cdot \left(-1 - eps_m\right)}}{2}
\end{array}
Initial program 74.3%
fma-neg74.2%
/-rgt-identity74.2%
fma-neg74.3%
/-rgt-identity74.3%
distribute-rgt-neg-in74.3%
sub-neg74.3%
metadata-eval74.3%
distribute-rgt-neg-in74.3%
Simplified74.3%
Taylor expanded in eps around inf 98.5%
Simplified98.5%
Final simplification98.5%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1.1e-265)
(/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) 2.0)
(if (<= x 4.8e+65)
(/ (+ 1.0 (- (exp (* x eps_m)) (* x eps_m))) 2.0)
(/
(+
(+
1.0
(+ (/ 1.0 eps_m) (* x (* (- 1.0 eps_m) (+ -1.0 (/ -1.0 eps_m))))))
(- 1.0 (+ (/ 1.0 eps_m) (* x (* (+ 1.0 eps_m) (/ -1.0 eps_m))))))
2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.1e-265) {
tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 4.8e+65) {
tmp = (1.0 + (exp((x * eps_m)) - (x * eps_m))) / 2.0;
} else {
tmp = ((1.0 + ((1.0 / eps_m) + (x * ((1.0 - eps_m) * (-1.0 + (-1.0 / eps_m)))))) + (1.0 - ((1.0 / eps_m) + (x * ((1.0 + eps_m) * (-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 (x <= (-1.1d-265)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
else if (x <= 4.8d+65) then
tmp = (1.0d0 + (exp((x * eps_m)) - (x * eps_m))) / 2.0d0
else
tmp = ((1.0d0 + ((1.0d0 / eps_m) + (x * ((1.0d0 - eps_m) * ((-1.0d0) + ((-1.0d0) / eps_m)))))) + (1.0d0 - ((1.0d0 / eps_m) + (x * ((1.0d0 + eps_m) * ((-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 (x <= -1.1e-265) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 4.8e+65) {
tmp = (1.0 + (Math.exp((x * eps_m)) - (x * eps_m))) / 2.0;
} else {
tmp = ((1.0 + ((1.0 / eps_m) + (x * ((1.0 - eps_m) * (-1.0 + (-1.0 / eps_m)))))) + (1.0 - ((1.0 / eps_m) + (x * ((1.0 + eps_m) * (-1.0 / eps_m)))))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.1e-265: tmp = (1.0 + math.exp((x * (-1.0 - eps_m)))) / 2.0 elif x <= 4.8e+65: tmp = (1.0 + (math.exp((x * eps_m)) - (x * eps_m))) / 2.0 else: tmp = ((1.0 + ((1.0 / eps_m) + (x * ((1.0 - eps_m) * (-1.0 + (-1.0 / eps_m)))))) + (1.0 - ((1.0 / eps_m) + (x * ((1.0 + eps_m) * (-1.0 / eps_m)))))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.1e-265) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); elseif (x <= 4.8e+65) tmp = Float64(Float64(1.0 + Float64(exp(Float64(x * eps_m)) - Float64(x * eps_m))) / 2.0); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(1.0 / eps_m) + Float64(x * Float64(Float64(1.0 - eps_m) * Float64(-1.0 + Float64(-1.0 / eps_m)))))) + Float64(1.0 - Float64(Float64(1.0 / eps_m) + Float64(x * Float64(Float64(1.0 + eps_m) * 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 (x <= -1.1e-265) tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0; elseif (x <= 4.8e+65) tmp = (1.0 + (exp((x * eps_m)) - (x * eps_m))) / 2.0; else tmp = ((1.0 + ((1.0 / eps_m) + (x * ((1.0 - eps_m) * (-1.0 + (-1.0 / eps_m)))))) + (1.0 - ((1.0 / eps_m) + (x * ((1.0 + eps_m) * (-1.0 / eps_m)))))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.1e-265], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 4.8e+65], N[(N[(1.0 + N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 + N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(x * N[(N[(1.0 - eps$95$m), $MachinePrecision] * N[(-1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(x * N[(N[(1.0 + eps$95$m), $MachinePrecision] * N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{-265}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - eps_m\right)}}{2}\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{+65}:\\
\;\;\;\;\frac{1 + \left(e^{x \cdot eps_m} - x \cdot eps_m\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \left(\frac{1}{eps_m} + x \cdot \left(\left(1 - eps_m\right) \cdot \left(-1 + \frac{-1}{eps_m}\right)\right)\right)\right) + \left(1 - \left(\frac{1}{eps_m} + x \cdot \left(\left(1 + eps_m\right) \cdot \frac{-1}{eps_m}\right)\right)\right)}{2}\\
\end{array}
\end{array}
if x < -1.10000000000000005e-265Initial program 68.0%
fma-neg68.0%
/-rgt-identity68.0%
fma-neg68.0%
/-rgt-identity68.0%
distribute-rgt-neg-in68.0%
sub-neg68.0%
metadata-eval68.0%
distribute-rgt-neg-in68.0%
Simplified68.0%
Taylor expanded in eps around inf 98.5%
Simplified98.5%
Taylor expanded in x around 0 69.8%
if -1.10000000000000005e-265 < x < 4.8000000000000003e65Initial program 63.7%
fma-neg63.4%
/-rgt-identity63.4%
fma-neg63.7%
/-rgt-identity63.7%
distribute-rgt-neg-in63.7%
sub-neg63.7%
metadata-eval63.7%
distribute-rgt-neg-in63.7%
Simplified63.7%
Taylor expanded in x around 0 45.7%
Taylor expanded in eps around inf 79.5%
associate-*r*79.5%
sub-neg79.5%
neg-mul-179.5%
associate-*r*79.5%
associate-*r*79.5%
neg-mul-179.5%
neg-mul-179.5%
sub-neg79.5%
associate-*r*79.5%
neg-mul-179.5%
Simplified79.5%
Taylor expanded in eps around inf 80.2%
*-commutative91.8%
Simplified80.2%
if 4.8000000000000003e65 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 25.1%
Taylor expanded in x around 0 25.2%
Taylor expanded in eps around 0 36.3%
Final simplification65.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 3e-10) (/ (* 2.0 (exp (- x))) 2.0) (/ (+ 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 <= 3e-10) {
tmp = (2.0 * exp(-x)) / 2.0;
} else {
tmp = (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 <= 3d-10) then
tmp = (2.0d0 * exp(-x)) / 2.0d0
else
tmp = (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 <= 3e-10) {
tmp = (2.0 * Math.exp(-x)) / 2.0;
} else {
tmp = (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 <= 3e-10: tmp = (2.0 * math.exp(-x)) / 2.0 else: tmp = (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 <= 3e-10) tmp = Float64(Float64(2.0 * exp(Float64(-x))) / 2.0); else tmp = Float64(Float64(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 <= 3e-10) tmp = (2.0 * exp(-x)) / 2.0; else tmp = (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, 3e-10], N[(N[(2.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps_m \leq 3 \cdot 10^{-10}:\\
\;\;\;\;\frac{2 \cdot e^{-x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - eps_m\right)}}{2}\\
\end{array}
\end{array}
if eps < 3e-10Initial program 65.2%
fma-neg65.0%
/-rgt-identity65.0%
fma-neg65.2%
/-rgt-identity65.2%
distribute-rgt-neg-in65.2%
sub-neg65.2%
metadata-eval65.2%
distribute-rgt-neg-in65.2%
Simplified65.2%
Taylor expanded in eps around inf 98.0%
Simplified98.0%
Taylor expanded in eps around 0 80.5%
neg-mul-180.5%
Simplified80.5%
Taylor expanded in eps around 0 76.6%
neg-mul-176.6%
count-276.6%
Simplified76.6%
if 3e-10 < eps Initial program 99.9%
fma-neg99.9%
/-rgt-identity99.9%
fma-neg99.9%
/-rgt-identity99.9%
distribute-rgt-neg-in99.9%
sub-neg99.9%
metadata-eval99.9%
distribute-rgt-neg-in99.9%
Simplified99.9%
Taylor expanded in eps around inf 99.9%
Simplified99.9%
Taylor expanded in x around 0 58.8%
Final simplification71.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 4.5e+223) (/ (* 2.0 (exp (- x))) 2.0) (/ (+ 2.0 (* x eps_m)) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 4.5e+223) {
tmp = (2.0 * exp(-x)) / 2.0;
} else {
tmp = (2.0 + (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 <= 4.5d+223) then
tmp = (2.0d0 * exp(-x)) / 2.0d0
else
tmp = (2.0d0 + (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 <= 4.5e+223) {
tmp = (2.0 * Math.exp(-x)) / 2.0;
} else {
tmp = (2.0 + (x * eps_m)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 4.5e+223: tmp = (2.0 * math.exp(-x)) / 2.0 else: tmp = (2.0 + (x * eps_m)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 4.5e+223) tmp = Float64(Float64(2.0 * exp(Float64(-x))) / 2.0); else tmp = Float64(Float64(2.0 + 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 <= 4.5e+223) tmp = (2.0 * exp(-x)) / 2.0; else tmp = (2.0 + (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, 4.5e+223], N[(N[(2.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps_m \leq 4.5 \cdot 10^{+223}:\\
\;\;\;\;\frac{2 \cdot e^{-x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot eps_m}{2}\\
\end{array}
\end{array}
if eps < 4.5e223Initial program 72.7%
fma-neg72.6%
/-rgt-identity72.6%
fma-neg72.7%
/-rgt-identity72.7%
distribute-rgt-neg-in72.7%
sub-neg72.7%
metadata-eval72.7%
distribute-rgt-neg-in72.7%
Simplified72.7%
Taylor expanded in eps around inf 98.4%
Simplified98.4%
Taylor expanded in eps around 0 81.7%
neg-mul-181.7%
Simplified81.7%
Taylor expanded in eps around 0 69.9%
neg-mul-169.9%
count-269.9%
Simplified69.9%
if 4.5e223 < eps Initial program 99.7%
fma-neg99.7%
/-rgt-identity99.7%
fma-neg99.7%
/-rgt-identity99.7%
distribute-rgt-neg-in99.7%
sub-neg99.7%
metadata-eval99.7%
distribute-rgt-neg-in99.7%
Simplified99.7%
Taylor expanded in x around 0 35.0%
Taylor expanded in x around 0 7.7%
Taylor expanded in eps around 0 40.7%
neg-mul-140.7%
unsub-neg40.7%
Simplified40.7%
Taylor expanded in eps around inf 40.7%
Final simplification68.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 220.0)
(/ (+ 1.0 (- 1.0 (* x eps_m))) 2.0)
(/
(+
(+ 1.0 (+ (/ 1.0 eps_m) (* x (* (- 1.0 eps_m) (+ -1.0 (/ -1.0 eps_m))))))
(- 1.0 (+ (/ 1.0 eps_m) (* x (* (+ 1.0 eps_m) (/ -1.0 eps_m))))))
2.0)))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 220.0) {
tmp = (1.0 + (1.0 - (x * eps_m))) / 2.0;
} else {
tmp = ((1.0 + ((1.0 / eps_m) + (x * ((1.0 - eps_m) * (-1.0 + (-1.0 / eps_m)))))) + (1.0 - ((1.0 / eps_m) + (x * ((1.0 + eps_m) * (-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 (x <= 220.0d0) then
tmp = (1.0d0 + (1.0d0 - (x * eps_m))) / 2.0d0
else
tmp = ((1.0d0 + ((1.0d0 / eps_m) + (x * ((1.0d0 - eps_m) * ((-1.0d0) + ((-1.0d0) / eps_m)))))) + (1.0d0 - ((1.0d0 / eps_m) + (x * ((1.0d0 + eps_m) * ((-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 (x <= 220.0) {
tmp = (1.0 + (1.0 - (x * eps_m))) / 2.0;
} else {
tmp = ((1.0 + ((1.0 / eps_m) + (x * ((1.0 - eps_m) * (-1.0 + (-1.0 / eps_m)))))) + (1.0 - ((1.0 / eps_m) + (x * ((1.0 + eps_m) * (-1.0 / eps_m)))))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 220.0: tmp = (1.0 + (1.0 - (x * eps_m))) / 2.0 else: tmp = ((1.0 + ((1.0 / eps_m) + (x * ((1.0 - eps_m) * (-1.0 + (-1.0 / eps_m)))))) + (1.0 - ((1.0 / eps_m) + (x * ((1.0 + eps_m) * (-1.0 / eps_m)))))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 220.0) tmp = Float64(Float64(1.0 + Float64(1.0 - Float64(x * eps_m))) / 2.0); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(1.0 / eps_m) + Float64(x * Float64(Float64(1.0 - eps_m) * Float64(-1.0 + Float64(-1.0 / eps_m)))))) + Float64(1.0 - Float64(Float64(1.0 / eps_m) + Float64(x * Float64(Float64(1.0 + eps_m) * 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 (x <= 220.0) tmp = (1.0 + (1.0 - (x * eps_m))) / 2.0; else tmp = ((1.0 + ((1.0 / eps_m) + (x * ((1.0 - eps_m) * (-1.0 + (-1.0 / eps_m)))))) + (1.0 - ((1.0 / eps_m) + (x * ((1.0 + eps_m) * (-1.0 / eps_m)))))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 220.0], N[(N[(1.0 + N[(1.0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 + N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(x * N[(N[(1.0 - eps$95$m), $MachinePrecision] * N[(-1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(x * N[(N[(1.0 + eps$95$m), $MachinePrecision] * N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 220:\\
\;\;\;\;\frac{1 + \left(1 - x \cdot eps_m\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \left(\frac{1}{eps_m} + x \cdot \left(\left(1 - eps_m\right) \cdot \left(-1 + \frac{-1}{eps_m}\right)\right)\right)\right) + \left(1 - \left(\frac{1}{eps_m} + x \cdot \left(\left(1 + eps_m\right) \cdot \frac{-1}{eps_m}\right)\right)\right)}{2}\\
\end{array}
\end{array}
if x < 220Initial program 62.1%
fma-neg62.0%
/-rgt-identity62.0%
fma-neg62.1%
/-rgt-identity62.1%
distribute-rgt-neg-in62.1%
sub-neg62.1%
metadata-eval62.1%
distribute-rgt-neg-in62.1%
Simplified62.1%
Taylor expanded in x around 0 40.3%
Taylor expanded in eps around inf 76.0%
associate-*r*76.0%
sub-neg76.0%
neg-mul-176.0%
associate-*r*76.0%
associate-*r*76.0%
neg-mul-176.0%
neg-mul-176.0%
sub-neg76.0%
associate-*r*76.0%
neg-mul-176.0%
Simplified76.0%
Taylor expanded in x around 0 63.0%
if 220 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 32.1%
Taylor expanded in x around 0 26.0%
Taylor expanded in eps around 0 35.0%
Final simplification54.1%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 220.0)
(/ (+ 1.0 (- 1.0 (* x eps_m))) 2.0)
(if (<= x 1.45e+140)
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0)
(/
(+
(+
1.0
(+ (/ 1.0 eps_m) (* x (* (- 1.0 eps_m) (+ -1.0 (/ -1.0 eps_m))))))
(+ 1.0 (/ (+ x -1.0) eps_m)))
2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 220.0) {
tmp = (1.0 + (1.0 - (x * eps_m))) / 2.0;
} else if (x <= 1.45e+140) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = ((1.0 + ((1.0 / eps_m) + (x * ((1.0 - eps_m) * (-1.0 + (-1.0 / eps_m)))))) + (1.0 + ((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 (x <= 220.0d0) then
tmp = (1.0d0 + (1.0d0 - (x * eps_m))) / 2.0d0
else if (x <= 1.45d+140) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 + ((-1.0d0) / eps_m))) / 2.0d0
else
tmp = ((1.0d0 + ((1.0d0 / eps_m) + (x * ((1.0d0 - eps_m) * ((-1.0d0) + ((-1.0d0) / eps_m)))))) + (1.0d0 + ((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 (x <= 220.0) {
tmp = (1.0 + (1.0 - (x * eps_m))) / 2.0;
} else if (x <= 1.45e+140) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = ((1.0 + ((1.0 / eps_m) + (x * ((1.0 - eps_m) * (-1.0 + (-1.0 / eps_m)))))) + (1.0 + ((x + -1.0) / eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 220.0: tmp = (1.0 + (1.0 - (x * eps_m))) / 2.0 elif x <= 1.45e+140: tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 else: tmp = ((1.0 + ((1.0 / eps_m) + (x * ((1.0 - eps_m) * (-1.0 + (-1.0 / eps_m)))))) + (1.0 + ((x + -1.0) / eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 220.0) tmp = Float64(Float64(1.0 + Float64(1.0 - Float64(x * eps_m))) / 2.0); elseif (x <= 1.45e+140) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(1.0 / eps_m) + Float64(x * Float64(Float64(1.0 - eps_m) * Float64(-1.0 + Float64(-1.0 / eps_m)))))) + Float64(1.0 + Float64(Float64(x + -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 (x <= 220.0) tmp = (1.0 + (1.0 - (x * eps_m))) / 2.0; elseif (x <= 1.45e+140) tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0; else tmp = ((1.0 + ((1.0 / eps_m) + (x * ((1.0 - eps_m) * (-1.0 + (-1.0 / eps_m)))))) + (1.0 + ((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[x, 220.0], N[(N[(1.0 + N[(1.0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.45e+140], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 + N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(x * N[(N[(1.0 - eps$95$m), $MachinePrecision] * N[(-1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(x + -1.0), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 220:\\
\;\;\;\;\frac{1 + \left(1 - x \cdot eps_m\right)}{2}\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{+140}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps_m}\right) + \left(1 + \frac{-1}{eps_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \left(\frac{1}{eps_m} + x \cdot \left(\left(1 - eps_m\right) \cdot \left(-1 + \frac{-1}{eps_m}\right)\right)\right)\right) + \left(1 + \frac{x + -1}{eps_m}\right)}{2}\\
\end{array}
\end{array}
if x < 220Initial program 62.1%
fma-neg62.0%
/-rgt-identity62.0%
fma-neg62.1%
/-rgt-identity62.1%
distribute-rgt-neg-in62.1%
sub-neg62.1%
metadata-eval62.1%
distribute-rgt-neg-in62.1%
Simplified62.1%
Taylor expanded in x around 0 40.3%
Taylor expanded in eps around inf 76.0%
associate-*r*76.0%
sub-neg76.0%
neg-mul-176.0%
associate-*r*76.0%
associate-*r*76.0%
neg-mul-176.0%
neg-mul-176.0%
sub-neg76.0%
associate-*r*76.0%
neg-mul-176.0%
Simplified76.0%
Taylor expanded in x around 0 63.0%
if 220 < x < 1.4499999999999999e140Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 26.2%
Taylor expanded in x around 0 47.2%
if 1.4499999999999999e140 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 28.0%
Taylor expanded in x around 0 22.6%
Taylor expanded in eps around 0 37.2%
neg-mul-137.2%
unsub-neg37.2%
Simplified37.2%
Final simplification56.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 225.0) (/ (+ 1.0 (- 1.0 (* x eps_m))) 2.0) 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 225.0) {
tmp = (1.0 + (1.0 - (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 <= 225.0d0) then
tmp = (1.0d0 + (1.0d0 - (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 <= 225.0) {
tmp = (1.0 + (1.0 - (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 <= 225.0: tmp = (1.0 + (1.0 - (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 <= 225.0) tmp = Float64(Float64(1.0 + Float64(1.0 - 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 <= 225.0) tmp = (1.0 + (1.0 - (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, 225.0], N[(N[(1.0 + N[(1.0 - 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 225:\\
\;\;\;\;\frac{1 + \left(1 - x \cdot eps_m\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 225Initial program 62.1%
fma-neg62.0%
/-rgt-identity62.0%
fma-neg62.1%
/-rgt-identity62.1%
distribute-rgt-neg-in62.1%
sub-neg62.1%
metadata-eval62.1%
distribute-rgt-neg-in62.1%
Simplified62.1%
Taylor expanded in x around 0 40.3%
Taylor expanded in eps around inf 76.0%
associate-*r*76.0%
sub-neg76.0%
neg-mul-176.0%
associate-*r*76.0%
associate-*r*76.0%
neg-mul-176.0%
neg-mul-176.0%
sub-neg76.0%
associate-*r*76.0%
neg-mul-176.0%
Simplified76.0%
Taylor expanded in x around 0 63.0%
if 225 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 32.1%
Taylor expanded in x around 0 26.0%
Taylor expanded in eps around 0 31.4%
neg-mul-131.4%
unsub-neg31.4%
Simplified31.4%
Taylor expanded in eps around 0 48.4%
distribute-rgt1-in48.4%
metadata-eval48.4%
associate-*r/26.4%
mul0-lft48.4%
Simplified48.4%
Final simplification58.3%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -0.46) (/ (* x (- -1.0 eps_m)) 2.0) (if (<= x 540.0) 1.0 0.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -0.46) {
tmp = (x * (-1.0 - eps_m)) / 2.0;
} else if (x <= 540.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 <= (-0.46d0)) then
tmp = (x * ((-1.0d0) - eps_m)) / 2.0d0
else if (x <= 540.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 <= -0.46) {
tmp = (x * (-1.0 - eps_m)) / 2.0;
} else if (x <= 540.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -0.46: tmp = (x * (-1.0 - eps_m)) / 2.0 elif x <= 540.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -0.46) tmp = Float64(Float64(x * Float64(-1.0 - eps_m)) / 2.0); elseif (x <= 540.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 <= -0.46) tmp = (x * (-1.0 - eps_m)) / 2.0; elseif (x <= 540.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, -0.46], N[(N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 540.0], 1.0, 0.0]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.46:\\
\;\;\;\;\frac{x \cdot \left(-1 - eps_m\right)}{2}\\
\mathbf{elif}\;x \leq 540:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -0.46000000000000002Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 46.2%
Taylor expanded in x around inf 18.7%
Taylor expanded in eps around inf 18.7%
if -0.46000000000000002 < x < 540Initial program 54.5%
fma-neg54.4%
/-rgt-identity54.4%
fma-neg54.5%
/-rgt-identity54.5%
distribute-rgt-neg-in54.5%
sub-neg54.5%
metadata-eval54.5%
distribute-rgt-neg-in54.5%
Simplified54.5%
Taylor expanded in x around 0 72.6%
if 540 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 32.1%
Taylor expanded in x around 0 26.0%
Taylor expanded in eps around 0 31.4%
neg-mul-131.4%
unsub-neg31.4%
Simplified31.4%
Taylor expanded in eps around 0 48.4%
distribute-rgt1-in48.4%
metadata-eval48.4%
associate-*r/26.4%
mul0-lft48.4%
Simplified48.4%
Final simplification58.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 520.0) 1.0 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 520.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 <= 520.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 <= 520.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 520.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 520.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 <= 520.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, 520.0], 1.0, 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 520:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 520Initial program 62.1%
fma-neg62.0%
/-rgt-identity62.0%
fma-neg62.1%
/-rgt-identity62.1%
distribute-rgt-neg-in62.1%
sub-neg62.1%
metadata-eval62.1%
distribute-rgt-neg-in62.1%
Simplified62.1%
Taylor expanded in x around 0 61.0%
if 520 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 32.1%
Taylor expanded in x around 0 26.0%
Taylor expanded in eps around 0 31.4%
neg-mul-131.4%
unsub-neg31.4%
Simplified31.4%
Taylor expanded in eps around 0 48.4%
distribute-rgt1-in48.4%
metadata-eval48.4%
associate-*r/26.4%
mul0-lft48.4%
Simplified48.4%
Final simplification57.0%
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 74.3%
fma-neg74.2%
/-rgt-identity74.2%
fma-neg74.3%
/-rgt-identity74.3%
distribute-rgt-neg-in74.3%
sub-neg74.3%
metadata-eval74.3%
distribute-rgt-neg-in74.3%
Simplified74.3%
Taylor expanded in x around 0 37.7%
Taylor expanded in x around 0 24.6%
Taylor expanded in eps around 0 30.1%
neg-mul-130.1%
unsub-neg30.1%
Simplified30.1%
Taylor expanded in eps around 0 17.2%
distribute-rgt1-in17.2%
metadata-eval17.2%
associate-*r/10.2%
mul0-lft17.2%
Simplified17.2%
Final simplification17.2%
herbie shell --seed 2024021
(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))