
(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 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 5e-7) (/ (/ (fma x 2.0 2.0) (exp x)) 2.0) (/ (+ (exp (* x (+ eps_m -1.0))) (exp (* x (- eps_m)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 5e-7) {
tmp = (fma(x, 2.0, 2.0) / exp(x)) / 2.0;
} else {
tmp = (exp((x * (eps_m + -1.0))) + exp((x * -eps_m))) / 2.0;
}
return tmp;
}
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 5e-7) tmp = Float64(Float64(fma(x, 2.0, 2.0) / exp(x)) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + exp(Float64(x * Float64(-eps_m)))) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 5e-7], N[(N[(N[(x * 2.0 + 2.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps_m \leq 5 \cdot 10^{-7}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(x, 2, 2\right)}{e^{x}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(eps_m + -1\right)} + e^{x \cdot \left(-eps_m\right)}}{2}\\
\end{array}
\end{array}
if eps < 4.99999999999999977e-7Initial program 58.5%
Simplified58.5%
Taylor expanded in eps around 0 72.5%
associate--r+72.5%
associate-*r*72.5%
mul-1-neg72.5%
cancel-sign-sub72.5%
distribute-rgt1-in72.5%
distribute-rgt-out--72.5%
mul-1-neg72.5%
mul-1-neg72.5%
Simplified72.5%
Taylor expanded in x around inf 72.5%
distribute-lft-out72.5%
neg-mul-172.5%
neg-mul-172.5%
distribute-lft-out72.5%
associate-*r*72.5%
distribute-rgt-out72.5%
neg-mul-172.5%
Simplified72.5%
*-commutative72.5%
exp-neg72.5%
un-div-inv72.5%
+-commutative72.5%
*-commutative72.5%
fma-def72.5%
Applied egg-rr72.5%
if 4.99999999999999977e-7 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around -inf 100.0%
associate-*r*100.0%
neg-mul-1100.0%
mul-1-neg100.0%
sub-neg100.0%
mul-1-neg100.0%
associate-*r*100.0%
neg-mul-1100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
associate-*r*100.0%
neg-mul-1100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
mul-1-neg100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
neg-mul-1100.0%
distribute-neg-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
remove-double-neg100.0%
Simplified100.0%
Final simplification80.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1e-300)
(/ (+ 1.0 (exp (* x (- eps_m)))) 2.0)
(if (<= x 0.95)
(/ (+ 1.0 (exp (+ x (* x eps_m)))) 2.0)
(if (<= x 8e+216)
(/ (/ (fma x 2.0 2.0) (exp x)) 2.0)
(/ (* (exp x) (+ x (+ x 2.0))) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1e-300) {
tmp = (1.0 + exp((x * -eps_m))) / 2.0;
} else if (x <= 0.95) {
tmp = (1.0 + exp((x + (x * eps_m)))) / 2.0;
} else if (x <= 8e+216) {
tmp = (fma(x, 2.0, 2.0) / exp(x)) / 2.0;
} else {
tmp = (exp(x) * (x + (x + 2.0))) / 2.0;
}
return tmp;
}
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1e-300) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-eps_m)))) / 2.0); elseif (x <= 0.95) tmp = Float64(Float64(1.0 + exp(Float64(x + Float64(x * eps_m)))) / 2.0); elseif (x <= 8e+216) tmp = Float64(Float64(fma(x, 2.0, 2.0) / exp(x)) / 2.0); else tmp = Float64(Float64(exp(x) * Float64(x + Float64(x + 2.0))) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1e-300], N[(N[(1.0 + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 0.95], N[(N[(1.0 + N[Exp[N[(x + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 8e+216], N[(N[(N[(x * 2.0 + 2.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[x], $MachinePrecision] * N[(x + N[(x + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-300}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-eps_m\right)}}{2}\\
\mathbf{elif}\;x \leq 0.95:\\
\;\;\;\;\frac{1 + e^{x + x \cdot eps_m}}{2}\\
\mathbf{elif}\;x \leq 8 \cdot 10^{+216}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(x, 2, 2\right)}{e^{x}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x} \cdot \left(x + \left(x + 2\right)\right)}{2}\\
\end{array}
\end{array}
if x < -1.00000000000000003e-300Initial program 66.8%
Simplified66.8%
Taylor expanded in eps around inf 98.8%
Taylor expanded in eps around -inf 98.8%
associate-*r*98.8%
neg-mul-198.8%
mul-1-neg98.8%
sub-neg98.8%
mul-1-neg98.8%
associate-*r*98.8%
neg-mul-198.8%
mul-1-neg98.8%
Simplified98.8%
Taylor expanded in eps around inf 98.8%
associate-*r*98.8%
neg-mul-198.8%
Simplified98.8%
Taylor expanded in x around 0 79.6%
if -1.00000000000000003e-300 < x < 0.94999999999999996Initial program 52.7%
Simplified52.7%
Taylor expanded in x around 0 43.4%
*-commutative43.4%
+-commutative43.4%
distribute-lft-in43.4%
add-sqr-sqrt1.2%
sqrt-unprod33.9%
sqr-neg33.9%
sqrt-unprod34.3%
add-sqr-sqrt35.5%
*-commutative35.5%
*-un-lft-identity35.5%
add-sqr-sqrt1.2%
sqrt-unprod35.5%
sqr-neg35.5%
sqrt-unprod34.3%
add-sqr-sqrt35.5%
Applied egg-rr35.5%
Taylor expanded in eps around inf 82.8%
if 0.94999999999999996 < x < 8.0000000000000002e216Initial program 95.9%
Simplified95.9%
Taylor expanded in eps around 0 60.1%
associate--r+60.2%
associate-*r*60.2%
mul-1-neg60.2%
cancel-sign-sub60.2%
distribute-rgt1-in60.2%
distribute-rgt-out--60.2%
mul-1-neg60.2%
mul-1-neg60.2%
Simplified60.2%
Taylor expanded in x around inf 60.1%
distribute-lft-out60.1%
neg-mul-160.1%
neg-mul-160.1%
distribute-lft-out60.1%
associate-*r*60.1%
distribute-rgt-out60.2%
neg-mul-160.2%
Simplified60.2%
*-commutative60.2%
exp-neg60.2%
un-div-inv60.2%
+-commutative60.2%
*-commutative60.2%
fma-def60.2%
Applied egg-rr60.2%
if 8.0000000000000002e216 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 36.0%
associate--r+36.0%
associate-*r*36.0%
mul-1-neg36.0%
cancel-sign-sub36.0%
distribute-rgt1-in36.0%
distribute-rgt-out--36.0%
mul-1-neg36.0%
mul-1-neg36.0%
Simplified36.0%
*-un-lft-identity36.0%
fma-def36.0%
add-sqr-sqrt0.0%
sqrt-unprod65.5%
sqr-neg65.5%
sqrt-unprod65.5%
add-sqr-sqrt65.5%
associate--l+65.5%
metadata-eval65.5%
add-sqr-sqrt0.0%
sqrt-unprod65.5%
sqr-neg65.5%
sqrt-unprod65.5%
add-sqr-sqrt65.5%
Applied egg-rr65.5%
fma-udef65.5%
*-lft-identity65.5%
*-commutative65.5%
distribute-lft-out65.5%
Simplified65.5%
Final simplification76.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* x (+ eps_m -1.0))) (exp (* x (- -1.0 eps_m)))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * (eps_m + -1.0))) + exp((x * (-1.0 - eps_m)))) / 2.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = (exp((x * (eps_m + (-1.0d0)))) + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return (Math.exp((x * (eps_m + -1.0))) + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.exp((x * (eps_m + -1.0))) + math.exp((x * (-1.0 - eps_m)))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((x * (eps_m + -1.0))) + exp((x * (-1.0 - eps_m)))) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\frac{e^{x \cdot \left(eps_m + -1\right)} + e^{x \cdot \left(-1 - eps_m\right)}}{2}
\end{array}
Initial program 70.0%
Simplified70.0%
Taylor expanded in eps around inf 98.8%
Taylor expanded in eps around -inf 98.8%
associate-*r*98.8%
neg-mul-198.8%
mul-1-neg98.8%
sub-neg98.8%
mul-1-neg98.8%
associate-*r*98.8%
neg-mul-198.8%
mul-1-neg98.8%
Simplified98.8%
Final simplification98.8%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -7e-301)
(/ (+ 1.0 (exp (* x (- eps_m)))) 2.0)
(if (<= x 0.95)
(/ (+ 1.0 (exp (+ x (* x eps_m)))) 2.0)
(if (<= x 1e+217)
(/ (* (exp (- x)) (+ 2.0 (* x 2.0))) 2.0)
(/ (* (exp x) (+ x (+ x 2.0))) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -7e-301) {
tmp = (1.0 + exp((x * -eps_m))) / 2.0;
} else if (x <= 0.95) {
tmp = (1.0 + exp((x + (x * eps_m)))) / 2.0;
} else if (x <= 1e+217) {
tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0;
} else {
tmp = (exp(x) * (x + (x + 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 <= (-7d-301)) then
tmp = (1.0d0 + exp((x * -eps_m))) / 2.0d0
else if (x <= 0.95d0) then
tmp = (1.0d0 + exp((x + (x * eps_m)))) / 2.0d0
else if (x <= 1d+217) then
tmp = (exp(-x) * (2.0d0 + (x * 2.0d0))) / 2.0d0
else
tmp = (exp(x) * (x + (x + 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 <= -7e-301) {
tmp = (1.0 + Math.exp((x * -eps_m))) / 2.0;
} else if (x <= 0.95) {
tmp = (1.0 + Math.exp((x + (x * eps_m)))) / 2.0;
} else if (x <= 1e+217) {
tmp = (Math.exp(-x) * (2.0 + (x * 2.0))) / 2.0;
} else {
tmp = (Math.exp(x) * (x + (x + 2.0))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -7e-301: tmp = (1.0 + math.exp((x * -eps_m))) / 2.0 elif x <= 0.95: tmp = (1.0 + math.exp((x + (x * eps_m)))) / 2.0 elif x <= 1e+217: tmp = (math.exp(-x) * (2.0 + (x * 2.0))) / 2.0 else: tmp = (math.exp(x) * (x + (x + 2.0))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -7e-301) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-eps_m)))) / 2.0); elseif (x <= 0.95) tmp = Float64(Float64(1.0 + exp(Float64(x + Float64(x * eps_m)))) / 2.0); elseif (x <= 1e+217) tmp = Float64(Float64(exp(Float64(-x)) * Float64(2.0 + Float64(x * 2.0))) / 2.0); else tmp = Float64(Float64(exp(x) * Float64(x + Float64(x + 2.0))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -7e-301) tmp = (1.0 + exp((x * -eps_m))) / 2.0; elseif (x <= 0.95) tmp = (1.0 + exp((x + (x * eps_m)))) / 2.0; elseif (x <= 1e+217) tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0; else tmp = (exp(x) * (x + (x + 2.0))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -7e-301], N[(N[(1.0 + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 0.95], N[(N[(1.0 + N[Exp[N[(x + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1e+217], N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[x], $MachinePrecision] * N[(x + N[(x + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{-301}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-eps_m\right)}}{2}\\
\mathbf{elif}\;x \leq 0.95:\\
\;\;\;\;\frac{1 + e^{x + x \cdot eps_m}}{2}\\
\mathbf{elif}\;x \leq 10^{+217}:\\
\;\;\;\;\frac{e^{-x} \cdot \left(2 + x \cdot 2\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x} \cdot \left(x + \left(x + 2\right)\right)}{2}\\
\end{array}
\end{array}
if x < -6.99999999999999984e-301Initial program 66.8%
Simplified66.8%
Taylor expanded in eps around inf 98.8%
Taylor expanded in eps around -inf 98.8%
associate-*r*98.8%
neg-mul-198.8%
mul-1-neg98.8%
sub-neg98.8%
mul-1-neg98.8%
associate-*r*98.8%
neg-mul-198.8%
mul-1-neg98.8%
Simplified98.8%
Taylor expanded in eps around inf 98.8%
associate-*r*98.8%
neg-mul-198.8%
Simplified98.8%
Taylor expanded in x around 0 79.6%
if -6.99999999999999984e-301 < x < 0.94999999999999996Initial program 52.7%
Simplified52.7%
Taylor expanded in x around 0 43.4%
*-commutative43.4%
+-commutative43.4%
distribute-lft-in43.4%
add-sqr-sqrt1.2%
sqrt-unprod33.9%
sqr-neg33.9%
sqrt-unprod34.3%
add-sqr-sqrt35.5%
*-commutative35.5%
*-un-lft-identity35.5%
add-sqr-sqrt1.2%
sqrt-unprod35.5%
sqr-neg35.5%
sqrt-unprod34.3%
add-sqr-sqrt35.5%
Applied egg-rr35.5%
Taylor expanded in eps around inf 82.8%
if 0.94999999999999996 < x < 9.9999999999999996e216Initial program 95.9%
Simplified95.9%
Taylor expanded in eps around 0 60.1%
associate--r+60.2%
associate-*r*60.2%
mul-1-neg60.2%
cancel-sign-sub60.2%
distribute-rgt1-in60.2%
distribute-rgt-out--60.2%
mul-1-neg60.2%
mul-1-neg60.2%
Simplified60.2%
Taylor expanded in x around inf 60.1%
distribute-lft-out60.1%
neg-mul-160.1%
neg-mul-160.1%
distribute-lft-out60.1%
associate-*r*60.1%
distribute-rgt-out60.2%
neg-mul-160.2%
Simplified60.2%
if 9.9999999999999996e216 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 36.0%
associate--r+36.0%
associate-*r*36.0%
mul-1-neg36.0%
cancel-sign-sub36.0%
distribute-rgt1-in36.0%
distribute-rgt-out--36.0%
mul-1-neg36.0%
mul-1-neg36.0%
Simplified36.0%
*-un-lft-identity36.0%
fma-def36.0%
add-sqr-sqrt0.0%
sqrt-unprod65.5%
sqr-neg65.5%
sqrt-unprod65.5%
add-sqr-sqrt65.5%
associate--l+65.5%
metadata-eval65.5%
add-sqr-sqrt0.0%
sqrt-unprod65.5%
sqr-neg65.5%
sqrt-unprod65.5%
add-sqr-sqrt65.5%
Applied egg-rr65.5%
fma-udef65.5%
*-lft-identity65.5%
*-commutative65.5%
distribute-lft-out65.5%
Simplified65.5%
Final simplification76.0%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -5.3e-226)
(/ (+ 1.0 (exp (* x (- eps_m)))) 2.0)
(if (<= x 1e+217)
(/ (* (exp (- x)) (+ 2.0 (* x 2.0))) 2.0)
(/ (* (exp x) (+ x (+ x 2.0))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -5.3e-226) {
tmp = (1.0 + exp((x * -eps_m))) / 2.0;
} else if (x <= 1e+217) {
tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0;
} else {
tmp = (exp(x) * (x + (x + 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 <= (-5.3d-226)) then
tmp = (1.0d0 + exp((x * -eps_m))) / 2.0d0
else if (x <= 1d+217) then
tmp = (exp(-x) * (2.0d0 + (x * 2.0d0))) / 2.0d0
else
tmp = (exp(x) * (x + (x + 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 <= -5.3e-226) {
tmp = (1.0 + Math.exp((x * -eps_m))) / 2.0;
} else if (x <= 1e+217) {
tmp = (Math.exp(-x) * (2.0 + (x * 2.0))) / 2.0;
} else {
tmp = (Math.exp(x) * (x + (x + 2.0))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -5.3e-226: tmp = (1.0 + math.exp((x * -eps_m))) / 2.0 elif x <= 1e+217: tmp = (math.exp(-x) * (2.0 + (x * 2.0))) / 2.0 else: tmp = (math.exp(x) * (x + (x + 2.0))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -5.3e-226) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-eps_m)))) / 2.0); elseif (x <= 1e+217) tmp = Float64(Float64(exp(Float64(-x)) * Float64(2.0 + Float64(x * 2.0))) / 2.0); else tmp = Float64(Float64(exp(x) * Float64(x + Float64(x + 2.0))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -5.3e-226) tmp = (1.0 + exp((x * -eps_m))) / 2.0; elseif (x <= 1e+217) tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0; else tmp = (exp(x) * (x + (x + 2.0))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -5.3e-226], N[(N[(1.0 + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1e+217], N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[x], $MachinePrecision] * N[(x + N[(x + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.3 \cdot 10^{-226}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-eps_m\right)}}{2}\\
\mathbf{elif}\;x \leq 10^{+217}:\\
\;\;\;\;\frac{e^{-x} \cdot \left(2 + x \cdot 2\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x} \cdot \left(x + \left(x + 2\right)\right)}{2}\\
\end{array}
\end{array}
if x < -5.3000000000000004e-226Initial program 70.0%
Simplified70.0%
Taylor expanded in eps around inf 98.5%
Taylor expanded in eps around -inf 98.5%
associate-*r*98.5%
neg-mul-198.5%
mul-1-neg98.5%
sub-neg98.5%
mul-1-neg98.5%
associate-*r*98.5%
neg-mul-198.5%
mul-1-neg98.5%
Simplified98.5%
Taylor expanded in eps around inf 98.6%
associate-*r*98.6%
neg-mul-198.6%
Simplified98.6%
Taylor expanded in x around 0 76.1%
if -5.3000000000000004e-226 < x < 9.9999999999999996e216Initial program 66.0%
Simplified66.0%
Taylor expanded in eps around 0 73.2%
associate--r+73.2%
associate-*r*73.2%
mul-1-neg73.2%
cancel-sign-sub73.2%
distribute-rgt1-in73.2%
distribute-rgt-out--73.2%
mul-1-neg73.2%
mul-1-neg73.2%
Simplified73.2%
Taylor expanded in x around inf 73.2%
distribute-lft-out73.2%
neg-mul-173.2%
neg-mul-173.2%
distribute-lft-out73.2%
associate-*r*73.2%
distribute-rgt-out73.2%
neg-mul-173.2%
Simplified73.2%
if 9.9999999999999996e216 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 36.0%
associate--r+36.0%
associate-*r*36.0%
mul-1-neg36.0%
cancel-sign-sub36.0%
distribute-rgt1-in36.0%
distribute-rgt-out--36.0%
mul-1-neg36.0%
mul-1-neg36.0%
Simplified36.0%
*-un-lft-identity36.0%
fma-def36.0%
add-sqr-sqrt0.0%
sqrt-unprod65.5%
sqr-neg65.5%
sqrt-unprod65.5%
add-sqr-sqrt65.5%
associate--l+65.5%
metadata-eval65.5%
add-sqr-sqrt0.0%
sqrt-unprod65.5%
sqr-neg65.5%
sqrt-unprod65.5%
add-sqr-sqrt65.5%
Applied egg-rr65.5%
fma-udef65.5%
*-lft-identity65.5%
*-commutative65.5%
distribute-lft-out65.5%
Simplified65.5%
Final simplification73.6%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -4.8e-226)
(/ (+ 1.0 (exp (* x (- eps_m)))) 2.0)
(if (<= x 1e+217)
(/ (* 2.0 (exp (- x))) 2.0)
(/ (* (exp x) (+ x (+ x 2.0))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -4.8e-226) {
tmp = (1.0 + exp((x * -eps_m))) / 2.0;
} else if (x <= 1e+217) {
tmp = (2.0 * exp(-x)) / 2.0;
} else {
tmp = (exp(x) * (x + (x + 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 <= (-4.8d-226)) then
tmp = (1.0d0 + exp((x * -eps_m))) / 2.0d0
else if (x <= 1d+217) then
tmp = (2.0d0 * exp(-x)) / 2.0d0
else
tmp = (exp(x) * (x + (x + 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 <= -4.8e-226) {
tmp = (1.0 + Math.exp((x * -eps_m))) / 2.0;
} else if (x <= 1e+217) {
tmp = (2.0 * Math.exp(-x)) / 2.0;
} else {
tmp = (Math.exp(x) * (x + (x + 2.0))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -4.8e-226: tmp = (1.0 + math.exp((x * -eps_m))) / 2.0 elif x <= 1e+217: tmp = (2.0 * math.exp(-x)) / 2.0 else: tmp = (math.exp(x) * (x + (x + 2.0))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -4.8e-226) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-eps_m)))) / 2.0); elseif (x <= 1e+217) tmp = Float64(Float64(2.0 * exp(Float64(-x))) / 2.0); else tmp = Float64(Float64(exp(x) * Float64(x + Float64(x + 2.0))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -4.8e-226) tmp = (1.0 + exp((x * -eps_m))) / 2.0; elseif (x <= 1e+217) tmp = (2.0 * exp(-x)) / 2.0; else tmp = (exp(x) * (x + (x + 2.0))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -4.8e-226], N[(N[(1.0 + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1e+217], N[(N[(2.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[x], $MachinePrecision] * N[(x + N[(x + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{-226}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-eps_m\right)}}{2}\\
\mathbf{elif}\;x \leq 10^{+217}:\\
\;\;\;\;\frac{2 \cdot e^{-x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x} \cdot \left(x + \left(x + 2\right)\right)}{2}\\
\end{array}
\end{array}
if x < -4.7999999999999999e-226Initial program 70.0%
Simplified70.0%
Taylor expanded in eps around inf 98.5%
Taylor expanded in eps around -inf 98.5%
associate-*r*98.5%
neg-mul-198.5%
mul-1-neg98.5%
sub-neg98.5%
mul-1-neg98.5%
associate-*r*98.5%
neg-mul-198.5%
mul-1-neg98.5%
Simplified98.5%
Taylor expanded in eps around inf 98.6%
associate-*r*98.6%
neg-mul-198.6%
Simplified98.6%
Taylor expanded in x around 0 76.1%
if -4.7999999999999999e-226 < x < 9.9999999999999996e216Initial program 66.0%
Simplified66.0%
Taylor expanded in eps around inf 98.9%
Taylor expanded in eps around 0 72.0%
cancel-sign-sub-inv72.0%
metadata-eval72.0%
distribute-rgt1-in72.0%
metadata-eval72.0%
neg-mul-172.0%
Simplified72.0%
if 9.9999999999999996e216 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 36.0%
associate--r+36.0%
associate-*r*36.0%
mul-1-neg36.0%
cancel-sign-sub36.0%
distribute-rgt1-in36.0%
distribute-rgt-out--36.0%
mul-1-neg36.0%
mul-1-neg36.0%
Simplified36.0%
*-un-lft-identity36.0%
fma-def36.0%
add-sqr-sqrt0.0%
sqrt-unprod65.5%
sqr-neg65.5%
sqrt-unprod65.5%
add-sqr-sqrt65.5%
associate--l+65.5%
metadata-eval65.5%
add-sqr-sqrt0.0%
sqrt-unprod65.5%
sqr-neg65.5%
sqrt-unprod65.5%
add-sqr-sqrt65.5%
Applied egg-rr65.5%
fma-udef65.5%
*-lft-identity65.5%
*-commutative65.5%
distribute-lft-out65.5%
Simplified65.5%
Final simplification72.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 1.1e+219) (/ (* 2.0 (exp (- x))) 2.0) (/ (* (exp x) (+ x (+ x 2.0))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 1.1e+219) {
tmp = (2.0 * exp(-x)) / 2.0;
} else {
tmp = (exp(x) * (x + (x + 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 (eps_m <= 1.1d+219) then
tmp = (2.0d0 * exp(-x)) / 2.0d0
else
tmp = (exp(x) * (x + (x + 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 (eps_m <= 1.1e+219) {
tmp = (2.0 * Math.exp(-x)) / 2.0;
} else {
tmp = (Math.exp(x) * (x + (x + 2.0))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 1.1e+219: tmp = (2.0 * math.exp(-x)) / 2.0 else: tmp = (math.exp(x) * (x + (x + 2.0))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 1.1e+219) tmp = Float64(Float64(2.0 * exp(Float64(-x))) / 2.0); else tmp = Float64(Float64(exp(x) * Float64(x + Float64(x + 2.0))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 1.1e+219) tmp = (2.0 * exp(-x)) / 2.0; else tmp = (exp(x) * (x + (x + 2.0))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 1.1e+219], N[(N[(2.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[x], $MachinePrecision] * N[(x + N[(x + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps_m \leq 1.1 \cdot 10^{+219}:\\
\;\;\;\;\frac{2 \cdot e^{-x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x} \cdot \left(x + \left(x + 2\right)\right)}{2}\\
\end{array}
\end{array}
if eps < 1.1000000000000001e219Initial program 66.9%
Simplified66.9%
Taylor expanded in eps around inf 98.7%
Taylor expanded in eps around 0 77.1%
cancel-sign-sub-inv77.1%
metadata-eval77.1%
distribute-rgt1-in77.1%
metadata-eval77.1%
neg-mul-177.1%
Simplified77.1%
if 1.1000000000000001e219 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 14.2%
associate--r+14.2%
associate-*r*14.2%
mul-1-neg14.2%
cancel-sign-sub14.2%
distribute-rgt1-in14.2%
distribute-rgt-out--14.2%
mul-1-neg14.2%
mul-1-neg14.2%
Simplified14.2%
*-un-lft-identity14.2%
fma-def14.2%
add-sqr-sqrt8.9%
sqrt-unprod47.0%
sqr-neg47.0%
sqrt-unprod38.2%
add-sqr-sqrt47.0%
associate--l+47.0%
metadata-eval47.0%
add-sqr-sqrt8.9%
sqrt-unprod47.0%
sqr-neg47.0%
sqrt-unprod38.2%
add-sqr-sqrt47.3%
Applied egg-rr47.3%
fma-udef47.3%
*-lft-identity47.3%
*-commutative47.3%
distribute-lft-out47.3%
Simplified47.3%
Final simplification74.3%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 4.4e+219) (/ (* 2.0 (exp (- x))) 2.0) (/ (+ 2.0 (* x eps_m)) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 4.4e+219) {
tmp = (2.0 * exp(-x)) / 2.0;
} else {
tmp = (2.0 + (x * eps_m)) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (eps_m <= 4.4d+219) then
tmp = (2.0d0 * exp(-x)) / 2.0d0
else
tmp = (2.0d0 + (x * eps_m)) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (eps_m <= 4.4e+219) {
tmp = (2.0 * Math.exp(-x)) / 2.0;
} else {
tmp = (2.0 + (x * eps_m)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 4.4e+219: tmp = (2.0 * math.exp(-x)) / 2.0 else: tmp = (2.0 + (x * eps_m)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 4.4e+219) tmp = Float64(Float64(2.0 * exp(Float64(-x))) / 2.0); else tmp = Float64(Float64(2.0 + Float64(x * eps_m)) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 4.4e+219) tmp = (2.0 * exp(-x)) / 2.0; else tmp = (2.0 + (x * eps_m)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 4.4e+219], N[(N[(2.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps_m \leq 4.4 \cdot 10^{+219}:\\
\;\;\;\;\frac{2 \cdot e^{-x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot eps_m}{2}\\
\end{array}
\end{array}
if eps < 4.4000000000000003e219Initial program 66.9%
Simplified66.9%
Taylor expanded in eps around inf 98.7%
Taylor expanded in eps around 0 77.1%
cancel-sign-sub-inv77.1%
metadata-eval77.1%
distribute-rgt1-in77.1%
metadata-eval77.1%
neg-mul-177.1%
Simplified77.1%
if 4.4000000000000003e219 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 59.7%
*-commutative59.7%
neg-mul-159.7%
unsub-neg59.7%
*-commutative59.7%
Simplified59.7%
Taylor expanded in x around 0 42.0%
Taylor expanded in eps around inf 42.0%
+-commutative42.0%
*-commutative42.0%
Simplified42.0%
Final simplification73.8%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -0.96)
(* (* x eps_m) -0.5)
(if (<= x 360.0)
1.0
(if (<= x 8e+241)
(/ (- (+ 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 <= -0.96) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 360.0) {
tmp = 1.0;
} else if (x <= 8e+241) {
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 <= (-0.96d0)) then
tmp = (x * eps_m) * (-0.5d0)
else if (x <= 360.0d0) then
tmp = 1.0d0
else if (x <= 8d+241) 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 <= -0.96) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 360.0) {
tmp = 1.0;
} else if (x <= 8e+241) {
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 <= -0.96: tmp = (x * eps_m) * -0.5 elif x <= 360.0: tmp = 1.0 elif x <= 8e+241: 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 <= -0.96) tmp = Float64(Float64(x * eps_m) * -0.5); elseif (x <= 360.0) tmp = 1.0; elseif (x <= 8e+241) 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 <= -0.96) tmp = (x * eps_m) * -0.5; elseif (x <= 360.0) tmp = 1.0; elseif (x <= 8e+241) 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, -0.96], N[(N[(x * eps$95$m), $MachinePrecision] * -0.5), $MachinePrecision], If[LessEqual[x, 360.0], 1.0, If[LessEqual[x, 8e+241], 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 -0.96:\\
\;\;\;\;\left(x \cdot eps_m\right) \cdot -0.5\\
\mathbf{elif}\;x \leq 360:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 8 \cdot 10^{+241}:\\
\;\;\;\;\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 < -0.95999999999999996Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 54.8%
*-commutative54.8%
neg-mul-154.8%
unsub-neg54.8%
*-commutative54.8%
Simplified54.8%
Taylor expanded in x around inf 19.6%
Taylor expanded in eps around inf 19.6%
*-commutative19.6%
Simplified19.6%
frac-2neg19.6%
*-commutative19.6%
distribute-lft-neg-out19.6%
div-inv19.6%
add-sqr-sqrt19.5%
sqrt-unprod58.1%
sqr-neg58.1%
sqrt-unprod22.5%
add-sqr-sqrt22.6%
*-commutative22.6%
metadata-eval22.6%
metadata-eval22.6%
Applied egg-rr22.6%
if -0.95999999999999996 < x < 360Initial program 51.4%
Simplified51.4%
Taylor expanded in x around 0 76.8%
if 360 < x < 8.0000000000000004e241Initial program 98.0%
Simplified98.0%
Taylor expanded in x around 0 22.8%
Taylor expanded in x around 0 57.7%
if 8.0000000000000004e241 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 23.1%
*-commutative23.1%
neg-mul-123.1%
unsub-neg23.1%
*-commutative23.1%
Simplified23.1%
Taylor expanded in x around inf 23.1%
Taylor expanded in eps around inf 23.5%
*-commutative23.5%
Simplified23.5%
Final simplification62.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1.0)
(* (* x eps_m) -0.5)
(if (<= x 360.0)
1.0
(if (<= x 2.4e+233)
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (/ -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 <= -1.0) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 360.0) {
tmp = 1.0;
} else if (x <= 2.4e+233) {
tmp = ((1.0 + (1.0 / eps_m)) + (-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 <= (-1.0d0)) then
tmp = (x * eps_m) * (-0.5d0)
else if (x <= 360.0d0) then
tmp = 1.0d0
else if (x <= 2.4d+233) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + ((-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 <= -1.0) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 360.0) {
tmp = 1.0;
} else if (x <= 2.4e+233) {
tmp = ((1.0 + (1.0 / eps_m)) + (-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 <= -1.0: tmp = (x * eps_m) * -0.5 elif x <= 360.0: tmp = 1.0 elif x <= 2.4e+233: tmp = ((1.0 + (1.0 / eps_m)) + (-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 <= -1.0) tmp = Float64(Float64(x * eps_m) * -0.5); elseif (x <= 360.0) tmp = 1.0; elseif (x <= 2.4e+233) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + 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 <= -1.0) tmp = (x * eps_m) * -0.5; elseif (x <= 360.0) tmp = 1.0; elseif (x <= 2.4e+233) tmp = ((1.0 + (1.0 / eps_m)) + (-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, -1.0], N[(N[(x * eps$95$m), $MachinePrecision] * -0.5), $MachinePrecision], If[LessEqual[x, 360.0], 1.0, If[LessEqual[x, 2.4e+233], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / 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 -1:\\
\;\;\;\;\left(x \cdot eps_m\right) \cdot -0.5\\
\mathbf{elif}\;x \leq 360:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{+233}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps_m}\right) + \frac{-1}{eps_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps_m}{2}\\
\end{array}
\end{array}
if x < -1Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 54.8%
*-commutative54.8%
neg-mul-154.8%
unsub-neg54.8%
*-commutative54.8%
Simplified54.8%
Taylor expanded in x around inf 19.6%
Taylor expanded in eps around inf 19.6%
*-commutative19.6%
Simplified19.6%
frac-2neg19.6%
*-commutative19.6%
distribute-lft-neg-out19.6%
div-inv19.6%
add-sqr-sqrt19.5%
sqrt-unprod58.1%
sqr-neg58.1%
sqrt-unprod22.5%
add-sqr-sqrt22.6%
*-commutative22.6%
metadata-eval22.6%
metadata-eval22.6%
Applied egg-rr22.6%
if -1 < x < 360Initial program 51.4%
Simplified51.4%
Taylor expanded in x around 0 76.8%
if 360 < x < 2.40000000000000003e233Initial program 98.0%
Simplified98.0%
Taylor expanded in x around 0 22.8%
Taylor expanded in x around 0 57.7%
Taylor expanded in eps around 0 57.7%
if 2.40000000000000003e233 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 23.1%
*-commutative23.1%
neg-mul-123.1%
unsub-neg23.1%
*-commutative23.1%
Simplified23.1%
Taylor expanded in x around inf 23.1%
Taylor expanded in eps around inf 23.5%
*-commutative23.5%
Simplified23.5%
Final simplification62.3%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.0) (* (* x eps_m) -0.5) (if (<= x 102.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) * -0.5;
} else if (x <= 102.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) * (-0.5d0)
else if (x <= 102.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) * -0.5;
} else if (x <= 102.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) * -0.5 elif x <= 102.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 * eps_m) * -0.5); elseif (x <= 102.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) * -0.5; elseif (x <= 102.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] * -0.5), $MachinePrecision], If[LessEqual[x, 102.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:\\
\;\;\;\;\left(x \cdot eps_m\right) \cdot -0.5\\
\mathbf{elif}\;x \leq 102:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps_m}{2}\\
\end{array}
\end{array}
if x < -1Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 54.8%
*-commutative54.8%
neg-mul-154.8%
unsub-neg54.8%
*-commutative54.8%
Simplified54.8%
Taylor expanded in x around inf 19.6%
Taylor expanded in eps around inf 19.6%
*-commutative19.6%
Simplified19.6%
frac-2neg19.6%
*-commutative19.6%
distribute-lft-neg-out19.6%
div-inv19.6%
add-sqr-sqrt19.5%
sqrt-unprod58.1%
sqr-neg58.1%
sqrt-unprod22.5%
add-sqr-sqrt22.6%
*-commutative22.6%
metadata-eval22.6%
metadata-eval22.6%
Applied egg-rr22.6%
if -1 < x < 102Initial program 51.4%
Simplified51.4%
Taylor expanded in x around 0 76.8%
if 102 < x Initial program 98.6%
Simplified98.6%
Taylor expanded in x around 0 27.2%
*-commutative27.2%
neg-mul-127.2%
unsub-neg27.2%
*-commutative27.2%
Simplified27.2%
Taylor expanded in x around inf 16.6%
Taylor expanded in eps around inf 17.8%
*-commutative17.8%
Simplified17.8%
Final simplification54.4%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.0) (* (* x eps_m) -0.5) (/ (+ 2.0 (* x eps_m)) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.0) {
tmp = (x * eps_m) * -0.5;
} else {
tmp = (2.0 + (x * eps_m)) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-1.0d0)) then
tmp = (x * eps_m) * (-0.5d0)
else
tmp = (2.0d0 + (x * eps_m)) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1.0) {
tmp = (x * eps_m) * -0.5;
} else {
tmp = (2.0 + (x * eps_m)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.0: tmp = (x * eps_m) * -0.5 else: tmp = (2.0 + (x * eps_m)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.0) tmp = Float64(Float64(x * eps_m) * -0.5); else tmp = Float64(Float64(2.0 + Float64(x * eps_m)) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.0) tmp = (x * eps_m) * -0.5; else tmp = (2.0 + (x * eps_m)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.0], N[(N[(x * eps$95$m), $MachinePrecision] * -0.5), $MachinePrecision], N[(N[(2.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\left(x \cdot eps_m\right) \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot eps_m}{2}\\
\end{array}
\end{array}
if x < -1Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 54.8%
*-commutative54.8%
neg-mul-154.8%
unsub-neg54.8%
*-commutative54.8%
Simplified54.8%
Taylor expanded in x around inf 19.6%
Taylor expanded in eps around inf 19.6%
*-commutative19.6%
Simplified19.6%
frac-2neg19.6%
*-commutative19.6%
distribute-lft-neg-out19.6%
div-inv19.6%
add-sqr-sqrt19.5%
sqrt-unprod58.1%
sqr-neg58.1%
sqrt-unprod22.5%
add-sqr-sqrt22.6%
*-commutative22.6%
metadata-eval22.6%
metadata-eval22.6%
Applied egg-rr22.6%
if -1 < x Initial program 65.4%
Simplified65.4%
Taylor expanded in x around 0 38.1%
*-commutative38.1%
neg-mul-138.1%
unsub-neg38.1%
*-commutative38.1%
Simplified38.1%
Taylor expanded in x around 0 24.6%
Taylor expanded in eps around inf 58.6%
+-commutative58.6%
*-commutative58.6%
Simplified58.6%
Final simplification53.8%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.0) (* (* x eps_m) -0.5) 1.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.0) {
tmp = (x * eps_m) * -0.5;
} else {
tmp = 1.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-1.0d0)) then
tmp = (x * eps_m) * (-0.5d0)
else
tmp = 1.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1.0) {
tmp = (x * eps_m) * -0.5;
} else {
tmp = 1.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.0: tmp = (x * eps_m) * -0.5 else: tmp = 1.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.0) tmp = Float64(Float64(x * eps_m) * -0.5); else tmp = 1.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.0) tmp = (x * eps_m) * -0.5; else tmp = 1.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.0], N[(N[(x * eps$95$m), $MachinePrecision] * -0.5), $MachinePrecision], 1.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\left(x \cdot eps_m\right) \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 54.8%
*-commutative54.8%
neg-mul-154.8%
unsub-neg54.8%
*-commutative54.8%
Simplified54.8%
Taylor expanded in x around inf 19.6%
Taylor expanded in eps around inf 19.6%
*-commutative19.6%
Simplified19.6%
frac-2neg19.6%
*-commutative19.6%
distribute-lft-neg-out19.6%
div-inv19.6%
add-sqr-sqrt19.5%
sqrt-unprod58.1%
sqr-neg58.1%
sqrt-unprod22.5%
add-sqr-sqrt22.6%
*-commutative22.6%
metadata-eval22.6%
metadata-eval22.6%
Applied egg-rr22.6%
if -1 < x Initial program 65.4%
Simplified65.4%
Taylor expanded in x around 0 54.9%
Final simplification50.6%
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.0%
Simplified70.0%
Taylor expanded in x around 0 48.0%
Final simplification48.0%
herbie shell --seed 2024011
(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))