
(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 22 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 (/ (+ (exp (* x (expm1 (log eps_m)))) (/ 1.0 (exp (+ x (* eps_m x))))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * expm1(log(eps_m)))) + (1.0 / exp((x + (eps_m * x))))) / 2.0;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return (Math.exp((x * Math.expm1(Math.log(eps_m)))) + (1.0 / Math.exp((x + (eps_m * x))))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.exp((x * math.expm1(math.log(eps_m)))) + (1.0 / math.exp((x + (eps_m * x))))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(exp(Float64(x * expm1(log(eps_m)))) + Float64(1.0 / exp(Float64(x + Float64(eps_m * x))))) / 2.0) end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(N[Exp[N[(x * N[(Exp[N[Log[eps$95$m], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[Exp[N[(x + N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\frac{e^{x \cdot \mathsf{expm1}\left(\log eps\_m\right)} + \frac{1}{e^{x + eps\_m \cdot x}}}{2}
\end{array}
Initial program 74.3%
Simplified67.7%
Taylor expanded in eps around inf 99.5%
add-exp-log50.6%
expm1-define50.6%
Applied egg-rr50.6%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 1.3e+19)
(/ (+ (exp (* x eps_m)) (/ 1.0 (exp (* eps_m x)))) 2.0)
(if (<= x 2.9e+83)
(/ (- (+ 1.0 (/ 1.0 eps_m)) (- (/ 1.0 eps_m) 1.0)) 2.0)
(if (<= x 8.2e+275)
(/ (+ (exp (* x (- eps_m 1.0))) 1.0) 2.0)
(/ (/ (- (exp (* -1.0 x)) (/ 1.0 (exp x))) eps_m) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1.3e+19) {
tmp = (exp((x * eps_m)) + (1.0 / exp((eps_m * x)))) / 2.0;
} else if (x <= 2.9e+83) {
tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0;
} else if (x <= 8.2e+275) {
tmp = (exp((x * (eps_m - 1.0))) + 1.0) / 2.0;
} else {
tmp = ((exp((-1.0 * x)) - (1.0 / exp(x))) / eps_m) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 1.3d+19) then
tmp = (exp((x * eps_m)) + (1.0d0 / exp((eps_m * x)))) / 2.0d0
else if (x <= 2.9d+83) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) - ((1.0d0 / eps_m) - 1.0d0)) / 2.0d0
else if (x <= 8.2d+275) then
tmp = (exp((x * (eps_m - 1.0d0))) + 1.0d0) / 2.0d0
else
tmp = ((exp(((-1.0d0) * x)) - (1.0d0 / exp(x))) / eps_m) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 1.3e+19) {
tmp = (Math.exp((x * eps_m)) + (1.0 / Math.exp((eps_m * x)))) / 2.0;
} else if (x <= 2.9e+83) {
tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0;
} else if (x <= 8.2e+275) {
tmp = (Math.exp((x * (eps_m - 1.0))) + 1.0) / 2.0;
} else {
tmp = ((Math.exp((-1.0 * x)) - (1.0 / Math.exp(x))) / eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1.3e+19: tmp = (math.exp((x * eps_m)) + (1.0 / math.exp((eps_m * x)))) / 2.0 elif x <= 2.9e+83: tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0 elif x <= 8.2e+275: tmp = (math.exp((x * (eps_m - 1.0))) + 1.0) / 2.0 else: tmp = ((math.exp((-1.0 * x)) - (1.0 / math.exp(x))) / eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1.3e+19) tmp = Float64(Float64(exp(Float64(x * eps_m)) + Float64(1.0 / exp(Float64(eps_m * x)))) / 2.0); elseif (x <= 2.9e+83) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) - Float64(Float64(1.0 / eps_m) - 1.0)) / 2.0); elseif (x <= 8.2e+275) tmp = Float64(Float64(exp(Float64(x * Float64(eps_m - 1.0))) + 1.0) / 2.0); else tmp = Float64(Float64(Float64(exp(Float64(-1.0 * x)) - Float64(1.0 / exp(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.3e+19) tmp = (exp((x * eps_m)) + (1.0 / exp((eps_m * x)))) / 2.0; elseif (x <= 2.9e+83) tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0; elseif (x <= 8.2e+275) tmp = (exp((x * (eps_m - 1.0))) + 1.0) / 2.0; else tmp = ((exp((-1.0 * x)) - (1.0 / exp(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.3e+19], N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[Exp[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.9e+83], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] - N[(N[(1.0 / eps$95$m), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 8.2e+275], N[(N[(N[Exp[N[(x * N[(eps$95$m - 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(N[Exp[N[(-1.0 * x), $MachinePrecision]], $MachinePrecision] - N[(1.0 / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.3 \cdot 10^{+19}:\\
\;\;\;\;\frac{e^{x \cdot eps\_m} + \frac{1}{e^{eps\_m \cdot x}}}{2}\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{+83}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) - \left(\frac{1}{eps\_m} - 1\right)}{2}\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{+275}:\\
\;\;\;\;\frac{e^{x \cdot \left(eps\_m - 1\right)} + 1}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{e^{-1 \cdot x} - \frac{1}{e^{x}}}{eps\_m}}{2}\\
\end{array}
\end{array}
if x < 1.3e19Initial program 61.5%
Simplified51.6%
Taylor expanded in eps around inf 99.3%
add-exp-log48.2%
expm1-define48.2%
Applied egg-rr48.2%
Taylor expanded in eps around inf 48.3%
Taylor expanded in eps around inf 99.3%
if 1.3e19 < x < 2.89999999999999999e83Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 16.4%
Taylor expanded in x around 0 72.3%
if 2.89999999999999999e83 < x < 8.1999999999999994e275Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 48.0%
if 8.1999999999999994e275 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 80.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 9e+18)
(/ (+ (exp (* x eps_m)) (/ 1.0 (exp (* eps_m x)))) 2.0)
(if (<= x 1.55e+81)
(/ (- (+ 1.0 (/ 1.0 eps_m)) (- (/ 1.0 eps_m) 1.0)) 2.0)
(/ (+ (exp (* x (- eps_m 1.0))) 1.0) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 9e+18) {
tmp = (exp((x * eps_m)) + (1.0 / exp((eps_m * x)))) / 2.0;
} else if (x <= 1.55e+81) {
tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0;
} else {
tmp = (exp((x * (eps_m - 1.0))) + 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 <= 9d+18) then
tmp = (exp((x * eps_m)) + (1.0d0 / exp((eps_m * x)))) / 2.0d0
else if (x <= 1.55d+81) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) - ((1.0d0 / eps_m) - 1.0d0)) / 2.0d0
else
tmp = (exp((x * (eps_m - 1.0d0))) + 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 <= 9e+18) {
tmp = (Math.exp((x * eps_m)) + (1.0 / Math.exp((eps_m * x)))) / 2.0;
} else if (x <= 1.55e+81) {
tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0;
} else {
tmp = (Math.exp((x * (eps_m - 1.0))) + 1.0) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 9e+18: tmp = (math.exp((x * eps_m)) + (1.0 / math.exp((eps_m * x)))) / 2.0 elif x <= 1.55e+81: tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0 else: tmp = (math.exp((x * (eps_m - 1.0))) + 1.0) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 9e+18) tmp = Float64(Float64(exp(Float64(x * eps_m)) + Float64(1.0 / exp(Float64(eps_m * x)))) / 2.0); elseif (x <= 1.55e+81) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) - Float64(Float64(1.0 / eps_m) - 1.0)) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(eps_m - 1.0))) + 1.0) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 9e+18) tmp = (exp((x * eps_m)) + (1.0 / exp((eps_m * x)))) / 2.0; elseif (x <= 1.55e+81) tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0; else tmp = (exp((x * (eps_m - 1.0))) + 1.0) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 9e+18], N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[Exp[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.55e+81], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] - N[(N[(1.0 / eps$95$m), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps$95$m - 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 9 \cdot 10^{+18}:\\
\;\;\;\;\frac{e^{x \cdot eps\_m} + \frac{1}{e^{eps\_m \cdot x}}}{2}\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{+81}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) - \left(\frac{1}{eps\_m} - 1\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(eps\_m - 1\right)} + 1}{2}\\
\end{array}
\end{array}
if x < 9e18Initial program 61.5%
Simplified51.6%
Taylor expanded in eps around inf 99.3%
add-exp-log48.2%
expm1-define48.2%
Applied egg-rr48.2%
Taylor expanded in eps around inf 48.3%
Taylor expanded in eps around inf 99.3%
if 9e18 < x < 1.55e81Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 16.4%
Taylor expanded in x around 0 72.3%
if 1.55e81 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 42.5%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* x (- eps_m 1.0))) (/ 1.0 (exp (+ x (* eps_m x))))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * (eps_m - 1.0))) + (1.0 / exp((x + (eps_m * x))))) / 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 + (eps_m * x))))) / 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 + (eps_m * x))))) / 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 + (eps_m * x))))) / 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(eps_m * x))))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((x * (eps_m - 1.0))) + (1.0 / exp((x + (eps_m * x))))) / 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[(eps$95$m * x), $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 + eps\_m \cdot x}}}{2}
\end{array}
Initial program 74.3%
Simplified67.7%
Taylor expanded in eps around inf 99.5%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* x (- eps_m 1.0))) (/ 1.0 (exp (* eps_m x)))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * (eps_m - 1.0))) + (1.0 / exp((eps_m * x)))) / 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((eps_m * x)))) / 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((eps_m * x)))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.exp((x * (eps_m - 1.0))) + (1.0 / math.exp((eps_m * x)))) / 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(eps_m * x)))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((x * (eps_m - 1.0))) + (1.0 / exp((eps_m * x)))) / 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[(eps$95$m * x), $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^{eps\_m \cdot x}}}{2}
\end{array}
Initial program 74.3%
Simplified67.7%
Taylor expanded in eps around inf 99.5%
Taylor expanded in eps around inf 88.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (* eps_m x))))
(if (<= x -6.4e-292)
(/ (+ 1.0 (/ 1.0 t_0)) 2.0)
(if (<= x 8.8e+18)
(/ (* eps_m (- (+ (/ 1.0 eps_m) (/ t_0 eps_m)) x)) 2.0)
(if (<= x 7.2e+83)
(/ (- (+ 1.0 (/ 1.0 eps_m)) (- (/ 1.0 eps_m) 1.0)) 2.0)
(/ (+ (exp (* x (- eps_m 1.0))) 1.0) 2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((eps_m * x));
double tmp;
if (x <= -6.4e-292) {
tmp = (1.0 + (1.0 / t_0)) / 2.0;
} else if (x <= 8.8e+18) {
tmp = (eps_m * (((1.0 / eps_m) + (t_0 / eps_m)) - x)) / 2.0;
} else if (x <= 7.2e+83) {
tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0;
} else {
tmp = (exp((x * (eps_m - 1.0))) + 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) :: t_0
real(8) :: tmp
t_0 = exp((eps_m * x))
if (x <= (-6.4d-292)) then
tmp = (1.0d0 + (1.0d0 / t_0)) / 2.0d0
else if (x <= 8.8d+18) then
tmp = (eps_m * (((1.0d0 / eps_m) + (t_0 / eps_m)) - x)) / 2.0d0
else if (x <= 7.2d+83) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) - ((1.0d0 / eps_m) - 1.0d0)) / 2.0d0
else
tmp = (exp((x * (eps_m - 1.0d0))) + 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 t_0 = Math.exp((eps_m * x));
double tmp;
if (x <= -6.4e-292) {
tmp = (1.0 + (1.0 / t_0)) / 2.0;
} else if (x <= 8.8e+18) {
tmp = (eps_m * (((1.0 / eps_m) + (t_0 / eps_m)) - x)) / 2.0;
} else if (x <= 7.2e+83) {
tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0;
} else {
tmp = (Math.exp((x * (eps_m - 1.0))) + 1.0) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((eps_m * x)) tmp = 0 if x <= -6.4e-292: tmp = (1.0 + (1.0 / t_0)) / 2.0 elif x <= 8.8e+18: tmp = (eps_m * (((1.0 / eps_m) + (t_0 / eps_m)) - x)) / 2.0 elif x <= 7.2e+83: tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0 else: tmp = (math.exp((x * (eps_m - 1.0))) + 1.0) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(eps_m * x)) tmp = 0.0 if (x <= -6.4e-292) tmp = Float64(Float64(1.0 + Float64(1.0 / t_0)) / 2.0); elseif (x <= 8.8e+18) tmp = Float64(Float64(eps_m * Float64(Float64(Float64(1.0 / eps_m) + Float64(t_0 / eps_m)) - x)) / 2.0); elseif (x <= 7.2e+83) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) - Float64(Float64(1.0 / eps_m) - 1.0)) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(eps_m - 1.0))) + 1.0) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp((eps_m * x)); tmp = 0.0; if (x <= -6.4e-292) tmp = (1.0 + (1.0 / t_0)) / 2.0; elseif (x <= 8.8e+18) tmp = (eps_m * (((1.0 / eps_m) + (t_0 / eps_m)) - x)) / 2.0; elseif (x <= 7.2e+83) tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0; else tmp = (exp((x * (eps_m - 1.0))) + 1.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[(eps$95$m * x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -6.4e-292], N[(N[(1.0 + N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 8.8e+18], N[(N[(eps$95$m * N[(N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(t$95$0 / eps$95$m), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 7.2e+83], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] - N[(N[(1.0 / eps$95$m), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps$95$m - 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{eps\_m \cdot x}\\
\mathbf{if}\;x \leq -6.4 \cdot 10^{-292}:\\
\;\;\;\;\frac{1 + \frac{1}{t\_0}}{2}\\
\mathbf{elif}\;x \leq 8.8 \cdot 10^{+18}:\\
\;\;\;\;\frac{eps\_m \cdot \left(\left(\frac{1}{eps\_m} + \frac{t\_0}{eps\_m}\right) - x\right)}{2}\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{+83}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) - \left(\frac{1}{eps\_m} - 1\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(eps\_m - 1\right)} + 1}{2}\\
\end{array}
\end{array}
if x < -6.4000000000000003e-292Initial program 66.3%
Simplified58.0%
Taylor expanded in eps around inf 99.5%
add-exp-log52.1%
expm1-define52.1%
Applied egg-rr52.1%
Taylor expanded in eps around inf 52.1%
Taylor expanded in x around 0 77.2%
if -6.4000000000000003e-292 < x < 8.8e18Initial program 55.4%
Simplified55.4%
Taylor expanded in x around 0 40.3%
Taylor expanded in eps around inf 84.0%
Taylor expanded in eps around inf 84.7%
if 8.8e18 < x < 7.1999999999999995e83Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 16.4%
Taylor expanded in x around 0 72.3%
if 7.1999999999999995e83 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 42.5%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -2e-281)
(/ (+ 1.0 (/ 1.0 (exp (* eps_m x)))) 2.0)
(if (<= x 1.5e+19)
(/ (+ (exp (* x eps_m)) 1.0) 2.0)
(if (<= x 4.8e+81)
(/ (- (+ 1.0 (/ 1.0 eps_m)) (- (/ 1.0 eps_m) 1.0)) 2.0)
(/ (+ (exp (* x (- eps_m 1.0))) 1.0) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -2e-281) {
tmp = (1.0 + (1.0 / exp((eps_m * x)))) / 2.0;
} else if (x <= 1.5e+19) {
tmp = (exp((x * eps_m)) + 1.0) / 2.0;
} else if (x <= 4.8e+81) {
tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0;
} else {
tmp = (exp((x * (eps_m - 1.0))) + 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 <= (-2d-281)) then
tmp = (1.0d0 + (1.0d0 / exp((eps_m * x)))) / 2.0d0
else if (x <= 1.5d+19) then
tmp = (exp((x * eps_m)) + 1.0d0) / 2.0d0
else if (x <= 4.8d+81) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) - ((1.0d0 / eps_m) - 1.0d0)) / 2.0d0
else
tmp = (exp((x * (eps_m - 1.0d0))) + 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 <= -2e-281) {
tmp = (1.0 + (1.0 / Math.exp((eps_m * x)))) / 2.0;
} else if (x <= 1.5e+19) {
tmp = (Math.exp((x * eps_m)) + 1.0) / 2.0;
} else if (x <= 4.8e+81) {
tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0;
} else {
tmp = (Math.exp((x * (eps_m - 1.0))) + 1.0) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -2e-281: tmp = (1.0 + (1.0 / math.exp((eps_m * x)))) / 2.0 elif x <= 1.5e+19: tmp = (math.exp((x * eps_m)) + 1.0) / 2.0 elif x <= 4.8e+81: tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0 else: tmp = (math.exp((x * (eps_m - 1.0))) + 1.0) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -2e-281) tmp = Float64(Float64(1.0 + Float64(1.0 / exp(Float64(eps_m * x)))) / 2.0); elseif (x <= 1.5e+19) tmp = Float64(Float64(exp(Float64(x * eps_m)) + 1.0) / 2.0); elseif (x <= 4.8e+81) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) - Float64(Float64(1.0 / eps_m) - 1.0)) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(eps_m - 1.0))) + 1.0) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -2e-281) tmp = (1.0 + (1.0 / exp((eps_m * x)))) / 2.0; elseif (x <= 1.5e+19) tmp = (exp((x * eps_m)) + 1.0) / 2.0; elseif (x <= 4.8e+81) tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0; else tmp = (exp((x * (eps_m - 1.0))) + 1.0) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -2e-281], N[(N[(1.0 + N[(1.0 / N[Exp[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.5e+19], N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 4.8e+81], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] - N[(N[(1.0 / eps$95$m), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps$95$m - 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-281}:\\
\;\;\;\;\frac{1 + \frac{1}{e^{eps\_m \cdot x}}}{2}\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{+19}:\\
\;\;\;\;\frac{e^{x \cdot eps\_m} + 1}{2}\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{+81}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) - \left(\frac{1}{eps\_m} - 1\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(eps\_m - 1\right)} + 1}{2}\\
\end{array}
\end{array}
if x < -2e-281Initial program 66.7%
Simplified58.2%
Taylor expanded in eps around inf 99.5%
add-exp-log52.2%
expm1-define52.2%
Applied egg-rr52.2%
Taylor expanded in eps around inf 52.2%
Taylor expanded in x around 0 76.7%
if -2e-281 < x < 1.5e19Initial program 55.3%
Simplified43.7%
Taylor expanded in eps around inf 99.2%
Taylor expanded in x around 0 84.0%
Taylor expanded in eps around inf 84.6%
if 1.5e19 < x < 4.79999999999999979e81Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 16.4%
Taylor expanded in x around 0 72.3%
if 4.79999999999999979e81 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 42.5%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (/ (+ (exp (* x eps_m)) 1.0) 2.0)))
(if (<= x -2e-281)
(/ (+ 1.0 (/ 1.0 (exp (* eps_m x)))) 2.0)
(if (<= x 1.3e+19)
t_0
(if (<= x 2.4e+80)
(/ (- (+ 1.0 (/ 1.0 eps_m)) (- (/ 1.0 eps_m) 1.0)) 2.0)
t_0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = (exp((x * eps_m)) + 1.0) / 2.0;
double tmp;
if (x <= -2e-281) {
tmp = (1.0 + (1.0 / exp((eps_m * x)))) / 2.0;
} else if (x <= 1.3e+19) {
tmp = t_0;
} else if (x <= 2.4e+80) {
tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0;
} else {
tmp = t_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) / 2.0d0
if (x <= (-2d-281)) then
tmp = (1.0d0 + (1.0d0 / exp((eps_m * x)))) / 2.0d0
else if (x <= 1.3d+19) then
tmp = t_0
else if (x <= 2.4d+80) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) - ((1.0d0 / eps_m) - 1.0d0)) / 2.0d0
else
tmp = t_0
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) / 2.0;
double tmp;
if (x <= -2e-281) {
tmp = (1.0 + (1.0 / Math.exp((eps_m * x)))) / 2.0;
} else if (x <= 1.3e+19) {
tmp = t_0;
} else if (x <= 2.4e+80) {
tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0;
} else {
tmp = t_0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = (math.exp((x * eps_m)) + 1.0) / 2.0 tmp = 0 if x <= -2e-281: tmp = (1.0 + (1.0 / math.exp((eps_m * x)))) / 2.0 elif x <= 1.3e+19: tmp = t_0 elif x <= 2.4e+80: tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0 else: tmp = t_0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(Float64(exp(Float64(x * eps_m)) + 1.0) / 2.0) tmp = 0.0 if (x <= -2e-281) tmp = Float64(Float64(1.0 + Float64(1.0 / exp(Float64(eps_m * x)))) / 2.0); elseif (x <= 1.3e+19) tmp = t_0; elseif (x <= 2.4e+80) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) - Float64(Float64(1.0 / eps_m) - 1.0)) / 2.0); else tmp = t_0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = (exp((x * eps_m)) + 1.0) / 2.0; tmp = 0.0; if (x <= -2e-281) tmp = (1.0 + (1.0 / exp((eps_m * x)))) / 2.0; elseif (x <= 1.3e+19) tmp = t_0; elseif (x <= 2.4e+80) tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0; else tmp = t_0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, -2e-281], N[(N[(1.0 + N[(1.0 / N[Exp[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.3e+19], t$95$0, If[LessEqual[x, 2.4e+80], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] - N[(N[(1.0 / eps$95$m), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := \frac{e^{x \cdot eps\_m} + 1}{2}\\
\mathbf{if}\;x \leq -2 \cdot 10^{-281}:\\
\;\;\;\;\frac{1 + \frac{1}{e^{eps\_m \cdot x}}}{2}\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{+19}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{+80}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) - \left(\frac{1}{eps\_m} - 1\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2e-281Initial program 66.7%
Simplified58.2%
Taylor expanded in eps around inf 99.5%
add-exp-log52.2%
expm1-define52.2%
Applied egg-rr52.2%
Taylor expanded in eps around inf 52.2%
Taylor expanded in x around 0 76.7%
if -2e-281 < x < 1.3e19 or 2.39999999999999979e80 < x Initial program 75.4%
Simplified69.1%
Taylor expanded in eps around inf 99.5%
Taylor expanded in x around 0 65.3%
Taylor expanded in eps around inf 65.5%
if 1.3e19 < x < 2.39999999999999979e80Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 16.4%
Taylor expanded in x around 0 72.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (/ (+ (exp (* x eps_m)) 1.0) 2.0)))
(if (<= x -1.0)
(/ (+ (exp (- x)) 1.0) 2.0)
(if (<= x 1.58e+19)
t_0
(if (<= x 1.6e+85)
(/ (- (+ 1.0 (/ 1.0 eps_m)) (- (/ 1.0 eps_m) 1.0)) 2.0)
t_0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = (exp((x * eps_m)) + 1.0) / 2.0;
double tmp;
if (x <= -1.0) {
tmp = (exp(-x) + 1.0) / 2.0;
} else if (x <= 1.58e+19) {
tmp = t_0;
} else if (x <= 1.6e+85) {
tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0;
} else {
tmp = t_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) / 2.0d0
if (x <= (-1.0d0)) then
tmp = (exp(-x) + 1.0d0) / 2.0d0
else if (x <= 1.58d+19) then
tmp = t_0
else if (x <= 1.6d+85) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) - ((1.0d0 / eps_m) - 1.0d0)) / 2.0d0
else
tmp = t_0
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) / 2.0;
double tmp;
if (x <= -1.0) {
tmp = (Math.exp(-x) + 1.0) / 2.0;
} else if (x <= 1.58e+19) {
tmp = t_0;
} else if (x <= 1.6e+85) {
tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0;
} else {
tmp = t_0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = (math.exp((x * eps_m)) + 1.0) / 2.0 tmp = 0 if x <= -1.0: tmp = (math.exp(-x) + 1.0) / 2.0 elif x <= 1.58e+19: tmp = t_0 elif x <= 1.6e+85: tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0 else: tmp = t_0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(Float64(exp(Float64(x * eps_m)) + 1.0) / 2.0) tmp = 0.0 if (x <= -1.0) tmp = Float64(Float64(exp(Float64(-x)) + 1.0) / 2.0); elseif (x <= 1.58e+19) tmp = t_0; elseif (x <= 1.6e+85) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) - Float64(Float64(1.0 / eps_m) - 1.0)) / 2.0); else tmp = t_0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = (exp((x * eps_m)) + 1.0) / 2.0; tmp = 0.0; if (x <= -1.0) tmp = (exp(-x) + 1.0) / 2.0; elseif (x <= 1.58e+19) tmp = t_0; elseif (x <= 1.6e+85) tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0; else tmp = t_0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, -1.0], N[(N[(N[Exp[(-x)], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.58e+19], t$95$0, If[LessEqual[x, 1.6e+85], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] - N[(N[(1.0 / eps$95$m), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := \frac{e^{x \cdot eps\_m} + 1}{2}\\
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{e^{-x} + 1}{2}\\
\mathbf{elif}\;x \leq 1.58 \cdot 10^{+19}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{+85}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) - \left(\frac{1}{eps\_m} - 1\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 48.3%
Taylor expanded in eps around 0 100.0%
*-commutative100.0%
neg-mul-1100.0%
Applied egg-rr100.0%
if -1 < x < 1.58e19 or 1.60000000000000009e85 < x Initial program 67.9%
Simplified59.6%
Taylor expanded in eps around inf 99.4%
Taylor expanded in x around 0 71.8%
Taylor expanded in eps around inf 72.2%
if 1.58e19 < x < 1.60000000000000009e85Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 16.4%
Taylor expanded in x around 0 72.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1.8e-36)
(/ (+ (* 0.5 x) (* eps_m (+ 1.0 (* -0.5 (* eps_m x))))) eps_m)
(if (<= x 0.018)
(+ 1.0 (* -0.5 (pow x 2.0)))
(if (<= x 2.8e+83)
(/ (- (+ 1.0 (/ 1.0 eps_m)) (- (/ 1.0 eps_m) 1.0)) 2.0)
(* (+ 1.0 (exp x)) 0.5)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.8e-36) {
tmp = ((0.5 * x) + (eps_m * (1.0 + (-0.5 * (eps_m * x))))) / eps_m;
} else if (x <= 0.018) {
tmp = 1.0 + (-0.5 * pow(x, 2.0));
} else if (x <= 2.8e+83) {
tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0;
} else {
tmp = (1.0 + exp(x)) * 0.5;
}
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.8d-36)) then
tmp = ((0.5d0 * x) + (eps_m * (1.0d0 + ((-0.5d0) * (eps_m * x))))) / eps_m
else if (x <= 0.018d0) then
tmp = 1.0d0 + ((-0.5d0) * (x ** 2.0d0))
else if (x <= 2.8d+83) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) - ((1.0d0 / eps_m) - 1.0d0)) / 2.0d0
else
tmp = (1.0d0 + exp(x)) * 0.5d0
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.8e-36) {
tmp = ((0.5 * x) + (eps_m * (1.0 + (-0.5 * (eps_m * x))))) / eps_m;
} else if (x <= 0.018) {
tmp = 1.0 + (-0.5 * Math.pow(x, 2.0));
} else if (x <= 2.8e+83) {
tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0;
} else {
tmp = (1.0 + Math.exp(x)) * 0.5;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.8e-36: tmp = ((0.5 * x) + (eps_m * (1.0 + (-0.5 * (eps_m * x))))) / eps_m elif x <= 0.018: tmp = 1.0 + (-0.5 * math.pow(x, 2.0)) elif x <= 2.8e+83: tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0 else: tmp = (1.0 + math.exp(x)) * 0.5 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.8e-36) tmp = Float64(Float64(Float64(0.5 * x) + Float64(eps_m * Float64(1.0 + Float64(-0.5 * Float64(eps_m * x))))) / eps_m); elseif (x <= 0.018) tmp = Float64(1.0 + Float64(-0.5 * (x ^ 2.0))); elseif (x <= 2.8e+83) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) - Float64(Float64(1.0 / eps_m) - 1.0)) / 2.0); else tmp = Float64(Float64(1.0 + exp(x)) * 0.5); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.8e-36) tmp = ((0.5 * x) + (eps_m * (1.0 + (-0.5 * (eps_m * x))))) / eps_m; elseif (x <= 0.018) tmp = 1.0 + (-0.5 * (x ^ 2.0)); elseif (x <= 2.8e+83) tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0; else tmp = (1.0 + exp(x)) * 0.5; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.8e-36], N[(N[(N[(0.5 * x), $MachinePrecision] + N[(eps$95$m * N[(1.0 + N[(-0.5 * N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision], If[LessEqual[x, 0.018], N[(1.0 + N[(-0.5 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.8e+83], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] - N[(N[(1.0 / eps$95$m), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[x], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{-36}:\\
\;\;\;\;\frac{0.5 \cdot x + eps\_m \cdot \left(1 + -0.5 \cdot \left(eps\_m \cdot x\right)\right)}{eps\_m}\\
\mathbf{elif}\;x \leq 0.018:\\
\;\;\;\;1 + -0.5 \cdot {x}^{2}\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{+83}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) - \left(\frac{1}{eps\_m} - 1\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + e^{x}\right) \cdot 0.5\\
\end{array}
\end{array}
if x < -1.80000000000000016e-36Initial program 97.4%
Simplified97.4%
Taylor expanded in x around 0 55.5%
Taylor expanded in x around 0 28.5%
Taylor expanded in eps around 0 41.1%
if -1.80000000000000016e-36 < x < 0.0179999999999999986Initial program 50.4%
Simplified50.4%
Taylor expanded in eps around 0 79.4%
Taylor expanded in x around 0 79.4%
if 0.0179999999999999986 < x < 2.8e83Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 18.7%
Taylor expanded in x around 0 67.7%
if 2.8e83 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 42.5%
Taylor expanded in eps around 0 3.1%
div-inv3.1%
+-commutative3.1%
add-sqr-sqrt0.0%
sqrt-unprod63.1%
*-commutative63.1%
*-commutative63.1%
swap-sqr63.1%
metadata-eval63.1%
*-un-lft-identity63.1%
sqrt-unprod63.1%
add-sqr-sqrt63.1%
metadata-eval63.1%
Applied egg-rr63.1%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (+ 1.0 (/ 1.0 eps_m))))
(if (<= x -1.4e-36)
(/ (+ (* 0.5 x) (* eps_m (+ 1.0 (* -0.5 (* eps_m x))))) eps_m)
(if (<= x 0.018)
(/ (+ 2.0 (* x (- (+ (* t_0 (- eps_m 1.0)) (/ 1.0 eps_m)) eps_m))) 2.0)
(if (<= x 1.5e+81)
(/ (- t_0 (- (/ 1.0 eps_m) 1.0)) 2.0)
(* (+ 1.0 (exp x)) 0.5))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = 1.0 + (1.0 / eps_m);
double tmp;
if (x <= -1.4e-36) {
tmp = ((0.5 * x) + (eps_m * (1.0 + (-0.5 * (eps_m * x))))) / eps_m;
} else if (x <= 0.018) {
tmp = (2.0 + (x * (((t_0 * (eps_m - 1.0)) + (1.0 / eps_m)) - eps_m))) / 2.0;
} else if (x <= 1.5e+81) {
tmp = (t_0 - ((1.0 / eps_m) - 1.0)) / 2.0;
} else {
tmp = (1.0 + exp(x)) * 0.5;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (1.0d0 / eps_m)
if (x <= (-1.4d-36)) then
tmp = ((0.5d0 * x) + (eps_m * (1.0d0 + ((-0.5d0) * (eps_m * x))))) / eps_m
else if (x <= 0.018d0) then
tmp = (2.0d0 + (x * (((t_0 * (eps_m - 1.0d0)) + (1.0d0 / eps_m)) - eps_m))) / 2.0d0
else if (x <= 1.5d+81) then
tmp = (t_0 - ((1.0d0 / eps_m) - 1.0d0)) / 2.0d0
else
tmp = (1.0d0 + exp(x)) * 0.5d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = 1.0 + (1.0 / eps_m);
double tmp;
if (x <= -1.4e-36) {
tmp = ((0.5 * x) + (eps_m * (1.0 + (-0.5 * (eps_m * x))))) / eps_m;
} else if (x <= 0.018) {
tmp = (2.0 + (x * (((t_0 * (eps_m - 1.0)) + (1.0 / eps_m)) - eps_m))) / 2.0;
} else if (x <= 1.5e+81) {
tmp = (t_0 - ((1.0 / eps_m) - 1.0)) / 2.0;
} else {
tmp = (1.0 + Math.exp(x)) * 0.5;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = 1.0 + (1.0 / eps_m) tmp = 0 if x <= -1.4e-36: tmp = ((0.5 * x) + (eps_m * (1.0 + (-0.5 * (eps_m * x))))) / eps_m elif x <= 0.018: tmp = (2.0 + (x * (((t_0 * (eps_m - 1.0)) + (1.0 / eps_m)) - eps_m))) / 2.0 elif x <= 1.5e+81: tmp = (t_0 - ((1.0 / eps_m) - 1.0)) / 2.0 else: tmp = (1.0 + math.exp(x)) * 0.5 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(1.0 + Float64(1.0 / eps_m)) tmp = 0.0 if (x <= -1.4e-36) tmp = Float64(Float64(Float64(0.5 * x) + Float64(eps_m * Float64(1.0 + Float64(-0.5 * Float64(eps_m * x))))) / eps_m); elseif (x <= 0.018) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(t_0 * Float64(eps_m - 1.0)) + Float64(1.0 / eps_m)) - eps_m))) / 2.0); elseif (x <= 1.5e+81) tmp = Float64(Float64(t_0 - Float64(Float64(1.0 / eps_m) - 1.0)) / 2.0); else tmp = Float64(Float64(1.0 + exp(x)) * 0.5); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = 1.0 + (1.0 / eps_m); tmp = 0.0; if (x <= -1.4e-36) tmp = ((0.5 * x) + (eps_m * (1.0 + (-0.5 * (eps_m * x))))) / eps_m; elseif (x <= 0.018) tmp = (2.0 + (x * (((t_0 * (eps_m - 1.0)) + (1.0 / eps_m)) - eps_m))) / 2.0; elseif (x <= 1.5e+81) tmp = (t_0 - ((1.0 / eps_m) - 1.0)) / 2.0; else tmp = (1.0 + exp(x)) * 0.5; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.4e-36], N[(N[(N[(0.5 * x), $MachinePrecision] + N[(eps$95$m * N[(1.0 + N[(-0.5 * N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision], If[LessEqual[x, 0.018], N[(N[(2.0 + N[(x * N[(N[(N[(t$95$0 * N[(eps$95$m - 1.0), $MachinePrecision]), $MachinePrecision] + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.5e+81], N[(N[(t$95$0 - N[(N[(1.0 / eps$95$m), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[x], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := 1 + \frac{1}{eps\_m}\\
\mathbf{if}\;x \leq -1.4 \cdot 10^{-36}:\\
\;\;\;\;\frac{0.5 \cdot x + eps\_m \cdot \left(1 + -0.5 \cdot \left(eps\_m \cdot x\right)\right)}{eps\_m}\\
\mathbf{elif}\;x \leq 0.018:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(t\_0 \cdot \left(eps\_m - 1\right) + \frac{1}{eps\_m}\right) - eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{+81}:\\
\;\;\;\;\frac{t\_0 - \left(\frac{1}{eps\_m} - 1\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + e^{x}\right) \cdot 0.5\\
\end{array}
\end{array}
if x < -1.4000000000000001e-36Initial program 97.4%
Simplified97.4%
Taylor expanded in x around 0 55.5%
Taylor expanded in x around 0 28.5%
Taylor expanded in eps around 0 41.1%
if -1.4000000000000001e-36 < x < 0.0179999999999999986Initial program 50.4%
Simplified40.5%
Taylor expanded in x around 0 79.3%
if 0.0179999999999999986 < x < 1.49999999999999999e81Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 18.7%
Taylor expanded in x around 0 67.7%
if 1.49999999999999999e81 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 42.5%
Taylor expanded in eps around 0 3.1%
div-inv3.1%
+-commutative3.1%
add-sqr-sqrt0.0%
sqrt-unprod63.1%
*-commutative63.1%
*-commutative63.1%
swap-sqr63.1%
metadata-eval63.1%
*-un-lft-identity63.1%
sqrt-unprod63.1%
add-sqr-sqrt63.1%
metadata-eval63.1%
Applied egg-rr63.1%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 0.018)
(/ (+ (exp (- x)) 1.0) 2.0)
(if (<= x 7.8e+80)
(/ (- (+ 1.0 (/ 1.0 eps_m)) (- (/ 1.0 eps_m) 1.0)) 2.0)
(* (+ 1.0 (exp x)) 0.5))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 0.018) {
tmp = (exp(-x) + 1.0) / 2.0;
} else if (x <= 7.8e+80) {
tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0;
} else {
tmp = (1.0 + exp(x)) * 0.5;
}
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.018d0) then
tmp = (exp(-x) + 1.0d0) / 2.0d0
else if (x <= 7.8d+80) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) - ((1.0d0 / eps_m) - 1.0d0)) / 2.0d0
else
tmp = (1.0d0 + exp(x)) * 0.5d0
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.018) {
tmp = (Math.exp(-x) + 1.0) / 2.0;
} else if (x <= 7.8e+80) {
tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0;
} else {
tmp = (1.0 + Math.exp(x)) * 0.5;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 0.018: tmp = (math.exp(-x) + 1.0) / 2.0 elif x <= 7.8e+80: tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0 else: tmp = (1.0 + math.exp(x)) * 0.5 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 0.018) tmp = Float64(Float64(exp(Float64(-x)) + 1.0) / 2.0); elseif (x <= 7.8e+80) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) - Float64(Float64(1.0 / eps_m) - 1.0)) / 2.0); else tmp = Float64(Float64(1.0 + exp(x)) * 0.5); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 0.018) tmp = (exp(-x) + 1.0) / 2.0; elseif (x <= 7.8e+80) tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0; else tmp = (1.0 + exp(x)) * 0.5; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 0.018], N[(N[(N[Exp[(-x)], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 7.8e+80], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] - N[(N[(1.0 / eps$95$m), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[x], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.018:\\
\;\;\;\;\frac{e^{-x} + 1}{2}\\
\mathbf{elif}\;x \leq 7.8 \cdot 10^{+80}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) - \left(\frac{1}{eps\_m} - 1\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + e^{x}\right) \cdot 0.5\\
\end{array}
\end{array}
if x < 0.0179999999999999986Initial program 60.8%
Simplified50.7%
Taylor expanded in eps around inf 99.3%
Taylor expanded in x around 0 79.5%
Taylor expanded in eps around 0 79.8%
*-commutative79.8%
neg-mul-179.8%
Applied egg-rr79.8%
if 0.0179999999999999986 < x < 7.79999999999999998e80Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 18.7%
Taylor expanded in x around 0 67.7%
if 7.79999999999999998e80 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 42.5%
Taylor expanded in eps around 0 3.1%
div-inv3.1%
+-commutative3.1%
add-sqr-sqrt0.0%
sqrt-unprod63.1%
*-commutative63.1%
*-commutative63.1%
swap-sqr63.1%
metadata-eval63.1%
*-un-lft-identity63.1%
sqrt-unprod63.1%
add-sqr-sqrt63.1%
metadata-eval63.1%
Applied egg-rr63.1%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (+ 1.0 (/ 1.0 eps_m))))
(if (<= x -3.4e-37)
(/ (+ (* 0.5 x) (* eps_m (+ 1.0 (* -0.5 (* eps_m x))))) eps_m)
(if (<= x 0.018)
(/ (+ 2.0 (* x (- (+ (* t_0 (- eps_m 1.0)) (/ 1.0 eps_m)) eps_m))) 2.0)
(if (<= x 2.3e+182)
(/ (- t_0 (- (/ 1.0 eps_m) 1.0)) 2.0)
(+ 1.0 (* x (- (* 0.25 x) 0.5))))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = 1.0 + (1.0 / eps_m);
double tmp;
if (x <= -3.4e-37) {
tmp = ((0.5 * x) + (eps_m * (1.0 + (-0.5 * (eps_m * x))))) / eps_m;
} else if (x <= 0.018) {
tmp = (2.0 + (x * (((t_0 * (eps_m - 1.0)) + (1.0 / eps_m)) - eps_m))) / 2.0;
} else if (x <= 2.3e+182) {
tmp = (t_0 - ((1.0 / eps_m) - 1.0)) / 2.0;
} else {
tmp = 1.0 + (x * ((0.25 * x) - 0.5));
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (1.0d0 / eps_m)
if (x <= (-3.4d-37)) then
tmp = ((0.5d0 * x) + (eps_m * (1.0d0 + ((-0.5d0) * (eps_m * x))))) / eps_m
else if (x <= 0.018d0) then
tmp = (2.0d0 + (x * (((t_0 * (eps_m - 1.0d0)) + (1.0d0 / eps_m)) - eps_m))) / 2.0d0
else if (x <= 2.3d+182) then
tmp = (t_0 - ((1.0d0 / eps_m) - 1.0d0)) / 2.0d0
else
tmp = 1.0d0 + (x * ((0.25d0 * x) - 0.5d0))
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = 1.0 + (1.0 / eps_m);
double tmp;
if (x <= -3.4e-37) {
tmp = ((0.5 * x) + (eps_m * (1.0 + (-0.5 * (eps_m * x))))) / eps_m;
} else if (x <= 0.018) {
tmp = (2.0 + (x * (((t_0 * (eps_m - 1.0)) + (1.0 / eps_m)) - eps_m))) / 2.0;
} else if (x <= 2.3e+182) {
tmp = (t_0 - ((1.0 / eps_m) - 1.0)) / 2.0;
} else {
tmp = 1.0 + (x * ((0.25 * x) - 0.5));
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = 1.0 + (1.0 / eps_m) tmp = 0 if x <= -3.4e-37: tmp = ((0.5 * x) + (eps_m * (1.0 + (-0.5 * (eps_m * x))))) / eps_m elif x <= 0.018: tmp = (2.0 + (x * (((t_0 * (eps_m - 1.0)) + (1.0 / eps_m)) - eps_m))) / 2.0 elif x <= 2.3e+182: tmp = (t_0 - ((1.0 / eps_m) - 1.0)) / 2.0 else: tmp = 1.0 + (x * ((0.25 * x) - 0.5)) return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(1.0 + Float64(1.0 / eps_m)) tmp = 0.0 if (x <= -3.4e-37) tmp = Float64(Float64(Float64(0.5 * x) + Float64(eps_m * Float64(1.0 + Float64(-0.5 * Float64(eps_m * x))))) / eps_m); elseif (x <= 0.018) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(t_0 * Float64(eps_m - 1.0)) + Float64(1.0 / eps_m)) - eps_m))) / 2.0); elseif (x <= 2.3e+182) tmp = Float64(Float64(t_0 - Float64(Float64(1.0 / eps_m) - 1.0)) / 2.0); else tmp = Float64(1.0 + Float64(x * Float64(Float64(0.25 * x) - 0.5))); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = 1.0 + (1.0 / eps_m); tmp = 0.0; if (x <= -3.4e-37) tmp = ((0.5 * x) + (eps_m * (1.0 + (-0.5 * (eps_m * x))))) / eps_m; elseif (x <= 0.018) tmp = (2.0 + (x * (((t_0 * (eps_m - 1.0)) + (1.0 / eps_m)) - eps_m))) / 2.0; elseif (x <= 2.3e+182) tmp = (t_0 - ((1.0 / eps_m) - 1.0)) / 2.0; else tmp = 1.0 + (x * ((0.25 * x) - 0.5)); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.4e-37], N[(N[(N[(0.5 * x), $MachinePrecision] + N[(eps$95$m * N[(1.0 + N[(-0.5 * N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision], If[LessEqual[x, 0.018], N[(N[(2.0 + N[(x * N[(N[(N[(t$95$0 * N[(eps$95$m - 1.0), $MachinePrecision]), $MachinePrecision] + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.3e+182], N[(N[(t$95$0 - N[(N[(1.0 / eps$95$m), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(1.0 + N[(x * N[(N[(0.25 * x), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := 1 + \frac{1}{eps\_m}\\
\mathbf{if}\;x \leq -3.4 \cdot 10^{-37}:\\
\;\;\;\;\frac{0.5 \cdot x + eps\_m \cdot \left(1 + -0.5 \cdot \left(eps\_m \cdot x\right)\right)}{eps\_m}\\
\mathbf{elif}\;x \leq 0.018:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(t\_0 \cdot \left(eps\_m - 1\right) + \frac{1}{eps\_m}\right) - eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{+182}:\\
\;\;\;\;\frac{t\_0 - \left(\frac{1}{eps\_m} - 1\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(0.25 \cdot x - 0.5\right)\\
\end{array}
\end{array}
if x < -3.40000000000000018e-37Initial program 97.4%
Simplified97.4%
Taylor expanded in x around 0 55.5%
Taylor expanded in x around 0 28.5%
Taylor expanded in eps around 0 41.1%
if -3.40000000000000018e-37 < x < 0.0179999999999999986Initial program 50.4%
Simplified40.5%
Taylor expanded in x around 0 79.3%
if 0.0179999999999999986 < x < 2.3e182Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 31.0%
Taylor expanded in x around 0 49.5%
if 2.3e182 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 41.9%
Taylor expanded in eps around 0 3.1%
Taylor expanded in x around 0 58.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1.25e-36)
(/ (+ (* 0.5 x) (* eps_m (+ 1.0 (* -0.5 (* eps_m x))))) eps_m)
(if (<= x 0.018)
1.0
(if (<= x 3.6e+182)
(/ (- (+ 1.0 (/ 1.0 eps_m)) (- (/ 1.0 eps_m) 1.0)) 2.0)
(+ 1.0 (* x (- (* 0.25 x) 0.5)))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.25e-36) {
tmp = ((0.5 * x) + (eps_m * (1.0 + (-0.5 * (eps_m * x))))) / eps_m;
} else if (x <= 0.018) {
tmp = 1.0;
} else if (x <= 3.6e+182) {
tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0;
} else {
tmp = 1.0 + (x * ((0.25 * x) - 0.5));
}
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.25d-36)) then
tmp = ((0.5d0 * x) + (eps_m * (1.0d0 + ((-0.5d0) * (eps_m * x))))) / eps_m
else if (x <= 0.018d0) then
tmp = 1.0d0
else if (x <= 3.6d+182) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) - ((1.0d0 / eps_m) - 1.0d0)) / 2.0d0
else
tmp = 1.0d0 + (x * ((0.25d0 * x) - 0.5d0))
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.25e-36) {
tmp = ((0.5 * x) + (eps_m * (1.0 + (-0.5 * (eps_m * x))))) / eps_m;
} else if (x <= 0.018) {
tmp = 1.0;
} else if (x <= 3.6e+182) {
tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0;
} else {
tmp = 1.0 + (x * ((0.25 * x) - 0.5));
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.25e-36: tmp = ((0.5 * x) + (eps_m * (1.0 + (-0.5 * (eps_m * x))))) / eps_m elif x <= 0.018: tmp = 1.0 elif x <= 3.6e+182: tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0 else: tmp = 1.0 + (x * ((0.25 * x) - 0.5)) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.25e-36) tmp = Float64(Float64(Float64(0.5 * x) + Float64(eps_m * Float64(1.0 + Float64(-0.5 * Float64(eps_m * x))))) / eps_m); elseif (x <= 0.018) tmp = 1.0; elseif (x <= 3.6e+182) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) - Float64(Float64(1.0 / eps_m) - 1.0)) / 2.0); else tmp = Float64(1.0 + Float64(x * Float64(Float64(0.25 * x) - 0.5))); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.25e-36) tmp = ((0.5 * x) + (eps_m * (1.0 + (-0.5 * (eps_m * x))))) / eps_m; elseif (x <= 0.018) tmp = 1.0; elseif (x <= 3.6e+182) tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0; else tmp = 1.0 + (x * ((0.25 * x) - 0.5)); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.25e-36], N[(N[(N[(0.5 * x), $MachinePrecision] + N[(eps$95$m * N[(1.0 + N[(-0.5 * N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision], If[LessEqual[x, 0.018], 1.0, If[LessEqual[x, 3.6e+182], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] - N[(N[(1.0 / eps$95$m), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(1.0 + N[(x * N[(N[(0.25 * x), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.25 \cdot 10^{-36}:\\
\;\;\;\;\frac{0.5 \cdot x + eps\_m \cdot \left(1 + -0.5 \cdot \left(eps\_m \cdot x\right)\right)}{eps\_m}\\
\mathbf{elif}\;x \leq 0.018:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{+182}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) - \left(\frac{1}{eps\_m} - 1\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(0.25 \cdot x - 0.5\right)\\
\end{array}
\end{array}
if x < -1.25000000000000001e-36Initial program 97.4%
Simplified97.4%
Taylor expanded in x around 0 55.5%
Taylor expanded in x around 0 28.5%
Taylor expanded in eps around 0 41.1%
if -1.25000000000000001e-36 < x < 0.0179999999999999986Initial program 50.4%
Simplified40.5%
Taylor expanded in x around 0 79.3%
if 0.0179999999999999986 < x < 3.6e182Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 31.0%
Taylor expanded in x around 0 49.5%
if 3.6e182 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 41.9%
Taylor expanded in eps around 0 3.1%
Taylor expanded in x around 0 58.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 0.018)
(+ 1.0 (* x (- (* x (+ 0.25 (* -0.08333333333333333 x))) 0.5)))
(if (<= x 7.2e+182)
(/ (- (+ 1.0 (/ 1.0 eps_m)) (- (/ 1.0 eps_m) 1.0)) 2.0)
(+ 1.0 (* x (- (* 0.25 x) 0.5))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 0.018) {
tmp = 1.0 + (x * ((x * (0.25 + (-0.08333333333333333 * x))) - 0.5));
} else if (x <= 7.2e+182) {
tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0;
} else {
tmp = 1.0 + (x * ((0.25 * x) - 0.5));
}
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.018d0) then
tmp = 1.0d0 + (x * ((x * (0.25d0 + ((-0.08333333333333333d0) * x))) - 0.5d0))
else if (x <= 7.2d+182) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) - ((1.0d0 / eps_m) - 1.0d0)) / 2.0d0
else
tmp = 1.0d0 + (x * ((0.25d0 * x) - 0.5d0))
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.018) {
tmp = 1.0 + (x * ((x * (0.25 + (-0.08333333333333333 * x))) - 0.5));
} else if (x <= 7.2e+182) {
tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0;
} else {
tmp = 1.0 + (x * ((0.25 * x) - 0.5));
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 0.018: tmp = 1.0 + (x * ((x * (0.25 + (-0.08333333333333333 * x))) - 0.5)) elif x <= 7.2e+182: tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0 else: tmp = 1.0 + (x * ((0.25 * x) - 0.5)) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 0.018) tmp = Float64(1.0 + Float64(x * Float64(Float64(x * Float64(0.25 + Float64(-0.08333333333333333 * x))) - 0.5))); elseif (x <= 7.2e+182) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) - Float64(Float64(1.0 / eps_m) - 1.0)) / 2.0); else tmp = Float64(1.0 + Float64(x * Float64(Float64(0.25 * x) - 0.5))); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 0.018) tmp = 1.0 + (x * ((x * (0.25 + (-0.08333333333333333 * x))) - 0.5)); elseif (x <= 7.2e+182) tmp = ((1.0 + (1.0 / eps_m)) - ((1.0 / eps_m) - 1.0)) / 2.0; else tmp = 1.0 + (x * ((0.25 * x) - 0.5)); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 0.018], N[(1.0 + N[(x * N[(N[(x * N[(0.25 + N[(-0.08333333333333333 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.2e+182], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] - N[(N[(1.0 / eps$95$m), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(1.0 + N[(x * N[(N[(0.25 * x), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.018:\\
\;\;\;\;1 + x \cdot \left(x \cdot \left(0.25 + -0.08333333333333333 \cdot x\right) - 0.5\right)\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{+182}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) - \left(\frac{1}{eps\_m} - 1\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(0.25 \cdot x - 0.5\right)\\
\end{array}
\end{array}
if x < 0.0179999999999999986Initial program 60.8%
Simplified50.7%
Taylor expanded in eps around inf 99.3%
Taylor expanded in x around 0 79.5%
Taylor expanded in eps around 0 79.8%
Taylor expanded in x around 0 74.3%
if 0.0179999999999999986 < x < 7.2e182Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 31.0%
Taylor expanded in x around 0 49.5%
if 7.2e182 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 41.9%
Taylor expanded in eps around 0 3.1%
Taylor expanded in x around 0 58.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 3e-53)
(+ 1.0 (* x (- (* x (+ 0.25 (* -0.08333333333333333 x))) 0.5)))
(if (<= x 1.9e+160)
(/ (* eps_m (+ (/ 2.0 eps_m) x)) 2.0)
(+ 1.0 (* x (- (* 0.25 x) 0.5))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 3e-53) {
tmp = 1.0 + (x * ((x * (0.25 + (-0.08333333333333333 * x))) - 0.5));
} else if (x <= 1.9e+160) {
tmp = (eps_m * ((2.0 / eps_m) + x)) / 2.0;
} else {
tmp = 1.0 + (x * ((0.25 * x) - 0.5));
}
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 <= 3d-53) then
tmp = 1.0d0 + (x * ((x * (0.25d0 + ((-0.08333333333333333d0) * x))) - 0.5d0))
else if (x <= 1.9d+160) then
tmp = (eps_m * ((2.0d0 / eps_m) + x)) / 2.0d0
else
tmp = 1.0d0 + (x * ((0.25d0 * x) - 0.5d0))
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 3e-53) {
tmp = 1.0 + (x * ((x * (0.25 + (-0.08333333333333333 * x))) - 0.5));
} else if (x <= 1.9e+160) {
tmp = (eps_m * ((2.0 / eps_m) + x)) / 2.0;
} else {
tmp = 1.0 + (x * ((0.25 * x) - 0.5));
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 3e-53: tmp = 1.0 + (x * ((x * (0.25 + (-0.08333333333333333 * x))) - 0.5)) elif x <= 1.9e+160: tmp = (eps_m * ((2.0 / eps_m) + x)) / 2.0 else: tmp = 1.0 + (x * ((0.25 * x) - 0.5)) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 3e-53) tmp = Float64(1.0 + Float64(x * Float64(Float64(x * Float64(0.25 + Float64(-0.08333333333333333 * x))) - 0.5))); elseif (x <= 1.9e+160) tmp = Float64(Float64(eps_m * Float64(Float64(2.0 / eps_m) + x)) / 2.0); else tmp = Float64(1.0 + Float64(x * Float64(Float64(0.25 * x) - 0.5))); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 3e-53) tmp = 1.0 + (x * ((x * (0.25 + (-0.08333333333333333 * x))) - 0.5)); elseif (x <= 1.9e+160) tmp = (eps_m * ((2.0 / eps_m) + x)) / 2.0; else tmp = 1.0 + (x * ((0.25 * x) - 0.5)); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 3e-53], N[(1.0 + N[(x * N[(N[(x * N[(0.25 + N[(-0.08333333333333333 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.9e+160], N[(N[(eps$95$m * N[(N[(2.0 / eps$95$m), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(1.0 + N[(x * N[(N[(0.25 * x), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3 \cdot 10^{-53}:\\
\;\;\;\;1 + x \cdot \left(x \cdot \left(0.25 + -0.08333333333333333 \cdot x\right) - 0.5\right)\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{+160}:\\
\;\;\;\;\frac{eps\_m \cdot \left(\frac{2}{eps\_m} + x\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(0.25 \cdot x - 0.5\right)\\
\end{array}
\end{array}
if x < 3.0000000000000002e-53Initial program 62.7%
Simplified53.1%
Taylor expanded in eps around inf 99.7%
Taylor expanded in x around 0 79.5%
Taylor expanded in eps around 0 81.1%
Taylor expanded in x around 0 75.2%
if 3.0000000000000002e-53 < x < 1.90000000000000006e160Initial program 85.6%
Simplified85.6%
Taylor expanded in x around 0 31.5%
Taylor expanded in eps around inf 48.8%
Taylor expanded in x around 0 24.0%
sub-neg24.0%
neg-mul-124.0%
*-commutative24.0%
add-sqr-sqrt0.0%
sqrt-unprod20.7%
*-commutative20.7%
*-commutative20.7%
swap-sqr20.7%
metadata-eval20.7%
*-un-lft-identity20.7%
sqrt-unprod20.7%
add-sqr-sqrt20.7%
Applied egg-rr20.7%
if 1.90000000000000006e160 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 41.0%
Taylor expanded in eps around 0 3.1%
Taylor expanded in x around 0 57.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -4.3e-292)
(+ 1.0 (* -0.5 (* eps_m x)))
(if (<= x 1.9e+160)
(/ (* eps_m (+ (/ 2.0 eps_m) x)) 2.0)
(+ 1.0 (* x (- (* 0.25 x) 0.5))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -4.3e-292) {
tmp = 1.0 + (-0.5 * (eps_m * x));
} else if (x <= 1.9e+160) {
tmp = (eps_m * ((2.0 / eps_m) + x)) / 2.0;
} else {
tmp = 1.0 + (x * ((0.25 * x) - 0.5));
}
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.3d-292)) then
tmp = 1.0d0 + ((-0.5d0) * (eps_m * x))
else if (x <= 1.9d+160) then
tmp = (eps_m * ((2.0d0 / eps_m) + x)) / 2.0d0
else
tmp = 1.0d0 + (x * ((0.25d0 * x) - 0.5d0))
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.3e-292) {
tmp = 1.0 + (-0.5 * (eps_m * x));
} else if (x <= 1.9e+160) {
tmp = (eps_m * ((2.0 / eps_m) + x)) / 2.0;
} else {
tmp = 1.0 + (x * ((0.25 * x) - 0.5));
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -4.3e-292: tmp = 1.0 + (-0.5 * (eps_m * x)) elif x <= 1.9e+160: tmp = (eps_m * ((2.0 / eps_m) + x)) / 2.0 else: tmp = 1.0 + (x * ((0.25 * x) - 0.5)) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -4.3e-292) tmp = Float64(1.0 + Float64(-0.5 * Float64(eps_m * x))); elseif (x <= 1.9e+160) tmp = Float64(Float64(eps_m * Float64(Float64(2.0 / eps_m) + x)) / 2.0); else tmp = Float64(1.0 + Float64(x * Float64(Float64(0.25 * x) - 0.5))); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -4.3e-292) tmp = 1.0 + (-0.5 * (eps_m * x)); elseif (x <= 1.9e+160) tmp = (eps_m * ((2.0 / eps_m) + x)) / 2.0; else tmp = 1.0 + (x * ((0.25 * x) - 0.5)); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -4.3e-292], N[(1.0 + N[(-0.5 * N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.9e+160], N[(N[(eps$95$m * N[(N[(2.0 / eps$95$m), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(1.0 + N[(x * N[(N[(0.25 * x), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.3 \cdot 10^{-292}:\\
\;\;\;\;1 + -0.5 \cdot \left(eps\_m \cdot x\right)\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{+160}:\\
\;\;\;\;\frac{eps\_m \cdot \left(\frac{2}{eps\_m} + x\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(0.25 \cdot x - 0.5\right)\\
\end{array}
\end{array}
if x < -4.3e-292Initial program 66.3%
Simplified66.3%
Taylor expanded in x around 0 44.0%
Taylor expanded in eps around inf 85.4%
Taylor expanded in x around 0 62.5%
Taylor expanded in eps around 0 62.6%
if -4.3e-292 < x < 1.90000000000000006e160Initial program 70.5%
Simplified70.5%
Taylor expanded in x around 0 38.5%
Taylor expanded in eps around inf 69.3%
Taylor expanded in x around 0 52.0%
sub-neg52.0%
neg-mul-152.0%
*-commutative52.0%
add-sqr-sqrt1.7%
sqrt-unprod50.5%
*-commutative50.5%
*-commutative50.5%
swap-sqr50.5%
metadata-eval50.5%
*-un-lft-identity50.5%
sqrt-unprod48.7%
add-sqr-sqrt50.5%
Applied egg-rr50.5%
if 1.90000000000000006e160 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 41.0%
Taylor expanded in eps around 0 3.1%
Taylor expanded in x around 0 57.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 0.018)
(+ 1.0 (* -0.5 (* eps_m x)))
(if (<= x 1.9e+160)
(* -0.5 (- (* eps_m x)))
(+ 1.0 (* x (- (* 0.25 x) 0.5))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 0.018) {
tmp = 1.0 + (-0.5 * (eps_m * x));
} else if (x <= 1.9e+160) {
tmp = -0.5 * -(eps_m * x);
} else {
tmp = 1.0 + (x * ((0.25 * x) - 0.5));
}
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.018d0) then
tmp = 1.0d0 + ((-0.5d0) * (eps_m * x))
else if (x <= 1.9d+160) then
tmp = (-0.5d0) * -(eps_m * x)
else
tmp = 1.0d0 + (x * ((0.25d0 * x) - 0.5d0))
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.018) {
tmp = 1.0 + (-0.5 * (eps_m * x));
} else if (x <= 1.9e+160) {
tmp = -0.5 * -(eps_m * x);
} else {
tmp = 1.0 + (x * ((0.25 * x) - 0.5));
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 0.018: tmp = 1.0 + (-0.5 * (eps_m * x)) elif x <= 1.9e+160: tmp = -0.5 * -(eps_m * x) else: tmp = 1.0 + (x * ((0.25 * x) - 0.5)) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 0.018) tmp = Float64(1.0 + Float64(-0.5 * Float64(eps_m * x))); elseif (x <= 1.9e+160) tmp = Float64(-0.5 * Float64(-Float64(eps_m * x))); else tmp = Float64(1.0 + Float64(x * Float64(Float64(0.25 * x) - 0.5))); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 0.018) tmp = 1.0 + (-0.5 * (eps_m * x)); elseif (x <= 1.9e+160) tmp = -0.5 * -(eps_m * x); else tmp = 1.0 + (x * ((0.25 * x) - 0.5)); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 0.018], N[(1.0 + N[(-0.5 * N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.9e+160], N[(-0.5 * (-N[(eps$95$m * x), $MachinePrecision])), $MachinePrecision], N[(1.0 + N[(x * N[(N[(0.25 * x), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.018:\\
\;\;\;\;1 + -0.5 \cdot \left(eps\_m \cdot x\right)\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{+160}:\\
\;\;\;\;-0.5 \cdot \left(-eps\_m \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(0.25 \cdot x - 0.5\right)\\
\end{array}
\end{array}
if x < 0.0179999999999999986Initial program 60.8%
Simplified60.8%
Taylor expanded in x around 0 42.5%
Taylor expanded in eps around inf 85.7%
Taylor expanded in x around 0 68.0%
Taylor expanded in eps around 0 68.1%
if 0.0179999999999999986 < x < 1.90000000000000006e160Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 35.0%
Taylor expanded in eps around inf 12.2%
Taylor expanded in eps around 0 12.2%
add-sqr-sqrt12.2%
sqrt-unprod12.2%
*-un-lft-identity12.2%
metadata-eval12.2%
swap-sqr12.2%
*-commutative12.2%
*-commutative12.2%
sqrt-unprod0.0%
add-sqr-sqrt8.1%
*-commutative8.1%
neg-mul-18.1%
distribute-rgt-neg-in8.1%
Applied egg-rr8.1%
if 1.90000000000000006e160 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 41.0%
Taylor expanded in eps around 0 3.1%
Taylor expanded in x around 0 57.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.0) (* -0.5 (* eps_m x)) (if (<= x 0.018) 1.0 (* -0.5 (- (* eps_m x))))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.0) {
tmp = -0.5 * (eps_m * x);
} else if (x <= 0.018) {
tmp = 1.0;
} else {
tmp = -0.5 * -(eps_m * x);
}
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 = (-0.5d0) * (eps_m * x)
else if (x <= 0.018d0) then
tmp = 1.0d0
else
tmp = (-0.5d0) * -(eps_m * x)
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 = -0.5 * (eps_m * x);
} else if (x <= 0.018) {
tmp = 1.0;
} else {
tmp = -0.5 * -(eps_m * x);
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.0: tmp = -0.5 * (eps_m * x) elif x <= 0.018: tmp = 1.0 else: tmp = -0.5 * -(eps_m * x) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.0) tmp = Float64(-0.5 * Float64(eps_m * x)); elseif (x <= 0.018) tmp = 1.0; else tmp = Float64(-0.5 * Float64(-Float64(eps_m * x))); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.0) tmp = -0.5 * (eps_m * x); elseif (x <= 0.018) tmp = 1.0; else tmp = -0.5 * -(eps_m * x); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.0], N[(-0.5 * N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.018], 1.0, N[(-0.5 * (-N[(eps$95$m * x), $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;-0.5 \cdot \left(eps\_m \cdot x\right)\\
\mathbf{elif}\;x \leq 0.018:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \left(-eps\_m \cdot x\right)\\
\end{array}
\end{array}
if x < -1Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 54.5%
Taylor expanded in eps around inf 34.6%
Taylor expanded in eps around 0 34.6%
if -1 < x < 0.0179999999999999986Initial program 52.3%
Simplified40.0%
Taylor expanded in x around 0 76.0%
if 0.0179999999999999986 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 29.9%
Taylor expanded in eps around inf 12.4%
Taylor expanded in eps around 0 12.4%
add-sqr-sqrt12.4%
sqrt-unprod15.3%
*-un-lft-identity15.3%
metadata-eval15.3%
swap-sqr15.3%
*-commutative15.3%
*-commutative15.3%
sqrt-unprod0.0%
add-sqr-sqrt18.6%
*-commutative18.6%
neg-mul-118.6%
distribute-rgt-neg-in18.6%
Applied egg-rr18.6%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 0.018) (+ 1.0 (* -0.5 (* eps_m x))) (* -0.5 (- (* eps_m x)))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 0.018) {
tmp = 1.0 + (-0.5 * (eps_m * x));
} else {
tmp = -0.5 * -(eps_m * x);
}
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.018d0) then
tmp = 1.0d0 + ((-0.5d0) * (eps_m * x))
else
tmp = (-0.5d0) * -(eps_m * x)
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.018) {
tmp = 1.0 + (-0.5 * (eps_m * x));
} else {
tmp = -0.5 * -(eps_m * x);
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 0.018: tmp = 1.0 + (-0.5 * (eps_m * x)) else: tmp = -0.5 * -(eps_m * x) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 0.018) tmp = Float64(1.0 + Float64(-0.5 * Float64(eps_m * x))); else tmp = Float64(-0.5 * Float64(-Float64(eps_m * x))); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 0.018) tmp = 1.0 + (-0.5 * (eps_m * x)); else tmp = -0.5 * -(eps_m * x); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 0.018], N[(1.0 + N[(-0.5 * N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 * (-N[(eps$95$m * x), $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.018:\\
\;\;\;\;1 + -0.5 \cdot \left(eps\_m \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \left(-eps\_m \cdot x\right)\\
\end{array}
\end{array}
if x < 0.0179999999999999986Initial program 60.8%
Simplified60.8%
Taylor expanded in x around 0 42.5%
Taylor expanded in eps around inf 85.7%
Taylor expanded in x around 0 68.0%
Taylor expanded in eps around 0 68.1%
if 0.0179999999999999986 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 29.9%
Taylor expanded in eps around inf 12.4%
Taylor expanded in eps around 0 12.4%
add-sqr-sqrt12.4%
sqrt-unprod15.3%
*-un-lft-identity15.3%
metadata-eval15.3%
swap-sqr15.3%
*-commutative15.3%
*-commutative15.3%
sqrt-unprod0.0%
add-sqr-sqrt18.6%
*-commutative18.6%
neg-mul-118.6%
distribute-rgt-neg-in18.6%
Applied egg-rr18.6%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.0) (* -0.5 (* eps_m x)) 1.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.0) {
tmp = -0.5 * (eps_m * x);
} 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 = (-0.5d0) * (eps_m * x)
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 = -0.5 * (eps_m * x);
} else {
tmp = 1.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.0: tmp = -0.5 * (eps_m * x) else: tmp = 1.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.0) tmp = Float64(-0.5 * Float64(eps_m * x)); 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 = -0.5 * (eps_m * x); 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[(-0.5 * N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;-0.5 \cdot \left(eps\_m \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 54.5%
Taylor expanded in eps around inf 34.6%
Taylor expanded in eps around 0 34.6%
if -1 < x Initial program 70.8%
Simplified63.4%
Taylor expanded in x around 0 47.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 74.3%
Simplified67.7%
Taylor expanded in x around 0 42.4%
herbie shell --seed 2024116 -o generate:simplify
(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))