
(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
(let* ((t_0 (* (+ x 1.0) (exp (- x)))))
(if (<= eps_m 2e-31)
(/ (+ t_0 t_0) 2.0)
(/ (+ (exp (* x (+ -1.0 eps_m))) (exp (* x (- eps_m)))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = (x + 1.0) * exp(-x);
double tmp;
if (eps_m <= 2e-31) {
tmp = (t_0 + t_0) / 2.0;
} else {
tmp = (exp((x * (-1.0 + 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) :: t_0
real(8) :: tmp
t_0 = (x + 1.0d0) * exp(-x)
if (eps_m <= 2d-31) then
tmp = (t_0 + t_0) / 2.0d0
else
tmp = (exp((x * ((-1.0d0) + 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 t_0 = (x + 1.0) * Math.exp(-x);
double tmp;
if (eps_m <= 2e-31) {
tmp = (t_0 + t_0) / 2.0;
} else {
tmp = (Math.exp((x * (-1.0 + eps_m))) + Math.exp((x * -eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = (x + 1.0) * math.exp(-x) tmp = 0 if eps_m <= 2e-31: tmp = (t_0 + t_0) / 2.0 else: tmp = (math.exp((x * (-1.0 + eps_m))) + math.exp((x * -eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(Float64(x + 1.0) * exp(Float64(-x))) tmp = 0.0 if (eps_m <= 2e-31) tmp = Float64(Float64(t_0 + t_0) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(-1.0 + 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) t_0 = (x + 1.0) * exp(-x); tmp = 0.0; if (eps_m <= 2e-31) tmp = (t_0 + t_0) / 2.0; else tmp = (exp((x * (-1.0 + eps_m))) + exp((x * -eps_m))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(N[(x + 1.0), $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps$95$m, 2e-31], N[(N[(t$95$0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := \left(x + 1\right) \cdot e^{-x}\\
\mathbf{if}\;eps\_m \leq 2 \cdot 10^{-31}:\\
\;\;\;\;\frac{t\_0 + t\_0}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(-1 + eps\_m\right)} + e^{x \cdot \left(-eps\_m\right)}}{2}\\
\end{array}
\end{array}
if eps < 2e-31Initial program 65.4%
fma-neg65.5%
/-rgt-identity65.5%
fma-neg65.4%
/-rgt-identity65.4%
distribute-rgt-neg-in65.4%
sub-neg65.4%
metadata-eval65.4%
distribute-rgt-neg-in65.4%
Simplified65.4%
Taylor expanded in eps around 0 67.1%
Simplified67.1%
if 2e-31 < eps 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 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
sub-neg100.0%
mul-1-neg100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
distribute-neg-in100.0%
metadata-eval100.0%
remove-double-neg100.0%
mul-1-neg100.0%
remove-double-neg100.0%
mul-1-neg100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Final simplification78.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* x (+ -1.0 eps_m))) (exp (* x (- -1.0 eps_m)))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * (-1.0 + eps_m))) + 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 * ((-1.0d0) + eps_m))) + 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 * (-1.0 + eps_m))) + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.exp((x * (-1.0 + eps_m))) + 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(-1.0 + eps_m))) + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((x * (-1.0 + eps_m))) + 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[(-1.0 + eps$95$m), $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(-1 + eps\_m\right)} + e^{x \cdot \left(-1 - eps\_m\right)}}{2}
\end{array}
Initial program 76.2%
fma-neg76.2%
/-rgt-identity76.2%
fma-neg76.2%
/-rgt-identity76.2%
distribute-rgt-neg-in76.2%
sub-neg76.2%
metadata-eval76.2%
distribute-rgt-neg-in76.2%
Simplified76.2%
Taylor expanded in eps around inf 99.2%
Final simplification99.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* x (+ -1.0 eps_m))) (exp (* x (- eps_m)))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * (-1.0 + eps_m))) + exp((x * -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 * ((-1.0d0) + eps_m))) + exp((x * -eps_m))) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return (Math.exp((x * (-1.0 + eps_m))) + Math.exp((x * -eps_m))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.exp((x * (-1.0 + eps_m))) + math.exp((x * -eps_m))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(exp(Float64(x * Float64(-1.0 + eps_m))) + exp(Float64(x * Float64(-eps_m)))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((x * (-1.0 + eps_m))) + exp((x * -eps_m))) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\frac{e^{x \cdot \left(-1 + eps\_m\right)} + e^{x \cdot \left(-eps\_m\right)}}{2}
\end{array}
Initial program 76.2%
fma-neg76.2%
/-rgt-identity76.2%
fma-neg76.2%
/-rgt-identity76.2%
distribute-rgt-neg-in76.2%
sub-neg76.2%
metadata-eval76.2%
distribute-rgt-neg-in76.2%
Simplified76.2%
Taylor expanded in eps around inf 99.2%
Taylor expanded in eps around inf 85.9%
*-commutative85.9%
Simplified85.9%
Taylor expanded in x around inf 85.9%
sub-neg85.9%
mul-1-neg85.9%
distribute-rgt-neg-in85.9%
sub-neg85.9%
distribute-neg-in85.9%
metadata-eval85.9%
remove-double-neg85.9%
mul-1-neg85.9%
remove-double-neg85.9%
mul-1-neg85.9%
distribute-rgt-neg-in85.9%
Simplified85.9%
Final simplification85.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* x eps_m)) (exp (* x (- eps_m)))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * eps_m)) + exp((x * -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)) + exp((x * -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)) + Math.exp((x * -eps_m))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.exp((x * eps_m)) + math.exp((x * -eps_m))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(exp(Float64(x * eps_m)) + exp(Float64(x * Float64(-eps_m)))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := 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|
\\
\frac{e^{x \cdot eps\_m} + e^{x \cdot \left(-eps\_m\right)}}{2}
\end{array}
Initial program 76.2%
fma-neg76.2%
/-rgt-identity76.2%
fma-neg76.2%
/-rgt-identity76.2%
distribute-rgt-neg-in76.2%
sub-neg76.2%
metadata-eval76.2%
distribute-rgt-neg-in76.2%
Simplified76.2%
Taylor expanded in eps around inf 99.2%
Taylor expanded in eps around inf 85.9%
*-commutative85.9%
Simplified85.9%
Taylor expanded in x around inf 85.9%
sub-neg85.9%
mul-1-neg85.9%
distribute-rgt-neg-in85.9%
sub-neg85.9%
distribute-neg-in85.9%
metadata-eval85.9%
remove-double-neg85.9%
mul-1-neg85.9%
remove-double-neg85.9%
mul-1-neg85.9%
distribute-rgt-neg-in85.9%
Simplified85.9%
Taylor expanded in eps around inf 84.5%
*-commutative84.5%
Simplified84.5%
Final simplification84.5%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 1e-285)
(/ (+ (exp (- x)) 1.0) 2.0)
(if (or (<= x 2.15e+119) (not (<= x 2.25e+154)))
(/ (+ (exp (- (* x eps_m) x)) 1.0) 2.0)
(/ (/ 0.0 eps_m) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1e-285) {
tmp = (exp(-x) + 1.0) / 2.0;
} else if ((x <= 2.15e+119) || !(x <= 2.25e+154)) {
tmp = (exp(((x * eps_m) - x)) + 1.0) / 2.0;
} else {
tmp = (0.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 <= 1d-285) then
tmp = (exp(-x) + 1.0d0) / 2.0d0
else if ((x <= 2.15d+119) .or. (.not. (x <= 2.25d+154))) then
tmp = (exp(((x * eps_m) - x)) + 1.0d0) / 2.0d0
else
tmp = (0.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 <= 1e-285) {
tmp = (Math.exp(-x) + 1.0) / 2.0;
} else if ((x <= 2.15e+119) || !(x <= 2.25e+154)) {
tmp = (Math.exp(((x * eps_m) - x)) + 1.0) / 2.0;
} else {
tmp = (0.0 / eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1e-285: tmp = (math.exp(-x) + 1.0) / 2.0 elif (x <= 2.15e+119) or not (x <= 2.25e+154): tmp = (math.exp(((x * eps_m) - x)) + 1.0) / 2.0 else: tmp = (0.0 / eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1e-285) tmp = Float64(Float64(exp(Float64(-x)) + 1.0) / 2.0); elseif ((x <= 2.15e+119) || !(x <= 2.25e+154)) tmp = Float64(Float64(exp(Float64(Float64(x * eps_m) - x)) + 1.0) / 2.0); else tmp = Float64(Float64(0.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 <= 1e-285) tmp = (exp(-x) + 1.0) / 2.0; elseif ((x <= 2.15e+119) || ~((x <= 2.25e+154))) tmp = (exp(((x * eps_m) - x)) + 1.0) / 2.0; else tmp = (0.0 / eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 1e-285], N[(N[(N[Exp[(-x)], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 2.15e+119], N[Not[LessEqual[x, 2.25e+154]], $MachinePrecision]], N[(N[(N[Exp[N[(N[(x * eps$95$m), $MachinePrecision] - x), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(0.0 / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 10^{-285}:\\
\;\;\;\;\frac{e^{-x} + 1}{2}\\
\mathbf{elif}\;x \leq 2.15 \cdot 10^{+119} \lor \neg \left(x \leq 2.25 \cdot 10^{+154}\right):\\
\;\;\;\;\frac{e^{x \cdot eps\_m - x} + 1}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0}{eps\_m}}{2}\\
\end{array}
\end{array}
if x < 1.00000000000000007e-285Initial program 72.3%
fma-neg72.3%
/-rgt-identity72.3%
fma-neg72.3%
/-rgt-identity72.3%
distribute-rgt-neg-in72.3%
sub-neg72.3%
metadata-eval72.3%
distribute-rgt-neg-in72.3%
Simplified72.3%
Taylor expanded in eps around inf 99.5%
Taylor expanded in eps around inf 99.5%
*-commutative99.5%
Simplified99.5%
Taylor expanded in eps around 0 83.5%
mul-1-neg83.5%
Simplified83.5%
if 1.00000000000000007e-285 < x < 2.15000000000000016e119 or 2.25000000000000005e154 < x Initial program 77.8%
fma-neg77.8%
/-rgt-identity77.8%
fma-neg77.8%
/-rgt-identity77.8%
distribute-rgt-neg-in77.8%
sub-neg77.8%
metadata-eval77.8%
distribute-rgt-neg-in77.8%
Simplified77.8%
Taylor expanded in x around 0 32.7%
Taylor expanded in eps around inf 54.1%
add-sqr-sqrt54.1%
sqrt-unprod51.9%
sqr-neg51.9%
sqrt-unprod0.0%
add-sqr-sqrt53.7%
distribute-lft-neg-in53.7%
distribute-lft-in53.7%
*-rgt-identity53.7%
distribute-neg-in53.7%
add-sqr-sqrt0.0%
sqrt-unprod46.7%
sqr-neg46.7%
sqrt-unprod54.1%
add-sqr-sqrt54.1%
Applied egg-rr54.1%
Taylor expanded in x around inf 54.1%
mul-1-neg54.1%
mul-1-neg54.1%
*-commutative54.1%
Simplified54.1%
if 2.15000000000000016e119 < x < 2.25000000000000005e154Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 78.1%
Taylor expanded in x around 0 78.1%
Final simplification67.8%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -2e-293)
(/ (+ (exp (* x (- eps_m))) 1.0) 2.0)
(if (or (<= x 8.2e+119) (not (<= x 2.4e+154)))
(/ (+ (exp (- (* x eps_m) x)) 1.0) 2.0)
(/ (/ 0.0 eps_m) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -2e-293) {
tmp = (exp((x * -eps_m)) + 1.0) / 2.0;
} else if ((x <= 8.2e+119) || !(x <= 2.4e+154)) {
tmp = (exp(((x * eps_m) - x)) + 1.0) / 2.0;
} else {
tmp = (0.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 <= (-2d-293)) then
tmp = (exp((x * -eps_m)) + 1.0d0) / 2.0d0
else if ((x <= 8.2d+119) .or. (.not. (x <= 2.4d+154))) then
tmp = (exp(((x * eps_m) - x)) + 1.0d0) / 2.0d0
else
tmp = (0.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 <= -2e-293) {
tmp = (Math.exp((x * -eps_m)) + 1.0) / 2.0;
} else if ((x <= 8.2e+119) || !(x <= 2.4e+154)) {
tmp = (Math.exp(((x * eps_m) - x)) + 1.0) / 2.0;
} else {
tmp = (0.0 / eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -2e-293: tmp = (math.exp((x * -eps_m)) + 1.0) / 2.0 elif (x <= 8.2e+119) or not (x <= 2.4e+154): tmp = (math.exp(((x * eps_m) - x)) + 1.0) / 2.0 else: tmp = (0.0 / eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -2e-293) tmp = Float64(Float64(exp(Float64(x * Float64(-eps_m))) + 1.0) / 2.0); elseif ((x <= 8.2e+119) || !(x <= 2.4e+154)) tmp = Float64(Float64(exp(Float64(Float64(x * eps_m) - x)) + 1.0) / 2.0); else tmp = Float64(Float64(0.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 <= -2e-293) tmp = (exp((x * -eps_m)) + 1.0) / 2.0; elseif ((x <= 8.2e+119) || ~((x <= 2.4e+154))) tmp = (exp(((x * eps_m) - x)) + 1.0) / 2.0; else tmp = (0.0 / eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -2e-293], N[(N[(N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 8.2e+119], N[Not[LessEqual[x, 2.4e+154]], $MachinePrecision]], N[(N[(N[Exp[N[(N[(x * eps$95$m), $MachinePrecision] - x), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(0.0 / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-293}:\\
\;\;\;\;\frac{e^{x \cdot \left(-eps\_m\right)} + 1}{2}\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{+119} \lor \neg \left(x \leq 2.4 \cdot 10^{+154}\right):\\
\;\;\;\;\frac{e^{x \cdot eps\_m - x} + 1}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0}{eps\_m}}{2}\\
\end{array}
\end{array}
if x < -2.0000000000000001e-293Initial program 74.6%
fma-neg74.6%
/-rgt-identity74.6%
fma-neg74.6%
/-rgt-identity74.6%
distribute-rgt-neg-in74.6%
sub-neg74.6%
metadata-eval74.6%
distribute-rgt-neg-in74.6%
Simplified74.6%
Taylor expanded in x around 0 47.5%
Taylor expanded in eps around inf 72.4%
Taylor expanded in eps around inf 72.6%
*-commutative99.4%
Simplified72.6%
if -2.0000000000000001e-293 < x < 8.1999999999999994e119 or 2.40000000000000015e154 < x Initial program 75.8%
fma-neg75.8%
/-rgt-identity75.8%
fma-neg75.8%
/-rgt-identity75.8%
distribute-rgt-neg-in75.8%
sub-neg75.8%
metadata-eval75.8%
distribute-rgt-neg-in75.8%
Simplified75.8%
Taylor expanded in x around 0 34.5%
Taylor expanded in eps around inf 57.9%
add-sqr-sqrt54.6%
sqrt-unprod56.2%
sqr-neg56.2%
sqrt-unprod3.4%
add-sqr-sqrt57.6%
distribute-lft-neg-in57.6%
distribute-lft-in57.6%
*-rgt-identity57.6%
distribute-neg-in57.6%
add-sqr-sqrt3.4%
sqrt-unprod51.2%
sqr-neg51.2%
sqrt-unprod54.6%
add-sqr-sqrt58.0%
Applied egg-rr58.0%
Taylor expanded in x around inf 58.0%
mul-1-neg58.0%
mul-1-neg58.0%
*-commutative58.0%
Simplified58.0%
if 8.1999999999999994e119 < x < 2.40000000000000015e154Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 78.1%
Taylor expanded in x around 0 78.1%
Final simplification64.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 1.9)
(/ (+ (* x (- -1.0 eps_m)) 2.0) 2.0)
(if (or (<= x 1.6e+114) (not (<= x 1.4e+156)))
(/ (/ (expm1 x) eps_m) 2.0)
(/ (/ 0.0 eps_m) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1.9) {
tmp = ((x * (-1.0 - eps_m)) + 2.0) / 2.0;
} else if ((x <= 1.6e+114) || !(x <= 1.4e+156)) {
tmp = (expm1(x) / eps_m) / 2.0;
} else {
tmp = (0.0 / eps_m) / 2.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 1.9) {
tmp = ((x * (-1.0 - eps_m)) + 2.0) / 2.0;
} else if ((x <= 1.6e+114) || !(x <= 1.4e+156)) {
tmp = (Math.expm1(x) / eps_m) / 2.0;
} else {
tmp = (0.0 / eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1.9: tmp = ((x * (-1.0 - eps_m)) + 2.0) / 2.0 elif (x <= 1.6e+114) or not (x <= 1.4e+156): tmp = (math.expm1(x) / eps_m) / 2.0 else: tmp = (0.0 / eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1.9) tmp = Float64(Float64(Float64(x * Float64(-1.0 - eps_m)) + 2.0) / 2.0); elseif ((x <= 1.6e+114) || !(x <= 1.4e+156)) tmp = Float64(Float64(expm1(x) / eps_m) / 2.0); else tmp = Float64(Float64(0.0 / eps_m) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 1.9], N[(N[(N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 1.6e+114], N[Not[LessEqual[x, 1.4e+156]], $MachinePrecision]], N[(N[(N[(Exp[x] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(0.0 / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.9:\\
\;\;\;\;\frac{x \cdot \left(-1 - eps\_m\right) + 2}{2}\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{+114} \lor \neg \left(x \leq 1.4 \cdot 10^{+156}\right):\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(x\right)}{eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0}{eps\_m}}{2}\\
\end{array}
\end{array}
if x < 1.8999999999999999Initial program 64.0%
fma-neg64.1%
/-rgt-identity64.1%
fma-neg64.0%
/-rgt-identity64.0%
distribute-rgt-neg-in64.0%
sub-neg64.0%
metadata-eval64.0%
distribute-rgt-neg-in64.0%
Simplified64.0%
Taylor expanded in x around 0 44.1%
Taylor expanded in eps around inf 79.3%
Taylor expanded in x around 0 60.0%
mul-1-neg60.0%
unsub-neg60.0%
Simplified60.0%
if 1.8999999999999999 < x < 1.6e114 or 1.39999999999999994e156 < x Initial program 98.8%
Simplified98.7%
Taylor expanded in eps around 0 40.7%
Taylor expanded in x around 0 2.0%
sub-neg2.0%
neg-mul-12.0%
add-sqr-sqrt0.0%
sqrt-unprod30.1%
sqr-neg30.1%
sqrt-unprod30.1%
add-sqr-sqrt30.1%
metadata-eval30.1%
Applied egg-rr30.1%
*-rgt-identity30.1%
fma-def30.1%
metadata-eval30.1%
fma-neg30.1%
*-rgt-identity30.1%
expm1-def30.1%
Simplified30.1%
if 1.6e114 < x < 1.39999999999999994e156Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 73.2%
Taylor expanded in x around 0 73.2%
Final simplification51.5%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 6000000000000.0)
(/ (+ (exp (- x)) 1.0) 2.0)
(if (or (<= x 2.5e+114) (not (<= x 2e+156)))
(/ (/ (expm1 x) eps_m) 2.0)
(/ (/ 0.0 eps_m) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 6000000000000.0) {
tmp = (exp(-x) + 1.0) / 2.0;
} else if ((x <= 2.5e+114) || !(x <= 2e+156)) {
tmp = (expm1(x) / eps_m) / 2.0;
} else {
tmp = (0.0 / eps_m) / 2.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 6000000000000.0) {
tmp = (Math.exp(-x) + 1.0) / 2.0;
} else if ((x <= 2.5e+114) || !(x <= 2e+156)) {
tmp = (Math.expm1(x) / eps_m) / 2.0;
} else {
tmp = (0.0 / eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 6000000000000.0: tmp = (math.exp(-x) + 1.0) / 2.0 elif (x <= 2.5e+114) or not (x <= 2e+156): tmp = (math.expm1(x) / eps_m) / 2.0 else: tmp = (0.0 / eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 6000000000000.0) tmp = Float64(Float64(exp(Float64(-x)) + 1.0) / 2.0); elseif ((x <= 2.5e+114) || !(x <= 2e+156)) tmp = Float64(Float64(expm1(x) / eps_m) / 2.0); else tmp = Float64(Float64(0.0 / eps_m) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 6000000000000.0], N[(N[(N[Exp[(-x)], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 2.5e+114], N[Not[LessEqual[x, 2e+156]], $MachinePrecision]], N[(N[(N[(Exp[x] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(0.0 / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6000000000000:\\
\;\;\;\;\frac{e^{-x} + 1}{2}\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{+114} \lor \neg \left(x \leq 2 \cdot 10^{+156}\right):\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(x\right)}{eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0}{eps\_m}}{2}\\
\end{array}
\end{array}
if x < 6e12Initial program 64.1%
fma-neg64.1%
/-rgt-identity64.1%
fma-neg64.1%
/-rgt-identity64.1%
distribute-rgt-neg-in64.1%
sub-neg64.1%
metadata-eval64.1%
distribute-rgt-neg-in64.1%
Simplified64.1%
Taylor expanded in eps around inf 98.8%
Taylor expanded in eps around inf 97.7%
*-commutative97.7%
Simplified97.7%
Taylor expanded in eps around 0 79.7%
mul-1-neg79.7%
Simplified79.7%
if 6e12 < x < 2.5e114 or 2e156 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 39.6%
Taylor expanded in x around 0 1.9%
sub-neg1.9%
neg-mul-11.9%
add-sqr-sqrt0.0%
sqrt-unprod31.3%
sqr-neg31.3%
sqrt-unprod31.3%
add-sqr-sqrt31.3%
metadata-eval31.3%
Applied egg-rr31.3%
*-rgt-identity31.3%
fma-def31.3%
metadata-eval31.3%
fma-neg31.3%
*-rgt-identity31.3%
expm1-def31.3%
Simplified31.3%
if 2.5e114 < x < 2e156Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 73.2%
Taylor expanded in x around 0 73.2%
Final simplification65.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1.0)
(* (* x eps_m) -0.5)
(if (<= x 520.0)
1.0
(if (or (<= x 4.5e+216) (not (<= x 2.2e+263)))
(/ (/ 0.0 eps_m) 2.0)
(/ (* x eps_m) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.0) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 520.0) {
tmp = 1.0;
} else if ((x <= 4.5e+216) || !(x <= 2.2e+263)) {
tmp = (0.0 / eps_m) / 2.0;
} else {
tmp = (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 (x <= (-1.0d0)) then
tmp = (x * eps_m) * (-0.5d0)
else if (x <= 520.0d0) then
tmp = 1.0d0
else if ((x <= 4.5d+216) .or. (.not. (x <= 2.2d+263))) then
tmp = (0.0d0 / eps_m) / 2.0d0
else
tmp = (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 (x <= -1.0) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 520.0) {
tmp = 1.0;
} else if ((x <= 4.5e+216) || !(x <= 2.2e+263)) {
tmp = (0.0 / eps_m) / 2.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.0: tmp = (x * eps_m) * -0.5 elif x <= 520.0: tmp = 1.0 elif (x <= 4.5e+216) or not (x <= 2.2e+263): tmp = (0.0 / eps_m) / 2.0 else: tmp = (x * eps_m) / 2.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) * -0.5); elseif (x <= 520.0) tmp = 1.0; elseif ((x <= 4.5e+216) || !(x <= 2.2e+263)) tmp = Float64(Float64(0.0 / eps_m) / 2.0); else tmp = Float64(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 (x <= -1.0) tmp = (x * eps_m) * -0.5; elseif (x <= 520.0) tmp = 1.0; elseif ((x <= 4.5e+216) || ~((x <= 2.2e+263))) tmp = (0.0 / eps_m) / 2.0; else tmp = (x * eps_m) / 2.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] * -0.5), $MachinePrecision], If[LessEqual[x, 520.0], 1.0, If[Or[LessEqual[x, 4.5e+216], N[Not[LessEqual[x, 2.2e+263]], $MachinePrecision]], N[(N[(0.0 / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x * eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\left(x \cdot eps\_m\right) \cdot -0.5\\
\mathbf{elif}\;x \leq 520:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{+216} \lor \neg \left(x \leq 2.2 \cdot 10^{+263}\right):\\
\;\;\;\;\frac{\frac{0}{eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < -1Initial 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 64.5%
Taylor expanded in eps around inf 34.6%
*-commutative34.6%
Simplified34.6%
frac-2neg34.6%
div-inv34.6%
add-sqr-sqrt0.1%
sqrt-unprod0.1%
sqr-neg0.1%
sqrt-unprod0.0%
add-sqr-sqrt14.6%
metadata-eval14.6%
metadata-eval14.6%
Applied egg-rr14.6%
if -1 < x < 520Initial program 52.3%
fma-neg52.4%
/-rgt-identity52.4%
fma-neg52.3%
/-rgt-identity52.3%
distribute-rgt-neg-in52.3%
sub-neg52.3%
metadata-eval52.3%
distribute-rgt-neg-in52.3%
Simplified52.3%
Taylor expanded in x around 0 74.9%
if 520 < x < 4.50000000000000025e216 or 2.2e263 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 48.1%
Taylor expanded in x around 0 48.1%
if 4.50000000000000025e216 < x < 2.2e263Initial 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 44.0%
Taylor expanded in eps around inf 37.3%
*-commutative37.3%
Simplified37.3%
Final simplification55.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 2.0)
(/ (+ (* x (- -1.0 eps_m)) 2.0) 2.0)
(if (or (<= x 1.8e+216) (not (<= x 2.3e+263)))
(/ (/ 0.0 eps_m) 2.0)
(/ (* x eps_m) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 2.0) {
tmp = ((x * (-1.0 - eps_m)) + 2.0) / 2.0;
} else if ((x <= 1.8e+216) || !(x <= 2.3e+263)) {
tmp = (0.0 / eps_m) / 2.0;
} else {
tmp = (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 (x <= 2.0d0) then
tmp = ((x * ((-1.0d0) - eps_m)) + 2.0d0) / 2.0d0
else if ((x <= 1.8d+216) .or. (.not. (x <= 2.3d+263))) then
tmp = (0.0d0 / eps_m) / 2.0d0
else
tmp = (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 (x <= 2.0) {
tmp = ((x * (-1.0 - eps_m)) + 2.0) / 2.0;
} else if ((x <= 1.8e+216) || !(x <= 2.3e+263)) {
tmp = (0.0 / eps_m) / 2.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 2.0: tmp = ((x * (-1.0 - eps_m)) + 2.0) / 2.0 elif (x <= 1.8e+216) or not (x <= 2.3e+263): tmp = (0.0 / eps_m) / 2.0 else: tmp = (x * eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 2.0) tmp = Float64(Float64(Float64(x * Float64(-1.0 - eps_m)) + 2.0) / 2.0); elseif ((x <= 1.8e+216) || !(x <= 2.3e+263)) tmp = Float64(Float64(0.0 / eps_m) / 2.0); else tmp = Float64(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 (x <= 2.0) tmp = ((x * (-1.0 - eps_m)) + 2.0) / 2.0; elseif ((x <= 1.8e+216) || ~((x <= 2.3e+263))) tmp = (0.0 / eps_m) / 2.0; else tmp = (x * eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 2.0], N[(N[(N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 1.8e+216], N[Not[LessEqual[x, 2.3e+263]], $MachinePrecision]], N[(N[(0.0 / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x * eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2:\\
\;\;\;\;\frac{x \cdot \left(-1 - eps\_m\right) + 2}{2}\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{+216} \lor \neg \left(x \leq 2.3 \cdot 10^{+263}\right):\\
\;\;\;\;\frac{\frac{0}{eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < 2Initial program 64.0%
fma-neg64.1%
/-rgt-identity64.1%
fma-neg64.0%
/-rgt-identity64.0%
distribute-rgt-neg-in64.0%
sub-neg64.0%
metadata-eval64.0%
distribute-rgt-neg-in64.0%
Simplified64.0%
Taylor expanded in x around 0 44.1%
Taylor expanded in eps around inf 79.3%
Taylor expanded in x around 0 60.0%
mul-1-neg60.0%
unsub-neg60.0%
Simplified60.0%
if 2 < x < 1.8000000000000001e216 or 2.29999999999999997e263 < x Initial program 98.7%
Simplified98.7%
Taylor expanded in eps around 0 47.5%
Taylor expanded in x around 0 47.5%
if 1.8000000000000001e216 < x < 2.29999999999999997e263Initial 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 44.0%
Taylor expanded in eps around inf 37.3%
*-commutative37.3%
Simplified37.3%
Final simplification55.1%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.0) (* (* x eps_m) -0.5) (if (<= x 13.5) 1.0 (/ (* x eps_m) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.0) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 13.5) {
tmp = 1.0;
} else {
tmp = (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 (x <= (-1.0d0)) then
tmp = (x * eps_m) * (-0.5d0)
else if (x <= 13.5d0) then
tmp = 1.0d0
else
tmp = (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 (x <= -1.0) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 13.5) {
tmp = 1.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.0: tmp = (x * eps_m) * -0.5 elif x <= 13.5: tmp = 1.0 else: tmp = (x * eps_m) / 2.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) * -0.5); elseif (x <= 13.5) tmp = 1.0; else tmp = Float64(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 (x <= -1.0) tmp = (x * eps_m) * -0.5; elseif (x <= 13.5) tmp = 1.0; else tmp = (x * eps_m) / 2.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] * -0.5), $MachinePrecision], If[LessEqual[x, 13.5], 1.0, N[(N[(x * eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\left(x \cdot eps\_m\right) \cdot -0.5\\
\mathbf{elif}\;x \leq 13.5:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < -1Initial 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 64.5%
Taylor expanded in eps around inf 34.6%
*-commutative34.6%
Simplified34.6%
frac-2neg34.6%
div-inv34.6%
add-sqr-sqrt0.1%
sqrt-unprod0.1%
sqr-neg0.1%
sqrt-unprod0.0%
add-sqr-sqrt14.6%
metadata-eval14.6%
metadata-eval14.6%
Applied egg-rr14.6%
if -1 < x < 13.5Initial program 52.3%
fma-neg52.4%
/-rgt-identity52.4%
fma-neg52.3%
/-rgt-identity52.3%
distribute-rgt-neg-in52.3%
sub-neg52.3%
metadata-eval52.3%
distribute-rgt-neg-in52.3%
Simplified52.3%
Taylor expanded in x around 0 74.9%
if 13.5 < 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.1%
Taylor expanded in eps around inf 14.1%
*-commutative14.1%
Simplified14.1%
Final simplification44.6%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.0) (* (* x eps_m) -0.5) 1.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.0) {
tmp = (x * eps_m) * -0.5;
} else {
tmp = 1.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) * (-0.5d0)
else
tmp = 1.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) * -0.5;
} else {
tmp = 1.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.0: tmp = (x * eps_m) * -0.5 else: tmp = 1.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) * -0.5); else tmp = 1.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) * -0.5; else tmp = 1.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] * -0.5), $MachinePrecision], 1.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\left(x \cdot eps\_m\right) \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1Initial 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 64.5%
Taylor expanded in eps around inf 34.6%
*-commutative34.6%
Simplified34.6%
frac-2neg34.6%
div-inv34.6%
add-sqr-sqrt0.1%
sqrt-unprod0.1%
sqr-neg0.1%
sqrt-unprod0.0%
add-sqr-sqrt14.6%
metadata-eval14.6%
metadata-eval14.6%
Applied egg-rr14.6%
if -1 < x Initial program 71.7%
fma-neg71.8%
/-rgt-identity71.8%
fma-neg71.7%
/-rgt-identity71.7%
distribute-rgt-neg-in71.7%
sub-neg71.7%
metadata-eval71.7%
distribute-rgt-neg-in71.7%
Simplified71.7%
Taylor expanded in x around 0 45.6%
Final simplification40.8%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 1.0)
eps_m = fabs(eps);
double code(double x, double eps_m) {
return 1.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
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return 1.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return 1.0
eps_m = abs(eps) function code(x, eps_m) return 1.0 end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = 1.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := 1.0
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
1
\end{array}
Initial program 76.2%
fma-neg76.2%
/-rgt-identity76.2%
fma-neg76.2%
/-rgt-identity76.2%
distribute-rgt-neg-in76.2%
sub-neg76.2%
metadata-eval76.2%
distribute-rgt-neg-in76.2%
Simplified76.2%
Taylor expanded in x around 0 39.0%
Final simplification39.0%
herbie shell --seed 2024027
(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))