
(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 16 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 (exp (* x (+ -1.0 eps_m)))))
(if (<= x 3.8)
(/ (+ t_0 (exp (* x (- eps_m)))) 2.0)
(/ (+ t_0 (exp (- x))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * (-1.0 + eps_m)));
double tmp;
if (x <= 3.8) {
tmp = (t_0 + exp((x * -eps_m))) / 2.0;
} else {
tmp = (t_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) :: t_0
real(8) :: tmp
t_0 = exp((x * ((-1.0d0) + eps_m)))
if (x <= 3.8d0) then
tmp = (t_0 + exp((x * -eps_m))) / 2.0d0
else
tmp = (t_0 + 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 t_0 = Math.exp((x * (-1.0 + eps_m)));
double tmp;
if (x <= 3.8) {
tmp = (t_0 + Math.exp((x * -eps_m))) / 2.0;
} else {
tmp = (t_0 + Math.exp(-x)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * (-1.0 + eps_m))) tmp = 0 if x <= 3.8: tmp = (t_0 + math.exp((x * -eps_m))) / 2.0 else: tmp = (t_0 + math.exp(-x)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * Float64(-1.0 + eps_m))) tmp = 0.0 if (x <= 3.8) tmp = Float64(Float64(t_0 + exp(Float64(x * Float64(-eps_m)))) / 2.0); else tmp = Float64(Float64(t_0 + exp(Float64(-x))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp((x * (-1.0 + eps_m))); tmp = 0.0; if (x <= 3.8) tmp = (t_0 + exp((x * -eps_m))) / 2.0; else tmp = (t_0 + exp(-x)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 3.8], N[(N[(t$95$0 + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(t$95$0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(-1 + eps\_m\right)}\\
\mathbf{if}\;x \leq 3.8:\\
\;\;\;\;\frac{t\_0 + e^{x \cdot \left(-eps\_m\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 + e^{-x}}{2}\\
\end{array}
\end{array}
if x < 3.7999999999999998Initial program 65.5%
Simplified45.8%
Taylor expanded in eps around inf 98.7%
Taylor expanded in eps around inf 98.8%
*-commutative98.8%
Simplified98.8%
Taylor expanded in x around inf 98.8%
Simplified98.8%
if 3.7999999999999998 < x Initial program 98.6%
Simplified98.6%
Taylor expanded in eps around inf 98.8%
Taylor expanded in eps around 0 76.3%
neg-mul-176.3%
Simplified76.3%
Final simplification92.6%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1e-282) (/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) 2.0) (/ (+ (exp (* x (+ -1.0 eps_m))) (exp (- x))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1e-282) {
tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0;
} else {
tmp = (exp((x * (-1.0 + eps_m))) + 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 <= (-1d-282)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
else
tmp = (exp((x * ((-1.0d0) + eps_m))) + 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 <= -1e-282) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
} else {
tmp = (Math.exp((x * (-1.0 + eps_m))) + Math.exp(-x)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1e-282: tmp = (1.0 + math.exp((x * (-1.0 - eps_m)))) / 2.0 else: tmp = (math.exp((x * (-1.0 + eps_m))) + math.exp(-x)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1e-282) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(-1.0 + eps_m))) + 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 <= -1e-282) tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0; else tmp = (exp((x * (-1.0 + eps_m))) + exp(-x)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1e-282], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $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 -1 \cdot 10^{-282}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(-1 + eps\_m\right)} + e^{-x}}{2}\\
\end{array}
\end{array}
if x < -1e-282Initial program 78.6%
Simplified60.7%
Taylor expanded in eps around inf 99.2%
add-cube-cbrt99.2%
exp-prod99.2%
pow299.2%
sub-neg99.2%
metadata-eval99.2%
sub-neg99.2%
metadata-eval99.2%
Applied egg-rr99.2%
Taylor expanded in x around 0 67.9%
if -1e-282 < x Initial program 71.8%
Simplified59.9%
Taylor expanded in eps around inf 98.4%
Taylor expanded in eps around 0 81.6%
neg-mul-181.6%
Simplified81.6%
Final simplification76.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 74.6%
Simplified60.2%
Taylor expanded in eps around inf 98.8%
Final simplification98.8%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (- x))) (t_1 (/ (+ 1.0 (exp (* x (+ -1.0 eps_m)))) 2.0)))
(if (<= x -1e-282)
(/ (+ 1.0 t_0) 2.0)
(if (<= x 180.0)
t_1
(if (<= x 1.15e+184)
(/ (* x (* 2.0 t_0)) 2.0)
(if (<= x 1.1e+209)
t_1
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0)))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp(-x);
double t_1 = (1.0 + exp((x * (-1.0 + eps_m)))) / 2.0;
double tmp;
if (x <= -1e-282) {
tmp = (1.0 + t_0) / 2.0;
} else if (x <= 180.0) {
tmp = t_1;
} else if (x <= 1.15e+184) {
tmp = (x * (2.0 * t_0)) / 2.0;
} else if (x <= 1.1e+209) {
tmp = t_1;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = exp(-x)
t_1 = (1.0d0 + exp((x * ((-1.0d0) + eps_m)))) / 2.0d0
if (x <= (-1d-282)) then
tmp = (1.0d0 + t_0) / 2.0d0
else if (x <= 180.0d0) then
tmp = t_1
else if (x <= 1.15d+184) then
tmp = (x * (2.0d0 * t_0)) / 2.0d0
else if (x <= 1.1d+209) then
tmp = t_1
else
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 + ((-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 t_0 = Math.exp(-x);
double t_1 = (1.0 + Math.exp((x * (-1.0 + eps_m)))) / 2.0;
double tmp;
if (x <= -1e-282) {
tmp = (1.0 + t_0) / 2.0;
} else if (x <= 180.0) {
tmp = t_1;
} else if (x <= 1.15e+184) {
tmp = (x * (2.0 * t_0)) / 2.0;
} else if (x <= 1.1e+209) {
tmp = t_1;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp(-x) t_1 = (1.0 + math.exp((x * (-1.0 + eps_m)))) / 2.0 tmp = 0 if x <= -1e-282: tmp = (1.0 + t_0) / 2.0 elif x <= 180.0: tmp = t_1 elif x <= 1.15e+184: tmp = (x * (2.0 * t_0)) / 2.0 elif x <= 1.1e+209: tmp = t_1 else: tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(-x)) t_1 = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 + eps_m)))) / 2.0) tmp = 0.0 if (x <= -1e-282) tmp = Float64(Float64(1.0 + t_0) / 2.0); elseif (x <= 180.0) tmp = t_1; elseif (x <= 1.15e+184) tmp = Float64(Float64(x * Float64(2.0 * t_0)) / 2.0); elseif (x <= 1.1e+209) tmp = t_1; else tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp(-x); t_1 = (1.0 + exp((x * (-1.0 + eps_m)))) / 2.0; tmp = 0.0; if (x <= -1e-282) tmp = (1.0 + t_0) / 2.0; elseif (x <= 180.0) tmp = t_1; elseif (x <= 1.15e+184) tmp = (x * (2.0 * t_0)) / 2.0; elseif (x <= 1.1e+209) tmp = t_1; else tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / 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[Exp[(-x)], $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, -1e-282], N[(N[(1.0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 180.0], t$95$1, If[LessEqual[x, 1.15e+184], N[(N[(x * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.1e+209], t$95$1, 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]]]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{-x}\\
t_1 := \frac{1 + e^{x \cdot \left(-1 + eps\_m\right)}}{2}\\
\mathbf{if}\;x \leq -1 \cdot 10^{-282}:\\
\;\;\;\;\frac{1 + t\_0}{2}\\
\mathbf{elif}\;x \leq 180:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{+184}:\\
\;\;\;\;\frac{x \cdot \left(2 \cdot t\_0\right)}{2}\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{+209}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\end{array}
\end{array}
if x < -1e-282Initial program 78.6%
Simplified60.7%
Taylor expanded in eps around inf 99.2%
Taylor expanded in eps around inf 99.3%
*-commutative99.3%
Simplified99.3%
Taylor expanded in eps around 0 84.1%
if -1e-282 < x < 180 or 1.15e184 < x < 1.0999999999999999e209Initial program 53.0%
Simplified32.5%
Taylor expanded in eps around inf 98.3%
Taylor expanded in x around 0 84.0%
if 180 < x < 1.15e184Initial program 97.3%
Simplified97.3%
Taylor expanded in eps around 0 60.6%
Simplified60.6%
Taylor expanded in x around inf 58.6%
Taylor expanded in x around inf 58.6%
cancel-sign-sub-inv58.6%
neg-mul-158.6%
metadata-eval58.6%
neg-mul-158.6%
distribute-rgt1-in58.6%
metadata-eval58.6%
neg-mul-158.6%
Simplified58.6%
if 1.0999999999999999e209 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 19.7%
Taylor expanded in x around 0 72.3%
Final simplification79.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (/ (+ 1.0 (exp (* x (+ -1.0 eps_m)))) 2.0)))
(if (<= x -5e-285)
(/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) 2.0)
(if (<= x 180.0)
t_0
(if (<= x 4.7e+185)
(/ (* x (* 2.0 (exp (- x)))) 2.0)
(if (<= x 3.6e+210)
t_0
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0)))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = (1.0 + exp((x * (-1.0 + eps_m)))) / 2.0;
double tmp;
if (x <= -5e-285) {
tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 180.0) {
tmp = t_0;
} else if (x <= 4.7e+185) {
tmp = (x * (2.0 * exp(-x))) / 2.0;
} else if (x <= 3.6e+210) {
tmp = t_0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-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) :: t_0
real(8) :: tmp
t_0 = (1.0d0 + exp((x * ((-1.0d0) + eps_m)))) / 2.0d0
if (x <= (-5d-285)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
else if (x <= 180.0d0) then
tmp = t_0
else if (x <= 4.7d+185) then
tmp = (x * (2.0d0 * exp(-x))) / 2.0d0
else if (x <= 3.6d+210) then
tmp = t_0
else
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 + ((-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 t_0 = (1.0 + Math.exp((x * (-1.0 + eps_m)))) / 2.0;
double tmp;
if (x <= -5e-285) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 180.0) {
tmp = t_0;
} else if (x <= 4.7e+185) {
tmp = (x * (2.0 * Math.exp(-x))) / 2.0;
} else if (x <= 3.6e+210) {
tmp = t_0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = (1.0 + math.exp((x * (-1.0 + eps_m)))) / 2.0 tmp = 0 if x <= -5e-285: tmp = (1.0 + math.exp((x * (-1.0 - eps_m)))) / 2.0 elif x <= 180.0: tmp = t_0 elif x <= 4.7e+185: tmp = (x * (2.0 * math.exp(-x))) / 2.0 elif x <= 3.6e+210: tmp = t_0 else: tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 + eps_m)))) / 2.0) tmp = 0.0 if (x <= -5e-285) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); elseif (x <= 180.0) tmp = t_0; elseif (x <= 4.7e+185) tmp = Float64(Float64(x * Float64(2.0 * exp(Float64(-x)))) / 2.0); elseif (x <= 3.6e+210) tmp = t_0; else tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = (1.0 + exp((x * (-1.0 + eps_m)))) / 2.0; tmp = 0.0; if (x <= -5e-285) tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0; elseif (x <= 180.0) tmp = t_0; elseif (x <= 4.7e+185) tmp = (x * (2.0 * exp(-x))) / 2.0; elseif (x <= 3.6e+210) tmp = t_0; else tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / 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[(1.0 + N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, -5e-285], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 180.0], t$95$0, If[LessEqual[x, 4.7e+185], N[(N[(x * N[(2.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 3.6e+210], t$95$0, 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]]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := \frac{1 + e^{x \cdot \left(-1 + eps\_m\right)}}{2}\\
\mathbf{if}\;x \leq -5 \cdot 10^{-285}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\mathbf{elif}\;x \leq 180:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4.7 \cdot 10^{+185}:\\
\;\;\;\;\frac{x \cdot \left(2 \cdot e^{-x}\right)}{2}\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{+210}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\end{array}
\end{array}
if x < -5.00000000000000018e-285Initial program 78.6%
Simplified60.7%
Taylor expanded in eps around inf 99.2%
add-cube-cbrt99.2%
exp-prod99.2%
pow299.2%
sub-neg99.2%
metadata-eval99.2%
sub-neg99.2%
metadata-eval99.2%
Applied egg-rr99.2%
Taylor expanded in x around 0 67.9%
if -5.00000000000000018e-285 < x < 180 or 4.69999999999999972e185 < x < 3.6000000000000003e210Initial program 53.0%
Simplified32.5%
Taylor expanded in eps around inf 98.3%
Taylor expanded in x around 0 84.0%
if 180 < x < 4.69999999999999972e185Initial program 97.3%
Simplified97.3%
Taylor expanded in eps around 0 60.6%
Simplified60.6%
Taylor expanded in x around inf 58.6%
Taylor expanded in x around inf 58.6%
cancel-sign-sub-inv58.6%
neg-mul-158.6%
metadata-eval58.6%
neg-mul-158.6%
distribute-rgt1-in58.6%
metadata-eval58.6%
neg-mul-158.6%
Simplified58.6%
if 3.6000000000000003e210 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 19.7%
Taylor expanded in x around 0 72.3%
Final simplification72.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (* x (+ -1.0 eps_m)))))
(if (<= x -5e-205)
(/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) 2.0)
(if (<= x 180.0)
(/ (+ t_0 (- 1.0 (* x eps_m))) 2.0)
(if (<= x 7.5e+185)
(/ (* x (* 2.0 (exp (- x)))) 2.0)
(if (<= x 8.5e+208)
(/ (+ 1.0 t_0) 2.0)
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0)))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * (-1.0 + eps_m)));
double tmp;
if (x <= -5e-205) {
tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 180.0) {
tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0;
} else if (x <= 7.5e+185) {
tmp = (x * (2.0 * exp(-x))) / 2.0;
} else if (x <= 8.5e+208) {
tmp = (1.0 + t_0) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-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) :: t_0
real(8) :: tmp
t_0 = exp((x * ((-1.0d0) + eps_m)))
if (x <= (-5d-205)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
else if (x <= 180.0d0) then
tmp = (t_0 + (1.0d0 - (x * eps_m))) / 2.0d0
else if (x <= 7.5d+185) then
tmp = (x * (2.0d0 * exp(-x))) / 2.0d0
else if (x <= 8.5d+208) then
tmp = (1.0d0 + t_0) / 2.0d0
else
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 + ((-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 t_0 = Math.exp((x * (-1.0 + eps_m)));
double tmp;
if (x <= -5e-205) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 180.0) {
tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0;
} else if (x <= 7.5e+185) {
tmp = (x * (2.0 * Math.exp(-x))) / 2.0;
} else if (x <= 8.5e+208) {
tmp = (1.0 + t_0) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * (-1.0 + eps_m))) tmp = 0 if x <= -5e-205: tmp = (1.0 + math.exp((x * (-1.0 - eps_m)))) / 2.0 elif x <= 180.0: tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0 elif x <= 7.5e+185: tmp = (x * (2.0 * math.exp(-x))) / 2.0 elif x <= 8.5e+208: tmp = (1.0 + t_0) / 2.0 else: tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * Float64(-1.0 + eps_m))) tmp = 0.0 if (x <= -5e-205) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); elseif (x <= 180.0) tmp = Float64(Float64(t_0 + Float64(1.0 - Float64(x * eps_m))) / 2.0); elseif (x <= 7.5e+185) tmp = Float64(Float64(x * Float64(2.0 * exp(Float64(-x)))) / 2.0); elseif (x <= 8.5e+208) tmp = Float64(Float64(1.0 + t_0) / 2.0); else tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp((x * (-1.0 + eps_m))); tmp = 0.0; if (x <= -5e-205) tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0; elseif (x <= 180.0) tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0; elseif (x <= 7.5e+185) tmp = (x * (2.0 * exp(-x))) / 2.0; elseif (x <= 8.5e+208) tmp = (1.0 + t_0) / 2.0; else tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / 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[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -5e-205], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 180.0], N[(N[(t$95$0 + N[(1.0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 7.5e+185], N[(N[(x * N[(2.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 8.5e+208], N[(N[(1.0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], 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]]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(-1 + eps\_m\right)}\\
\mathbf{if}\;x \leq -5 \cdot 10^{-205}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\mathbf{elif}\;x \leq 180:\\
\;\;\;\;\frac{t\_0 + \left(1 - x \cdot eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{+185}:\\
\;\;\;\;\frac{x \cdot \left(2 \cdot e^{-x}\right)}{2}\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{+208}:\\
\;\;\;\;\frac{1 + t\_0}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\end{array}
\end{array}
if x < -5.00000000000000001e-205Initial program 80.6%
Simplified68.7%
Taylor expanded in eps around inf 99.1%
add-cube-cbrt99.1%
exp-prod99.1%
pow299.1%
sub-neg99.1%
metadata-eval99.1%
sub-neg99.1%
metadata-eval99.1%
Applied egg-rr99.1%
Taylor expanded in x around 0 64.1%
if -5.00000000000000001e-205 < x < 180Initial program 51.4%
Simplified24.3%
Taylor expanded in eps around inf 98.4%
Taylor expanded in eps around inf 98.5%
*-commutative98.5%
Simplified98.5%
Taylor expanded in x around 0 88.3%
Simplified88.3%
if 180 < x < 7.49999999999999955e185Initial program 97.3%
Simplified97.3%
Taylor expanded in eps around 0 60.6%
Simplified60.6%
Taylor expanded in x around inf 58.6%
Taylor expanded in x around inf 58.6%
cancel-sign-sub-inv58.6%
neg-mul-158.6%
metadata-eval58.6%
neg-mul-158.6%
distribute-rgt1-in58.6%
metadata-eval58.6%
neg-mul-158.6%
Simplified58.6%
if 7.49999999999999955e185 < x < 8.4999999999999992e208Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 58.5%
if 8.4999999999999992e208 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 19.7%
Taylor expanded in x around 0 72.3%
Final simplification73.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (- x))))
(if (<= x 2.1)
(/ (+ 1.0 t_0) 2.0)
(if (<= x 1.5e+188)
(/ (* x (* 2.0 t_0)) 2.0)
(if (<= x 1.12e+210)
(/ (/ (expm1 x) eps_m) 2.0)
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp(-x);
double tmp;
if (x <= 2.1) {
tmp = (1.0 + t_0) / 2.0;
} else if (x <= 1.5e+188) {
tmp = (x * (2.0 * t_0)) / 2.0;
} else if (x <= 1.12e+210) {
tmp = (expm1(x) / eps_m) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = Math.exp(-x);
double tmp;
if (x <= 2.1) {
tmp = (1.0 + t_0) / 2.0;
} else if (x <= 1.5e+188) {
tmp = (x * (2.0 * t_0)) / 2.0;
} else if (x <= 1.12e+210) {
tmp = (Math.expm1(x) / eps_m) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp(-x) tmp = 0 if x <= 2.1: tmp = (1.0 + t_0) / 2.0 elif x <= 1.5e+188: tmp = (x * (2.0 * t_0)) / 2.0 elif x <= 1.12e+210: tmp = (math.expm1(x) / eps_m) / 2.0 else: tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(-x)) tmp = 0.0 if (x <= 2.1) tmp = Float64(Float64(1.0 + t_0) / 2.0); elseif (x <= 1.5e+188) tmp = Float64(Float64(x * Float64(2.0 * t_0)) / 2.0); elseif (x <= 1.12e+210) tmp = Float64(Float64(expm1(x) / eps_m) / 2.0); else tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Exp[(-x)], $MachinePrecision]}, If[LessEqual[x, 2.1], N[(N[(1.0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.5e+188], N[(N[(x * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.12e+210], N[(N[(N[(Exp[x] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], 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]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{-x}\\
\mathbf{if}\;x \leq 2.1:\\
\;\;\;\;\frac{1 + t\_0}{2}\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{+188}:\\
\;\;\;\;\frac{x \cdot \left(2 \cdot t\_0\right)}{2}\\
\mathbf{elif}\;x \leq 1.12 \cdot 10^{+210}:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(x\right)}{eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\end{array}
\end{array}
if x < 2.10000000000000009Initial program 65.5%
Simplified45.8%
Taylor expanded in eps around inf 98.7%
Taylor expanded in eps around inf 98.8%
*-commutative98.8%
Simplified98.8%
Taylor expanded in eps around 0 80.5%
if 2.10000000000000009 < x < 1.5e188Initial program 97.3%
Simplified97.3%
Taylor expanded in eps around 0 60.6%
Simplified60.6%
Taylor expanded in x around inf 58.6%
Taylor expanded in x around inf 58.6%
cancel-sign-sub-inv58.6%
neg-mul-158.6%
metadata-eval58.6%
neg-mul-158.6%
distribute-rgt1-in58.6%
metadata-eval58.6%
neg-mul-158.6%
Simplified58.6%
if 1.5e188 < x < 1.12000000000000005e210Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 58.3%
Taylor expanded in eps around 0 1.4%
expm1-define1.4%
neg-mul-11.4%
Simplified1.4%
expm1-undefine1.4%
div-sub1.4%
add-sqr-sqrt0.0%
sqrt-unprod57.4%
sqr-neg57.4%
sqrt-unprod57.4%
add-sqr-sqrt57.4%
Applied egg-rr57.4%
div-sub57.4%
expm1-undefine57.4%
Simplified57.4%
if 1.12000000000000005e210 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 19.7%
Taylor expanded in x around 0 72.3%
Final simplification76.0%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -650.0)
(/ (/ (expm1 (- x)) eps_m) 2.0)
(if (<= x 360.0)
1.0
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -650.0) {
tmp = (expm1(-x) / eps_m) / 2.0;
} else if (x <= 360.0) {
tmp = 1.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.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 <= -650.0) {
tmp = (Math.expm1(-x) / eps_m) / 2.0;
} else if (x <= 360.0) {
tmp = 1.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -650.0: tmp = (math.expm1(-x) / eps_m) / 2.0 elif x <= 360.0: tmp = 1.0 else: tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -650.0) tmp = Float64(Float64(expm1(Float64(-x)) / eps_m) / 2.0); elseif (x <= 360.0) tmp = 1.0; else tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -650.0], N[(N[(N[(Exp[(-x)] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 360.0], 1.0, 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]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -650:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(-x\right)}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq 360:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\end{array}
\end{array}
if x < -650Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 64.6%
Taylor expanded in eps around 0 36.6%
expm1-define36.6%
neg-mul-136.6%
Simplified36.6%
if -650 < x < 360Initial program 55.4%
Simplified55.4%
Taylor expanded in x around 0 75.0%
if 360 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 19.5%
Taylor expanded in x around 0 56.5%
Final simplification63.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 360.0) (/ (+ 1.0 (exp (- x))) 2.0) (/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 360.0) {
tmp = (1.0 + exp(-x)) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-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 <= 360.0d0) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 + ((-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 <= 360.0) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 360.0: tmp = (1.0 + math.exp(-x)) / 2.0 else: tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 360.0) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); else tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + 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 <= 360.0) tmp = (1.0 + exp(-x)) / 2.0; else tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-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, 360.0], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 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]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 360:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\end{array}
\end{array}
if x < 360Initial program 65.2%
Simplified45.5%
Taylor expanded in eps around inf 98.3%
Taylor expanded in eps around inf 98.3%
*-commutative98.3%
Simplified98.3%
Taylor expanded in eps around 0 80.1%
if 360 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 19.5%
Taylor expanded in x around 0 56.5%
Final simplification73.8%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -0.48)
(/ (* x (- -1.0 eps_m)) 2.0)
(if (<= x 360.0)
1.0
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -0.48) {
tmp = (x * (-1.0 - eps_m)) / 2.0;
} else if (x <= 360.0) {
tmp = 1.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-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 <= (-0.48d0)) then
tmp = (x * ((-1.0d0) - eps_m)) / 2.0d0
else if (x <= 360.0d0) then
tmp = 1.0d0
else
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 + ((-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 <= -0.48) {
tmp = (x * (-1.0 - eps_m)) / 2.0;
} else if (x <= 360.0) {
tmp = 1.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -0.48: tmp = (x * (-1.0 - eps_m)) / 2.0 elif x <= 360.0: tmp = 1.0 else: tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -0.48) tmp = Float64(Float64(x * Float64(-1.0 - eps_m)) / 2.0); elseif (x <= 360.0) tmp = 1.0; else tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + 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 <= -0.48) tmp = (x * (-1.0 - eps_m)) / 2.0; elseif (x <= 360.0) tmp = 1.0; else tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-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, -0.48], N[(N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 360.0], 1.0, 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]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.48:\\
\;\;\;\;\frac{x \cdot \left(-1 - eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 360:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\end{array}
\end{array}
if x < -0.47999999999999998Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 49.0%
neg-mul-149.0%
distribute-rgt-neg-in49.0%
Simplified49.0%
Taylor expanded in x around inf 15.7%
mul-1-neg15.7%
+-commutative15.7%
distribute-rgt-neg-in15.7%
+-commutative15.7%
distribute-neg-in15.7%
metadata-eval15.7%
unsub-neg15.7%
Simplified15.7%
if -0.47999999999999998 < x < 360Initial program 55.1%
Simplified55.1%
Taylor expanded in x around 0 75.5%
if 360 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 19.5%
Taylor expanded in x around 0 56.5%
Final simplification60.6%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -0.52) (/ (* x (- -1.0 eps_m)) 2.0) (if (<= x 360.0) 1.0 (/ (+ (/ 1.0 eps_m) (+ 1.0 (/ -1.0 eps_m))) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -0.52) {
tmp = (x * (-1.0 - eps_m)) / 2.0;
} else if (x <= 360.0) {
tmp = 1.0;
} else {
tmp = ((1.0 / eps_m) + (1.0 + (-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 <= (-0.52d0)) then
tmp = (x * ((-1.0d0) - eps_m)) / 2.0d0
else if (x <= 360.0d0) then
tmp = 1.0d0
else
tmp = ((1.0d0 / eps_m) + (1.0d0 + ((-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 <= -0.52) {
tmp = (x * (-1.0 - eps_m)) / 2.0;
} else if (x <= 360.0) {
tmp = 1.0;
} else {
tmp = ((1.0 / eps_m) + (1.0 + (-1.0 / eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -0.52: tmp = (x * (-1.0 - eps_m)) / 2.0 elif x <= 360.0: tmp = 1.0 else: tmp = ((1.0 / eps_m) + (1.0 + (-1.0 / eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -0.52) tmp = Float64(Float64(x * Float64(-1.0 - eps_m)) / 2.0); elseif (x <= 360.0) tmp = 1.0; else tmp = Float64(Float64(Float64(1.0 / eps_m) + Float64(1.0 + 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 <= -0.52) tmp = (x * (-1.0 - eps_m)) / 2.0; elseif (x <= 360.0) tmp = 1.0; else tmp = ((1.0 / eps_m) + (1.0 + (-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, -0.52], N[(N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 360.0], 1.0, N[(N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.52:\\
\;\;\;\;\frac{x \cdot \left(-1 - eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 360:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{eps\_m} + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\end{array}
\end{array}
if x < -0.52000000000000002Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 49.0%
neg-mul-149.0%
distribute-rgt-neg-in49.0%
Simplified49.0%
Taylor expanded in x around inf 15.7%
mul-1-neg15.7%
+-commutative15.7%
distribute-rgt-neg-in15.7%
+-commutative15.7%
distribute-neg-in15.7%
metadata-eval15.7%
unsub-neg15.7%
Simplified15.7%
if -0.52000000000000002 < x < 360Initial program 55.1%
Simplified55.1%
Taylor expanded in x around 0 75.5%
if 360 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 19.5%
Taylor expanded in x around 0 56.5%
Taylor expanded in eps around 0 56.5%
Final simplification60.6%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.0) (/ (* x (- eps_m)) 2.0) (if (<= x 185.0) 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) / 2.0;
} else if (x <= 185.0) {
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) / 2.0d0
else if (x <= 185.0d0) 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) / 2.0;
} else if (x <= 185.0) {
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) / 2.0 elif x <= 185.0: 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 * Float64(-eps_m)) / 2.0); elseif (x <= 185.0) 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) / 2.0; elseif (x <= 185.0) 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] / 2.0), $MachinePrecision], If[LessEqual[x, 185.0], 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:\\
\;\;\;\;\frac{x \cdot \left(-eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 185:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\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 49.0%
neg-mul-149.0%
distribute-rgt-neg-in49.0%
Simplified49.0%
Taylor expanded in eps around inf 15.7%
mul-1-neg15.7%
*-commutative15.7%
distribute-rgt-neg-in15.7%
Simplified15.7%
if -1 < x < 185Initial program 55.1%
Simplified55.1%
Taylor expanded in x around 0 75.5%
if 185 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 22.2%
Taylor expanded in x around inf 9.2%
neg-mul-19.2%
distribute-rgt-neg-in9.2%
*-commutative9.2%
distribute-rgt-neg-in9.2%
mul-1-neg9.2%
distribute-rgt-in9.2%
metadata-eval9.2%
associate-*l/9.2%
metadata-eval9.2%
Simplified9.2%
Taylor expanded in eps around inf 9.9%
*-commutative9.9%
Simplified9.9%
Final simplification48.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -0.52) (/ (* x (- -1.0 eps_m)) 2.0) (if (<= x 185.0) 1.0 (/ (* x eps_m) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -0.52) {
tmp = (x * (-1.0 - eps_m)) / 2.0;
} else if (x <= 185.0) {
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 <= (-0.52d0)) then
tmp = (x * ((-1.0d0) - eps_m)) / 2.0d0
else if (x <= 185.0d0) 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 <= -0.52) {
tmp = (x * (-1.0 - eps_m)) / 2.0;
} else if (x <= 185.0) {
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 <= -0.52: tmp = (x * (-1.0 - eps_m)) / 2.0 elif x <= 185.0: 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 <= -0.52) tmp = Float64(Float64(x * Float64(-1.0 - eps_m)) / 2.0); elseif (x <= 185.0) 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 <= -0.52) tmp = (x * (-1.0 - eps_m)) / 2.0; elseif (x <= 185.0) 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, -0.52], N[(N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 185.0], 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 -0.52:\\
\;\;\;\;\frac{x \cdot \left(-1 - eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 185:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < -0.52000000000000002Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 49.0%
neg-mul-149.0%
distribute-rgt-neg-in49.0%
Simplified49.0%
Taylor expanded in x around inf 15.7%
mul-1-neg15.7%
+-commutative15.7%
distribute-rgt-neg-in15.7%
+-commutative15.7%
distribute-neg-in15.7%
metadata-eval15.7%
unsub-neg15.7%
Simplified15.7%
if -0.52000000000000002 < x < 185Initial program 55.1%
Simplified55.1%
Taylor expanded in x around 0 75.5%
if 185 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 22.2%
Taylor expanded in x around inf 9.2%
neg-mul-19.2%
distribute-rgt-neg-in9.2%
*-commutative9.2%
distribute-rgt-neg-in9.2%
mul-1-neg9.2%
distribute-rgt-in9.2%
metadata-eval9.2%
associate-*l/9.2%
metadata-eval9.2%
Simplified9.2%
Taylor expanded in eps around inf 9.9%
*-commutative9.9%
Simplified9.9%
Final simplification48.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -3.6e-12) (/ (* x (- -1.0 eps_m)) 2.0) (/ (+ (* x (+ -1.0 eps_m)) 2.0) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -3.6e-12) {
tmp = (x * (-1.0 - eps_m)) / 2.0;
} else {
tmp = ((x * (-1.0 + eps_m)) + 2.0) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-3.6d-12)) then
tmp = (x * ((-1.0d0) - eps_m)) / 2.0d0
else
tmp = ((x * ((-1.0d0) + eps_m)) + 2.0d0) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -3.6e-12) {
tmp = (x * (-1.0 - eps_m)) / 2.0;
} else {
tmp = ((x * (-1.0 + eps_m)) + 2.0) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -3.6e-12: tmp = (x * (-1.0 - eps_m)) / 2.0 else: tmp = ((x * (-1.0 + eps_m)) + 2.0) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -3.6e-12) tmp = Float64(Float64(x * Float64(-1.0 - eps_m)) / 2.0); else tmp = Float64(Float64(Float64(x * Float64(-1.0 + eps_m)) + 2.0) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -3.6e-12) tmp = (x * (-1.0 - eps_m)) / 2.0; else tmp = ((x * (-1.0 + eps_m)) + 2.0) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -3.6e-12], N[(N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{-12}:\\
\;\;\;\;\frac{x \cdot \left(-1 - eps\_m\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(-1 + eps\_m\right) + 2}{2}\\
\end{array}
\end{array}
if x < -3.6e-12Initial program 97.9%
Simplified98.0%
Taylor expanded in eps around inf 98.3%
Taylor expanded in x around 0 45.6%
neg-mul-145.6%
distribute-rgt-neg-in45.6%
Simplified45.6%
Taylor expanded in x around inf 15.0%
mul-1-neg15.0%
+-commutative15.0%
distribute-rgt-neg-in15.0%
+-commutative15.0%
distribute-neg-in15.0%
metadata-eval15.0%
unsub-neg15.0%
Simplified15.0%
if -3.6e-12 < x Initial program 69.5%
Simplified51.9%
Taylor expanded in eps around inf 98.9%
Taylor expanded in x around 0 63.9%
Taylor expanded in x around 0 53.8%
Final simplification46.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 185.0) 1.0 (/ (* x eps_m) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 185.0) {
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 <= 185.0d0) 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 <= 185.0) {
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 <= 185.0: 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 <= 185.0) 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 <= 185.0) 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, 185.0], 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 185:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < 185Initial program 65.2%
Simplified65.2%
Taylor expanded in x around 0 59.3%
if 185 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 22.2%
Taylor expanded in x around inf 9.2%
neg-mul-19.2%
distribute-rgt-neg-in9.2%
*-commutative9.2%
distribute-rgt-neg-in9.2%
mul-1-neg9.2%
distribute-rgt-in9.2%
metadata-eval9.2%
associate-*l/9.2%
metadata-eval9.2%
Simplified9.2%
Taylor expanded in eps around inf 9.9%
*-commutative9.9%
Simplified9.9%
Final simplification45.9%
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 74.6%
Simplified74.6%
Taylor expanded in x around 0 44.1%
Final simplification44.1%
herbie shell --seed 2024041
(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))