
(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 (+ eps_m -1.0))))) (if (<= x 1.75) (/ (+ t_0 (/ 1.0 t_0)) 2.0) (/ t_0 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * (eps_m + -1.0)));
double tmp;
if (x <= 1.75) {
tmp = (t_0 + (1.0 / t_0)) / 2.0;
} else {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = exp((x * (eps_m + (-1.0d0))))
if (x <= 1.75d0) then
tmp = (t_0 + (1.0d0 / t_0)) / 2.0d0
else
tmp = t_0 / 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 * (eps_m + -1.0)));
double tmp;
if (x <= 1.75) {
tmp = (t_0 + (1.0 / t_0)) / 2.0;
} else {
tmp = t_0 / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * (eps_m + -1.0))) tmp = 0 if x <= 1.75: tmp = (t_0 + (1.0 / t_0)) / 2.0 else: tmp = t_0 / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * Float64(eps_m + -1.0))) tmp = 0.0 if (x <= 1.75) tmp = Float64(Float64(t_0 + Float64(1.0 / t_0)) / 2.0); else tmp = Float64(t_0 / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp((x * (eps_m + -1.0))); tmp = 0.0; if (x <= 1.75) tmp = (t_0 + (1.0 / t_0)) / 2.0; else tmp = t_0 / 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[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 1.75], N[(N[(t$95$0 + N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(t$95$0 / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(eps\_m + -1\right)}\\
\mathbf{if}\;x \leq 1.75:\\
\;\;\;\;\frac{t\_0 + \frac{1}{t\_0}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{2}\\
\end{array}
\end{array}
if x < 1.75Initial program 59.4%
Simplified52.6%
Taylor expanded in eps around inf 98.7%
+-commutative98.7%
add-sqr-sqrt37.3%
sqrt-unprod95.5%
sqr-neg95.5%
sqrt-unprod61.4%
add-sqr-sqrt99.2%
neg-mul-199.2%
distribute-rgt-in99.2%
metadata-eval99.2%
sub-neg99.2%
*-commutative99.2%
sub-neg99.2%
metadata-eval99.2%
Applied egg-rr99.2%
if 1.75 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 28.2%
Taylor expanded in x around inf 76.8%
Final simplification92.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (let* ((t_0 (exp (* x (+ eps_m -1.0))))) (if (<= x 4.7) (/ (+ t_0 (/ 1.0 (pow E (* x eps_m)))) 2.0) (/ t_0 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * (eps_m + -1.0)));
double tmp;
if (x <= 4.7) {
tmp = (t_0 + (1.0 / pow(((double) M_E), (x * eps_m)))) / 2.0;
} else {
tmp = t_0 / 2.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = Math.exp((x * (eps_m + -1.0)));
double tmp;
if (x <= 4.7) {
tmp = (t_0 + (1.0 / Math.pow(Math.E, (x * eps_m)))) / 2.0;
} else {
tmp = t_0 / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * (eps_m + -1.0))) tmp = 0 if x <= 4.7: tmp = (t_0 + (1.0 / math.pow(math.e, (x * eps_m)))) / 2.0 else: tmp = t_0 / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * Float64(eps_m + -1.0))) tmp = 0.0 if (x <= 4.7) tmp = Float64(Float64(t_0 + Float64(1.0 / (exp(1) ^ Float64(x * eps_m)))) / 2.0); else tmp = Float64(t_0 / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp((x * (eps_m + -1.0))); tmp = 0.0; if (x <= 4.7) tmp = (t_0 + (1.0 / (2.71828182845904523536 ^ (x * eps_m)))) / 2.0; else tmp = t_0 / 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[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 4.7], N[(N[(t$95$0 + N[(1.0 / N[Power[E, N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(t$95$0 / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(eps\_m + -1\right)}\\
\mathbf{if}\;x \leq 4.7:\\
\;\;\;\;\frac{t\_0 + \frac{1}{{e}^{\left(x \cdot eps\_m\right)}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{2}\\
\end{array}
\end{array}
if x < 4.70000000000000018Initial program 59.4%
Simplified52.6%
Taylor expanded in eps around inf 98.7%
Taylor expanded in eps around inf 98.8%
*-commutative98.8%
Simplified98.8%
*-commutative98.8%
*-un-lft-identity98.8%
exp-prod98.8%
*-commutative98.8%
Applied egg-rr98.8%
exp-1-e98.8%
*-commutative98.8%
Simplified98.8%
if 4.70000000000000018 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 28.2%
Taylor expanded in x around inf 76.8%
Final simplification92.6%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (let* ((t_0 (exp (* x (+ eps_m -1.0))))) (if (<= x 4.7) (/ (+ t_0 (/ 1.0 (exp (* x eps_m)))) 2.0) (/ t_0 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * (eps_m + -1.0)));
double tmp;
if (x <= 4.7) {
tmp = (t_0 + (1.0 / exp((x * eps_m)))) / 2.0;
} else {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = exp((x * (eps_m + (-1.0d0))))
if (x <= 4.7d0) then
tmp = (t_0 + (1.0d0 / exp((x * eps_m)))) / 2.0d0
else
tmp = t_0 / 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 * (eps_m + -1.0)));
double tmp;
if (x <= 4.7) {
tmp = (t_0 + (1.0 / Math.exp((x * eps_m)))) / 2.0;
} else {
tmp = t_0 / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * (eps_m + -1.0))) tmp = 0 if x <= 4.7: tmp = (t_0 + (1.0 / math.exp((x * eps_m)))) / 2.0 else: tmp = t_0 / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * Float64(eps_m + -1.0))) tmp = 0.0 if (x <= 4.7) tmp = Float64(Float64(t_0 + Float64(1.0 / exp(Float64(x * eps_m)))) / 2.0); else tmp = Float64(t_0 / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp((x * (eps_m + -1.0))); tmp = 0.0; if (x <= 4.7) tmp = (t_0 + (1.0 / exp((x * eps_m)))) / 2.0; else tmp = t_0 / 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[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 4.7], N[(N[(t$95$0 + N[(1.0 / N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(t$95$0 / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(eps\_m + -1\right)}\\
\mathbf{if}\;x \leq 4.7:\\
\;\;\;\;\frac{t\_0 + \frac{1}{e^{x \cdot eps\_m}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{2}\\
\end{array}
\end{array}
if x < 4.70000000000000018Initial program 59.4%
Simplified52.6%
Taylor expanded in eps around inf 98.7%
Taylor expanded in eps around inf 98.8%
*-commutative98.8%
Simplified98.8%
if 4.70000000000000018 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 28.2%
Taylor expanded in x around inf 76.8%
Final simplification92.6%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (let* ((t_0 (exp (* x (+ eps_m -1.0))))) (if (<= x 4.7) (/ (+ t_0 (pow E (* eps_m (- x)))) 2.0) (/ t_0 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * (eps_m + -1.0)));
double tmp;
if (x <= 4.7) {
tmp = (t_0 + pow(((double) M_E), (eps_m * -x))) / 2.0;
} else {
tmp = t_0 / 2.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = Math.exp((x * (eps_m + -1.0)));
double tmp;
if (x <= 4.7) {
tmp = (t_0 + Math.pow(Math.E, (eps_m * -x))) / 2.0;
} else {
tmp = t_0 / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * (eps_m + -1.0))) tmp = 0 if x <= 4.7: tmp = (t_0 + math.pow(math.e, (eps_m * -x))) / 2.0 else: tmp = t_0 / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * Float64(eps_m + -1.0))) tmp = 0.0 if (x <= 4.7) tmp = Float64(Float64(t_0 + (exp(1) ^ Float64(eps_m * Float64(-x)))) / 2.0); else tmp = Float64(t_0 / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp((x * (eps_m + -1.0))); tmp = 0.0; if (x <= 4.7) tmp = (t_0 + (2.71828182845904523536 ^ (eps_m * -x))) / 2.0; else tmp = t_0 / 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[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 4.7], N[(N[(t$95$0 + N[Power[E, N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(t$95$0 / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(eps\_m + -1\right)}\\
\mathbf{if}\;x \leq 4.7:\\
\;\;\;\;\frac{t\_0 + {e}^{\left(eps\_m \cdot \left(-x\right)\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{2}\\
\end{array}
\end{array}
if x < 4.70000000000000018Initial program 59.4%
Simplified52.6%
Taylor expanded in eps around inf 98.7%
Taylor expanded in eps around inf 98.8%
*-commutative98.8%
Simplified98.8%
*-commutative98.8%
*-un-lft-identity98.8%
exp-prod98.8%
*-commutative98.8%
Applied egg-rr98.8%
exp-1-e98.8%
*-commutative98.8%
Simplified98.8%
inv-pow98.8%
pow-pow98.8%
Applied egg-rr98.8%
*-commutative98.8%
mul-1-neg98.8%
*-commutative98.8%
distribute-rgt-neg-in98.8%
Simplified98.8%
if 4.70000000000000018 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 28.2%
Taylor expanded in x around inf 76.8%
Final simplification92.6%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (let* ((t_0 (exp (* x (+ eps_m -1.0))))) (if (<= x 4.7) (/ (+ t_0 (exp (* eps_m (- x)))) 2.0) (/ t_0 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * (eps_m + -1.0)));
double tmp;
if (x <= 4.7) {
tmp = (t_0 + exp((eps_m * -x))) / 2.0;
} else {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = exp((x * (eps_m + (-1.0d0))))
if (x <= 4.7d0) then
tmp = (t_0 + exp((eps_m * -x))) / 2.0d0
else
tmp = t_0 / 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 * (eps_m + -1.0)));
double tmp;
if (x <= 4.7) {
tmp = (t_0 + Math.exp((eps_m * -x))) / 2.0;
} else {
tmp = t_0 / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * (eps_m + -1.0))) tmp = 0 if x <= 4.7: tmp = (t_0 + math.exp((eps_m * -x))) / 2.0 else: tmp = t_0 / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * Float64(eps_m + -1.0))) tmp = 0.0 if (x <= 4.7) tmp = Float64(Float64(t_0 + exp(Float64(eps_m * Float64(-x)))) / 2.0); else tmp = Float64(t_0 / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp((x * (eps_m + -1.0))); tmp = 0.0; if (x <= 4.7) tmp = (t_0 + exp((eps_m * -x))) / 2.0; else tmp = t_0 / 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[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 4.7], N[(N[(t$95$0 + N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(t$95$0 / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(eps\_m + -1\right)}\\
\mathbf{if}\;x \leq 4.7:\\
\;\;\;\;\frac{t\_0 + e^{eps\_m \cdot \left(-x\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{2}\\
\end{array}
\end{array}
if x < 4.70000000000000018Initial program 59.4%
Simplified52.6%
Taylor expanded in eps around inf 98.7%
Taylor expanded in eps around inf 98.8%
*-commutative98.8%
Simplified98.8%
rec-exp98.8%
distribute-rgt-neg-in98.8%
Applied egg-rr98.8%
if 4.70000000000000018 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 28.2%
Taylor expanded in x around inf 76.8%
Final simplification92.6%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* x (+ eps_m -1.0))) (/ 1.0 (exp (+ x (* x eps_m))))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * (eps_m + -1.0))) + (1.0 / exp((x + (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 + (-1.0d0)))) + (1.0d0 / exp((x + (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 + -1.0))) + (1.0 / Math.exp((x + (x * eps_m))))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.exp((x * (eps_m + -1.0))) + (1.0 / math.exp((x + (x * eps_m))))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + Float64(1.0 / exp(Float64(x + Float64(x * eps_m))))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((x * (eps_m + -1.0))) + (1.0 / exp((x + (x * eps_m))))) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[Exp[N[(x + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\frac{e^{x \cdot \left(eps\_m + -1\right)} + \frac{1}{e^{x + x \cdot eps\_m}}}{2}
\end{array}
Initial program 70.8%
Simplified65.9%
Taylor expanded in eps around inf 99.1%
Final simplification99.1%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (* x (+ eps_m -1.0)))))
(if (<= x -3.3e-249)
(/ (+ 1.0 (/ 1.0 (pow E (* x eps_m)))) 2.0)
(if (<= x 8.0)
(/ (+ t_0 (/ 1.0 (+ 1.0 (* x (+ eps_m 1.0))))) 2.0)
(/ t_0 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * (eps_m + -1.0)));
double tmp;
if (x <= -3.3e-249) {
tmp = (1.0 + (1.0 / pow(((double) M_E), (x * eps_m)))) / 2.0;
} else if (x <= 8.0) {
tmp = (t_0 + (1.0 / (1.0 + (x * (eps_m + 1.0))))) / 2.0;
} else {
tmp = t_0 / 2.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = Math.exp((x * (eps_m + -1.0)));
double tmp;
if (x <= -3.3e-249) {
tmp = (1.0 + (1.0 / Math.pow(Math.E, (x * eps_m)))) / 2.0;
} else if (x <= 8.0) {
tmp = (t_0 + (1.0 / (1.0 + (x * (eps_m + 1.0))))) / 2.0;
} else {
tmp = t_0 / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * (eps_m + -1.0))) tmp = 0 if x <= -3.3e-249: tmp = (1.0 + (1.0 / math.pow(math.e, (x * eps_m)))) / 2.0 elif x <= 8.0: tmp = (t_0 + (1.0 / (1.0 + (x * (eps_m + 1.0))))) / 2.0 else: tmp = t_0 / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * Float64(eps_m + -1.0))) tmp = 0.0 if (x <= -3.3e-249) tmp = Float64(Float64(1.0 + Float64(1.0 / (exp(1) ^ Float64(x * eps_m)))) / 2.0); elseif (x <= 8.0) tmp = Float64(Float64(t_0 + Float64(1.0 / Float64(1.0 + Float64(x * Float64(eps_m + 1.0))))) / 2.0); else tmp = Float64(t_0 / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp((x * (eps_m + -1.0))); tmp = 0.0; if (x <= -3.3e-249) tmp = (1.0 + (1.0 / (2.71828182845904523536 ^ (x * eps_m)))) / 2.0; elseif (x <= 8.0) tmp = (t_0 + (1.0 / (1.0 + (x * (eps_m + 1.0))))) / 2.0; else tmp = t_0 / 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[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -3.3e-249], N[(N[(1.0 + N[(1.0 / N[Power[E, N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 8.0], N[(N[(t$95$0 + N[(1.0 / N[(1.0 + N[(x * N[(eps$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(t$95$0 / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(eps\_m + -1\right)}\\
\mathbf{if}\;x \leq -3.3 \cdot 10^{-249}:\\
\;\;\;\;\frac{1 + \frac{1}{{e}^{\left(x \cdot eps\_m\right)}}}{2}\\
\mathbf{elif}\;x \leq 8:\\
\;\;\;\;\frac{t\_0 + \frac{1}{1 + x \cdot \left(eps\_m + 1\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{2}\\
\end{array}
\end{array}
if x < -3.3e-249Initial program 67.7%
Simplified60.2%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
*-commutative100.0%
*-un-lft-identity100.0%
exp-prod100.0%
*-commutative100.0%
Applied egg-rr100.0%
exp-1-e100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 72.0%
if -3.3e-249 < x < 8Initial program 49.8%
Simplified43.7%
Taylor expanded in eps around inf 97.3%
Taylor expanded in x around 0 84.5%
if 8 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 28.2%
Taylor expanded in x around inf 76.8%
Final simplification77.5%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 124.0)
(/ (- 2.0 (* x eps_m)) 2.0)
(if (or (<= x 1.55e+91) (not (<= x 3.1e+130)))
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0)
(/ (+ 1.0 (exp x)) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 124.0) {
tmp = (2.0 - (x * eps_m)) / 2.0;
} else if ((x <= 1.55e+91) || !(x <= 3.1e+130)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (1.0 + exp(x)) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 124.0d0) then
tmp = (2.0d0 - (x * eps_m)) / 2.0d0
else if ((x <= 1.55d+91) .or. (.not. (x <= 3.1d+130))) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 + ((-1.0d0) / eps_m))) / 2.0d0
else
tmp = (1.0d0 + exp(x)) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 124.0) {
tmp = (2.0 - (x * eps_m)) / 2.0;
} else if ((x <= 1.55e+91) || !(x <= 3.1e+130)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (1.0 + Math.exp(x)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 124.0: tmp = (2.0 - (x * eps_m)) / 2.0 elif (x <= 1.55e+91) or not (x <= 3.1e+130): tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 else: tmp = (1.0 + math.exp(x)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 124.0) tmp = Float64(Float64(2.0 - Float64(x * eps_m)) / 2.0); elseif ((x <= 1.55e+91) || !(x <= 3.1e+130)) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(1.0 + exp(x)) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 124.0) tmp = (2.0 - (x * eps_m)) / 2.0; elseif ((x <= 1.55e+91) || ~((x <= 3.1e+130))) tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0; else tmp = (1.0 + exp(x)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 124.0], N[(N[(2.0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 1.55e+91], N[Not[LessEqual[x, 3.1e+130]], $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], N[(N[(1.0 + N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 124:\\
\;\;\;\;\frac{2 - x \cdot eps\_m}{2}\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{+91} \lor \neg \left(x \leq 3.1 \cdot 10^{+130}\right):\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x}}{2}\\
\end{array}
\end{array}
if x < 124Initial program 59.4%
Simplified59.4%
Taylor expanded in x around 0 41.3%
Taylor expanded in x around 0 44.2%
Taylor expanded in eps around inf 66.0%
associate-*r*66.0%
neg-mul-166.0%
*-commutative66.0%
Simplified66.0%
if 124 < x < 1.54999999999999999e91 or 3.1e130 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 22.3%
Taylor expanded in x around 0 62.2%
if 1.54999999999999999e91 < x < 3.1e130Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 92.5%
*-commutative92.5%
Simplified92.5%
Taylor expanded in eps around 0 3.1%
mul-1-neg3.1%
Simplified3.1%
*-un-lft-identity3.1%
add-sqr-sqrt0.0%
sqrt-unprod92.4%
sqr-neg92.4%
sqrt-unprod92.4%
add-sqr-sqrt92.4%
Applied egg-rr92.4%
*-lft-identity92.4%
Simplified92.4%
Final simplification66.4%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 360.0)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (or (<= x 2.2e+91) (not (<= x 2.8e+133)))
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0)
(/ (+ 1.0 (exp x)) 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 if ((x <= 2.2e+91) || !(x <= 2.8e+133)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (1.0 + exp(x)) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 360.0d0) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if ((x <= 2.2d+91) .or. (.not. (x <= 2.8d+133))) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 + ((-1.0d0) / eps_m))) / 2.0d0
else
tmp = (1.0d0 + exp(x)) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 360.0) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if ((x <= 2.2e+91) || !(x <= 2.8e+133)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (1.0 + Math.exp(x)) / 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 elif (x <= 2.2e+91) or not (x <= 2.8e+133): tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 else: tmp = (1.0 + math.exp(x)) / 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); elseif ((x <= 2.2e+91) || !(x <= 2.8e+133)) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(1.0 + exp(x)) / 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; elseif ((x <= 2.2e+91) || ~((x <= 2.8e+133))) tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0; else tmp = (1.0 + exp(x)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 360.0], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 2.2e+91], N[Not[LessEqual[x, 2.8e+133]], $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], N[(N[(1.0 + N[Exp[x], $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{elif}\;x \leq 2.2 \cdot 10^{+91} \lor \neg \left(x \leq 2.8 \cdot 10^{+133}\right):\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x}}{2}\\
\end{array}
\end{array}
if x < 360Initial program 59.4%
Simplified52.6%
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 79.9%
mul-1-neg79.9%
Simplified79.9%
if 360 < x < 2.19999999999999999e91 or 2.80000000000000016e133 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 22.3%
Taylor expanded in x around 0 62.2%
if 2.19999999999999999e91 < x < 2.80000000000000016e133Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 92.5%
*-commutative92.5%
Simplified92.5%
Taylor expanded in eps around 0 3.1%
mul-1-neg3.1%
Simplified3.1%
*-un-lft-identity3.1%
add-sqr-sqrt0.0%
sqrt-unprod92.4%
sqr-neg92.4%
sqrt-unprod92.4%
add-sqr-sqrt92.4%
Applied egg-rr92.4%
*-lft-identity92.4%
Simplified92.4%
Final simplification76.5%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 1e-52) (/ (+ 1.0 (/ 1.0 (pow E (* x eps_m)))) 2.0) (/ (exp (* x (+ eps_m -1.0))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1e-52) {
tmp = (1.0 + (1.0 / pow(((double) M_E), (x * eps_m)))) / 2.0;
} else {
tmp = exp((x * (eps_m + -1.0))) / 2.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 1e-52) {
tmp = (1.0 + (1.0 / Math.pow(Math.E, (x * eps_m)))) / 2.0;
} else {
tmp = Math.exp((x * (eps_m + -1.0))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1e-52: tmp = (1.0 + (1.0 / math.pow(math.e, (x * eps_m)))) / 2.0 else: tmp = math.exp((x * (eps_m + -1.0))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1e-52) tmp = Float64(Float64(1.0 + Float64(1.0 / (exp(1) ^ Float64(x * eps_m)))) / 2.0); else tmp = Float64(exp(Float64(x * Float64(eps_m + -1.0))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 1e-52) tmp = (1.0 + (1.0 / (2.71828182845904523536 ^ (x * eps_m)))) / 2.0; else tmp = exp((x * (eps_m + -1.0))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 1e-52], N[(N[(1.0 + N[(1.0 / N[Power[E, N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 10^{-52}:\\
\;\;\;\;\frac{1 + \frac{1}{{e}^{\left(x \cdot eps\_m\right)}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\end{array}
\end{array}
if x < 1e-52Initial program 59.5%
Simplified53.3%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
*-commutative100.0%
*-un-lft-identity100.0%
exp-prod100.0%
*-commutative100.0%
Applied egg-rr100.0%
exp-1-e100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 81.8%
if 1e-52 < x Initial program 93.2%
Simplified91.0%
Taylor expanded in eps around inf 97.3%
Taylor expanded in x around 0 31.5%
Taylor expanded in x around inf 68.2%
Final simplification77.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 9.8e-53) (/ (+ 1.0 (/ 1.0 (exp (* x eps_m)))) 2.0) (/ (exp (* x (+ eps_m -1.0))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 9.8e-53) {
tmp = (1.0 + (1.0 / exp((x * eps_m)))) / 2.0;
} else {
tmp = exp((x * (eps_m + -1.0))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 9.8d-53) then
tmp = (1.0d0 + (1.0d0 / exp((x * eps_m)))) / 2.0d0
else
tmp = exp((x * (eps_m + (-1.0d0)))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 9.8e-53) {
tmp = (1.0 + (1.0 / Math.exp((x * eps_m)))) / 2.0;
} else {
tmp = Math.exp((x * (eps_m + -1.0))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 9.8e-53: tmp = (1.0 + (1.0 / math.exp((x * eps_m)))) / 2.0 else: tmp = math.exp((x * (eps_m + -1.0))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 9.8e-53) tmp = Float64(Float64(1.0 + Float64(1.0 / exp(Float64(x * eps_m)))) / 2.0); else tmp = Float64(exp(Float64(x * Float64(eps_m + -1.0))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 9.8e-53) tmp = (1.0 + (1.0 / exp((x * eps_m)))) / 2.0; else tmp = exp((x * (eps_m + -1.0))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 9.8e-53], N[(N[(1.0 + N[(1.0 / N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 9.8 \cdot 10^{-53}:\\
\;\;\;\;\frac{1 + \frac{1}{e^{x \cdot eps\_m}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\end{array}
\end{array}
if x < 9.79999999999999926e-53Initial program 59.5%
Simplified53.3%
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 0 81.8%
if 9.79999999999999926e-53 < x Initial program 93.2%
Simplified91.0%
Taylor expanded in eps around inf 97.3%
Taylor expanded in x around 0 31.5%
Taylor expanded in x around inf 68.2%
Final simplification77.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 9.2e-54) (/ (+ 1.0 (exp (- x))) 2.0) (/ (exp (* x (+ eps_m -1.0))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 9.2e-54) {
tmp = (1.0 + exp(-x)) / 2.0;
} else {
tmp = exp((x * (eps_m + -1.0))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 9.2d-54) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else
tmp = exp((x * (eps_m + (-1.0d0)))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 9.2e-54) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else {
tmp = Math.exp((x * (eps_m + -1.0))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 9.2e-54: tmp = (1.0 + math.exp(-x)) / 2.0 else: tmp = math.exp((x * (eps_m + -1.0))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 9.2e-54) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); else tmp = Float64(exp(Float64(x * Float64(eps_m + -1.0))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 9.2e-54) tmp = (1.0 + exp(-x)) / 2.0; else tmp = exp((x * (eps_m + -1.0))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 9.2e-54], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 9.2 \cdot 10^{-54}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\end{array}
\end{array}
if x < 9.1999999999999996e-54Initial program 59.5%
Simplified53.3%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in eps around 0 83.5%
mul-1-neg83.5%
Simplified83.5%
if 9.1999999999999996e-54 < x Initial program 93.2%
Simplified91.0%
Taylor expanded in eps around inf 97.3%
Taylor expanded in x around 0 31.5%
Taylor expanded in x around inf 68.2%
Final simplification78.4%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 152.0)
(/ (- 2.0 (* x eps_m)) 2.0)
(if (or (<= x 1.8e+86) (not (<= x 5.2e+131)))
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.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 <= 152.0) {
tmp = (2.0 - (x * eps_m)) / 2.0;
} else if ((x <= 1.8e+86) || !(x <= 5.2e+131)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.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 <= 152.0d0) then
tmp = (2.0d0 - (x * eps_m)) / 2.0d0
else if ((x <= 1.8d+86) .or. (.not. (x <= 5.2d+131))) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 + ((-1.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 <= 152.0) {
tmp = (2.0 - (x * eps_m)) / 2.0;
} else if ((x <= 1.8e+86) || !(x <= 5.2e+131)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.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 <= 152.0: tmp = (2.0 - (x * eps_m)) / 2.0 elif (x <= 1.8e+86) or not (x <= 5.2e+131): tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.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 <= 152.0) tmp = Float64(Float64(2.0 - Float64(x * eps_m)) / 2.0); elseif ((x <= 1.8e+86) || !(x <= 5.2e+131)) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(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 <= 152.0) tmp = (2.0 - (x * eps_m)) / 2.0; elseif ((x <= 1.8e+86) || ~((x <= 5.2e+131))) tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.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, 152.0], N[(N[(2.0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 1.8e+86], N[Not[LessEqual[x, 5.2e+131]], $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], 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 152:\\
\;\;\;\;\frac{2 - x \cdot eps\_m}{2}\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{+86} \lor \neg \left(x \leq 5.2 \cdot 10^{+131}\right):\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < 152Initial program 59.4%
Simplified59.4%
Taylor expanded in x around 0 41.3%
Taylor expanded in x around 0 44.2%
Taylor expanded in eps around inf 66.0%
associate-*r*66.0%
neg-mul-166.0%
*-commutative66.0%
Simplified66.0%
if 152 < x < 1.80000000000000003e86 or 5.2e131 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 23.7%
Taylor expanded in x around 0 63.0%
if 1.80000000000000003e86 < x < 5.2e131Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 49.2%
Taylor expanded in eps around inf 32.2%
Final simplification63.1%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 7.6) (/ (- 2.0 (* x eps_m)) 2.0) (/ (* x eps_m) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 7.6) {
tmp = (2.0 - (x * 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 <= 7.6d0) then
tmp = (2.0d0 - (x * 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 <= 7.6) {
tmp = (2.0 - (x * 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 <= 7.6: tmp = (2.0 - (x * 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 <= 7.6) tmp = Float64(Float64(2.0 - Float64(x * 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 <= 7.6) tmp = (2.0 - (x * 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, 7.6], N[(N[(2.0 - N[(x * eps$95$m), $MachinePrecision]), $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 7.6:\\
\;\;\;\;\frac{2 - x \cdot eps\_m}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < 7.5999999999999996Initial program 59.4%
Simplified59.4%
Taylor expanded in x around 0 41.3%
Taylor expanded in x around 0 44.2%
Taylor expanded in eps around inf 66.0%
associate-*r*66.0%
neg-mul-166.0%
*-commutative66.0%
Simplified66.0%
if 7.5999999999999996 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 28.1%
Taylor expanded in eps around inf 16.5%
Final simplification52.1%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 24.5) 1.0 (/ (* x eps_m) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 24.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 <= 24.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 <= 24.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 <= 24.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 <= 24.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 <= 24.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, 24.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 24.5:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < 24.5Initial program 59.4%
Simplified59.4%
Taylor expanded in x around 0 62.4%
if 24.5 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 28.1%
Taylor expanded in eps around inf 16.5%
Final simplification49.5%
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 70.8%
Simplified70.8%
Taylor expanded in x around 0 45.7%
Final simplification45.7%
herbie shell --seed 2024053
(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))