
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 2e-48) (/ (/ (* eps_m (* 2.0 (* (+ x 1.0) (exp (- x))))) eps_m) 2.0) (/ (+ (exp (* x (+ -1.0 eps_m))) (exp (* x (- eps_m)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 2e-48) {
tmp = ((eps_m * (2.0 * ((x + 1.0) * exp(-x)))) / eps_m) / 2.0;
} else {
tmp = (exp((x * (-1.0 + eps_m))) + exp((x * -eps_m))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (eps_m <= 2d-48) then
tmp = ((eps_m * (2.0d0 * ((x + 1.0d0) * exp(-x)))) / eps_m) / 2.0d0
else
tmp = (exp((x * ((-1.0d0) + eps_m))) + exp((x * -eps_m))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (eps_m <= 2e-48) {
tmp = ((eps_m * (2.0 * ((x + 1.0) * Math.exp(-x)))) / eps_m) / 2.0;
} else {
tmp = (Math.exp((x * (-1.0 + eps_m))) + Math.exp((x * -eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 2e-48: tmp = ((eps_m * (2.0 * ((x + 1.0) * math.exp(-x)))) / eps_m) / 2.0 else: tmp = (math.exp((x * (-1.0 + eps_m))) + math.exp((x * -eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 2e-48) tmp = Float64(Float64(Float64(eps_m * Float64(2.0 * Float64(Float64(x + 1.0) * exp(Float64(-x))))) / eps_m) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(-1.0 + eps_m))) + exp(Float64(x * Float64(-eps_m)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 2e-48) tmp = ((eps_m * (2.0 * ((x + 1.0) * exp(-x)))) / eps_m) / 2.0; else tmp = (exp((x * (-1.0 + eps_m))) + exp((x * -eps_m))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 2e-48], N[(N[(N[(eps$95$m * N[(2.0 * N[(N[(x + 1.0), $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 2 \cdot 10^{-48}:\\
\;\;\;\;\frac{\frac{eps\_m \cdot \left(2 \cdot \left(\left(x + 1\right) \cdot e^{-x}\right)\right)}{eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(-1 + eps\_m\right)} + e^{x \cdot \left(-eps\_m\right)}}{2}\\
\end{array}
\end{array}
if eps < 1.9999999999999999e-48Initial program 67.9%
Simplified57.8%
Taylor expanded in eps around 0 36.0%
associate-+r+68.8%
mul-1-neg68.8%
sub-neg68.8%
+-inverses68.8%
distribute-lft-out68.8%
distribute-rgt1-in68.8%
mul-1-neg68.8%
Simplified68.8%
if 1.9999999999999999e-48 < eps Initial program 95.5%
Simplified82.5%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
associate-*r*100.0%
mul-1-neg100.0%
Simplified100.0%
Final simplification79.4%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* x (- -1.0 eps_m))) (exp (* x (+ -1.0 eps_m)))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * (-1.0 - eps_m))) + exp((x * (-1.0 + eps_m)))) / 2.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = (exp((x * ((-1.0d0) - eps_m))) + exp((x * ((-1.0d0) + eps_m)))) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return (Math.exp((x * (-1.0 - eps_m))) + Math.exp((x * (-1.0 + eps_m)))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.exp((x * (-1.0 - eps_m))) + math.exp((x * (-1.0 + eps_m)))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(exp(Float64(x * Float64(-1.0 - eps_m))) + exp(Float64(x * Float64(-1.0 + eps_m)))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((x * (-1.0 - eps_m))) + exp((x * (-1.0 + eps_m)))) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\frac{e^{x \cdot \left(-1 - eps\_m\right)} + e^{x \cdot \left(-1 + eps\_m\right)}}{2}
\end{array}
Initial program 77.3%
Simplified66.2%
Taylor expanded in eps around inf 99.1%
Final simplification99.1%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (* x (+ -1.0 eps_m)))))
(if (<= x -9.6e-263)
(/ (+ 1.0 (exp (* x (- eps_m)))) 2.0)
(if (<= x 1.65e-13)
(/ (+ t_0 (- 1.0 (* x eps_m))) 2.0)
(if (or (<= x 1.8e+14) (and (not (<= x 5.8e+66)) (<= x 3.9e+107)))
(/ (/ (* eps_m (* 2.0 (* (+ x 1.0) (exp (- x))))) eps_m) 2.0)
(/ (+ 1.0 t_0) 2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * (-1.0 + eps_m)));
double tmp;
if (x <= -9.6e-263) {
tmp = (1.0 + exp((x * -eps_m))) / 2.0;
} else if (x <= 1.65e-13) {
tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0;
} else if ((x <= 1.8e+14) || (!(x <= 5.8e+66) && (x <= 3.9e+107))) {
tmp = ((eps_m * (2.0 * ((x + 1.0) * exp(-x)))) / eps_m) / 2.0;
} else {
tmp = (1.0 + t_0) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: tmp
t_0 = exp((x * ((-1.0d0) + eps_m)))
if (x <= (-9.6d-263)) then
tmp = (1.0d0 + exp((x * -eps_m))) / 2.0d0
else if (x <= 1.65d-13) then
tmp = (t_0 + (1.0d0 - (x * eps_m))) / 2.0d0
else if ((x <= 1.8d+14) .or. (.not. (x <= 5.8d+66)) .and. (x <= 3.9d+107)) then
tmp = ((eps_m * (2.0d0 * ((x + 1.0d0) * exp(-x)))) / eps_m) / 2.0d0
else
tmp = (1.0d0 + t_0) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = Math.exp((x * (-1.0 + eps_m)));
double tmp;
if (x <= -9.6e-263) {
tmp = (1.0 + Math.exp((x * -eps_m))) / 2.0;
} else if (x <= 1.65e-13) {
tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0;
} else if ((x <= 1.8e+14) || (!(x <= 5.8e+66) && (x <= 3.9e+107))) {
tmp = ((eps_m * (2.0 * ((x + 1.0) * Math.exp(-x)))) / eps_m) / 2.0;
} else {
tmp = (1.0 + t_0) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * (-1.0 + eps_m))) tmp = 0 if x <= -9.6e-263: tmp = (1.0 + math.exp((x * -eps_m))) / 2.0 elif x <= 1.65e-13: tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0 elif (x <= 1.8e+14) or (not (x <= 5.8e+66) and (x <= 3.9e+107)): tmp = ((eps_m * (2.0 * ((x + 1.0) * math.exp(-x)))) / eps_m) / 2.0 else: tmp = (1.0 + t_0) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * Float64(-1.0 + eps_m))) tmp = 0.0 if (x <= -9.6e-263) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-eps_m)))) / 2.0); elseif (x <= 1.65e-13) tmp = Float64(Float64(t_0 + Float64(1.0 - Float64(x * eps_m))) / 2.0); elseif ((x <= 1.8e+14) || (!(x <= 5.8e+66) && (x <= 3.9e+107))) tmp = Float64(Float64(Float64(eps_m * Float64(2.0 * Float64(Float64(x + 1.0) * exp(Float64(-x))))) / eps_m) / 2.0); else tmp = Float64(Float64(1.0 + t_0) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp((x * (-1.0 + eps_m))); tmp = 0.0; if (x <= -9.6e-263) tmp = (1.0 + exp((x * -eps_m))) / 2.0; elseif (x <= 1.65e-13) tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0; elseif ((x <= 1.8e+14) || (~((x <= 5.8e+66)) && (x <= 3.9e+107))) tmp = ((eps_m * (2.0 * ((x + 1.0) * exp(-x)))) / eps_m) / 2.0; else tmp = (1.0 + t_0) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -9.6e-263], N[(N[(1.0 + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.65e-13], N[(N[(t$95$0 + N[(1.0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 1.8e+14], And[N[Not[LessEqual[x, 5.8e+66]], $MachinePrecision], LessEqual[x, 3.9e+107]]], N[(N[(N[(eps$95$m * N[(2.0 * N[(N[(x + 1.0), $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(-1 + eps\_m\right)}\\
\mathbf{if}\;x \leq -9.6 \cdot 10^{-263}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-eps\_m\right)}}{2}\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{-13}:\\
\;\;\;\;\frac{t\_0 + \left(1 - x \cdot eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{+14} \lor \neg \left(x \leq 5.8 \cdot 10^{+66}\right) \land x \leq 3.9 \cdot 10^{+107}:\\
\;\;\;\;\frac{\frac{eps\_m \cdot \left(2 \cdot \left(\left(x + 1\right) \cdot e^{-x}\right)\right)}{eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + t\_0}{2}\\
\end{array}
\end{array}
if x < -9.6000000000000001e-263Initial program 73.5%
Simplified58.8%
Taylor expanded in eps around inf 99.5%
Taylor expanded in eps around inf 99.5%
*-commutative99.5%
Simplified99.5%
Taylor expanded in x around inf 99.5%
associate-*r*99.5%
mul-1-neg99.5%
Simplified99.5%
Taylor expanded in x around 0 76.1%
if -9.6000000000000001e-263 < x < 1.65e-13Initial program 56.4%
Simplified35.1%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 87.0%
associate-*r*87.0%
mul-1-neg87.0%
cancel-sign-sub-inv87.0%
Simplified87.0%
if 1.65e-13 < x < 1.8e14 or 5.79999999999999972e66 < x < 3.8999999999999998e107Initial program 82.4%
Simplified82.4%
Taylor expanded in eps around 0 73.4%
associate-+r+91.0%
mul-1-neg91.0%
sub-neg91.0%
+-inverses91.0%
distribute-lft-out91.0%
distribute-rgt1-in90.8%
mul-1-neg90.8%
Simplified90.8%
if 1.8e14 < x < 5.79999999999999972e66 or 3.8999999999999998e107 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 75.6%
*-commutative75.6%
Simplified75.6%
Taylor expanded in x around 0 37.3%
Final simplification69.6%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -9.6e-263)
(/ (+ 1.0 (exp (* x (- eps_m)))) 2.0)
(if (or (<= x 3.9e+65) (not (<= x 3.3e+103)))
(/ (+ 1.0 (exp (* x (+ -1.0 eps_m)))) 2.0)
0.0)))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -9.6e-263) {
tmp = (1.0 + exp((x * -eps_m))) / 2.0;
} else if ((x <= 3.9e+65) || !(x <= 3.3e+103)) {
tmp = (1.0 + exp((x * (-1.0 + eps_m)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-9.6d-263)) then
tmp = (1.0d0 + exp((x * -eps_m))) / 2.0d0
else if ((x <= 3.9d+65) .or. (.not. (x <= 3.3d+103))) then
tmp = (1.0d0 + exp((x * ((-1.0d0) + eps_m)))) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -9.6e-263) {
tmp = (1.0 + Math.exp((x * -eps_m))) / 2.0;
} else if ((x <= 3.9e+65) || !(x <= 3.3e+103)) {
tmp = (1.0 + Math.exp((x * (-1.0 + eps_m)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -9.6e-263: tmp = (1.0 + math.exp((x * -eps_m))) / 2.0 elif (x <= 3.9e+65) or not (x <= 3.3e+103): tmp = (1.0 + math.exp((x * (-1.0 + eps_m)))) / 2.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -9.6e-263) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-eps_m)))) / 2.0); elseif ((x <= 3.9e+65) || !(x <= 3.3e+103)) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 + eps_m)))) / 2.0); else tmp = 0.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -9.6e-263) tmp = (1.0 + exp((x * -eps_m))) / 2.0; elseif ((x <= 3.9e+65) || ~((x <= 3.3e+103))) tmp = (1.0 + exp((x * (-1.0 + eps_m)))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -9.6e-263], N[(N[(1.0 + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 3.9e+65], N[Not[LessEqual[x, 3.3e+103]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.6 \cdot 10^{-263}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-eps\_m\right)}}{2}\\
\mathbf{elif}\;x \leq 3.9 \cdot 10^{+65} \lor \neg \left(x \leq 3.3 \cdot 10^{+103}\right):\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 + eps\_m\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -9.6000000000000001e-263Initial program 73.5%
Simplified58.8%
Taylor expanded in eps around inf 99.5%
Taylor expanded in eps around inf 99.5%
*-commutative99.5%
Simplified99.5%
Taylor expanded in x around inf 99.5%
associate-*r*99.5%
mul-1-neg99.5%
Simplified99.5%
Taylor expanded in x around 0 76.1%
if -9.6000000000000001e-263 < x < 3.8999999999999998e65 or 3.30000000000000009e103 < x Initial program 77.7%
Simplified68.3%
Taylor expanded in eps around inf 98.7%
Taylor expanded in eps around inf 84.3%
*-commutative84.3%
Simplified84.3%
Taylor expanded in x around 0 59.0%
if 3.8999999999999998e65 < x < 3.30000000000000009e103Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 86.9%
mul-1-neg86.9%
mul-1-neg86.9%
rec-exp86.9%
sub-neg86.9%
div-sub86.9%
mul-1-neg86.9%
rec-exp86.9%
+-inverses86.9%
Simplified86.9%
Final simplification67.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (* x (+ -1.0 eps_m)))))
(if (<= x -2e-262)
(/ (+ 1.0 (exp (* x (- eps_m)))) 2.0)
(if (<= x 1.55e+53)
(/ (+ t_0 (- 1.0 (* x eps_m))) 2.0)
(if (<= x 1.7e+104) 0.0 (/ (+ 1.0 t_0) 2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * (-1.0 + eps_m)));
double tmp;
if (x <= -2e-262) {
tmp = (1.0 + exp((x * -eps_m))) / 2.0;
} else if (x <= 1.55e+53) {
tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0;
} else if (x <= 1.7e+104) {
tmp = 0.0;
} else {
tmp = (1.0 + t_0) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: tmp
t_0 = exp((x * ((-1.0d0) + eps_m)))
if (x <= (-2d-262)) then
tmp = (1.0d0 + exp((x * -eps_m))) / 2.0d0
else if (x <= 1.55d+53) then
tmp = (t_0 + (1.0d0 - (x * eps_m))) / 2.0d0
else if (x <= 1.7d+104) then
tmp = 0.0d0
else
tmp = (1.0d0 + t_0) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = Math.exp((x * (-1.0 + eps_m)));
double tmp;
if (x <= -2e-262) {
tmp = (1.0 + Math.exp((x * -eps_m))) / 2.0;
} else if (x <= 1.55e+53) {
tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0;
} else if (x <= 1.7e+104) {
tmp = 0.0;
} else {
tmp = (1.0 + t_0) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * (-1.0 + eps_m))) tmp = 0 if x <= -2e-262: tmp = (1.0 + math.exp((x * -eps_m))) / 2.0 elif x <= 1.55e+53: tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0 elif x <= 1.7e+104: tmp = 0.0 else: tmp = (1.0 + t_0) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * Float64(-1.0 + eps_m))) tmp = 0.0 if (x <= -2e-262) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-eps_m)))) / 2.0); elseif (x <= 1.55e+53) tmp = Float64(Float64(t_0 + Float64(1.0 - Float64(x * eps_m))) / 2.0); elseif (x <= 1.7e+104) tmp = 0.0; else tmp = Float64(Float64(1.0 + t_0) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp((x * (-1.0 + eps_m))); tmp = 0.0; if (x <= -2e-262) tmp = (1.0 + exp((x * -eps_m))) / 2.0; elseif (x <= 1.55e+53) tmp = (t_0 + (1.0 - (x * eps_m))) / 2.0; elseif (x <= 1.7e+104) tmp = 0.0; else tmp = (1.0 + t_0) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -2e-262], N[(N[(1.0 + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.55e+53], N[(N[(t$95$0 + N[(1.0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.7e+104], 0.0, N[(N[(1.0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(-1 + eps\_m\right)}\\
\mathbf{if}\;x \leq -2 \cdot 10^{-262}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-eps\_m\right)}}{2}\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{+53}:\\
\;\;\;\;\frac{t\_0 + \left(1 - x \cdot eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{+104}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + t\_0}{2}\\
\end{array}
\end{array}
if x < -2.00000000000000002e-262Initial program 73.5%
Simplified58.8%
Taylor expanded in eps around inf 99.5%
Taylor expanded in eps around inf 99.5%
*-commutative99.5%
Simplified99.5%
Taylor expanded in x around inf 99.5%
associate-*r*99.5%
mul-1-neg99.5%
Simplified99.5%
Taylor expanded in x around 0 76.1%
if -2.00000000000000002e-262 < x < 1.5500000000000001e53Initial program 61.0%
Simplified44.4%
Taylor expanded in eps around inf 97.7%
Taylor expanded in eps around inf 92.8%
*-commutative92.8%
Simplified92.8%
Taylor expanded in x around 0 75.3%
associate-*r*75.3%
mul-1-neg75.3%
cancel-sign-sub-inv75.3%
Simplified75.3%
if 1.5500000000000001e53 < x < 1.6999999999999998e104Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 82.6%
mul-1-neg82.6%
mul-1-neg82.6%
rec-exp82.6%
sub-neg82.6%
div-sub82.6%
mul-1-neg82.6%
rec-exp82.6%
+-inverses82.6%
Simplified82.6%
if 1.6999999999999998e104 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 73.8%
*-commutative73.8%
Simplified73.8%
Taylor expanded in x around 0 39.5%
Final simplification68.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 510.0)
(/ (+ 1.0 (exp (* x (- eps_m)))) 2.0)
(if (<= x 4e+107)
0.0
(if (<= x 4.5e+167)
(/ (/ (- (* eps_m (+ 2.0 (* x eps_m))) x) eps_m) 2.0)
(if (<= x 7.5e+217) 0.0 (/ (* x eps_m) 2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 510.0) {
tmp = (1.0 + exp((x * -eps_m))) / 2.0;
} else if (x <= 4e+107) {
tmp = 0.0;
} else if (x <= 4.5e+167) {
tmp = (((eps_m * (2.0 + (x * eps_m))) - x) / eps_m) / 2.0;
} else if (x <= 7.5e+217) {
tmp = 0.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 <= 510.0d0) then
tmp = (1.0d0 + exp((x * -eps_m))) / 2.0d0
else if (x <= 4d+107) then
tmp = 0.0d0
else if (x <= 4.5d+167) then
tmp = (((eps_m * (2.0d0 + (x * eps_m))) - x) / eps_m) / 2.0d0
else if (x <= 7.5d+217) then
tmp = 0.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 <= 510.0) {
tmp = (1.0 + Math.exp((x * -eps_m))) / 2.0;
} else if (x <= 4e+107) {
tmp = 0.0;
} else if (x <= 4.5e+167) {
tmp = (((eps_m * (2.0 + (x * eps_m))) - x) / eps_m) / 2.0;
} else if (x <= 7.5e+217) {
tmp = 0.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 510.0: tmp = (1.0 + math.exp((x * -eps_m))) / 2.0 elif x <= 4e+107: tmp = 0.0 elif x <= 4.5e+167: tmp = (((eps_m * (2.0 + (x * eps_m))) - x) / eps_m) / 2.0 elif x <= 7.5e+217: tmp = 0.0 else: tmp = (x * eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 510.0) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-eps_m)))) / 2.0); elseif (x <= 4e+107) tmp = 0.0; elseif (x <= 4.5e+167) tmp = Float64(Float64(Float64(Float64(eps_m * Float64(2.0 + Float64(x * eps_m))) - x) / eps_m) / 2.0); elseif (x <= 7.5e+217) tmp = 0.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 <= 510.0) tmp = (1.0 + exp((x * -eps_m))) / 2.0; elseif (x <= 4e+107) tmp = 0.0; elseif (x <= 4.5e+167) tmp = (((eps_m * (2.0 + (x * eps_m))) - x) / eps_m) / 2.0; elseif (x <= 7.5e+217) tmp = 0.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, 510.0], N[(N[(1.0 + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 4e+107], 0.0, If[LessEqual[x, 4.5e+167], N[(N[(N[(N[(eps$95$m * N[(2.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 7.5e+217], 0.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 510:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-eps\_m\right)}}{2}\\
\mathbf{elif}\;x \leq 4 \cdot 10^{+107}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{+167}:\\
\;\;\;\;\frac{\frac{eps\_m \cdot \left(2 + x \cdot eps\_m\right) - x}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{+217}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < 510Initial program 65.8%
Simplified49.1%
Taylor expanded in eps around inf 98.7%
Taylor expanded in eps around inf 98.7%
*-commutative98.7%
Simplified98.7%
Taylor expanded in x around inf 98.7%
associate-*r*98.7%
mul-1-neg98.7%
Simplified98.7%
Taylor expanded in x around 0 79.2%
if 510 < x < 3.9999999999999999e107 or 4.4999999999999999e167 < x < 7.5000000000000001e217Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 63.1%
mul-1-neg63.1%
mul-1-neg63.1%
rec-exp63.1%
sub-neg63.1%
div-sub63.1%
mul-1-neg63.1%
rec-exp63.1%
+-inverses63.1%
Simplified63.1%
if 3.9999999999999999e107 < x < 4.4999999999999999e167Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 42.5%
Taylor expanded in x around 0 30.8%
Taylor expanded in eps around 0 41.8%
if 7.5000000000000001e217 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 39.1%
Taylor expanded in eps around inf 35.9%
Final simplification69.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 550.0)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (<= x 6.8e+105)
0.0
(if (<= x 1.55e+168)
(/ (/ (- (* eps_m (+ 2.0 (* x eps_m))) x) eps_m) 2.0)
(if (<= x 7.6e+217) 0.0 (/ (* x eps_m) 2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 550.0) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 6.8e+105) {
tmp = 0.0;
} else if (x <= 1.55e+168) {
tmp = (((eps_m * (2.0 + (x * eps_m))) - x) / eps_m) / 2.0;
} else if (x <= 7.6e+217) {
tmp = 0.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 <= 550.0d0) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= 6.8d+105) then
tmp = 0.0d0
else if (x <= 1.55d+168) then
tmp = (((eps_m * (2.0d0 + (x * eps_m))) - x) / eps_m) / 2.0d0
else if (x <= 7.6d+217) then
tmp = 0.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 <= 550.0) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 6.8e+105) {
tmp = 0.0;
} else if (x <= 1.55e+168) {
tmp = (((eps_m * (2.0 + (x * eps_m))) - x) / eps_m) / 2.0;
} else if (x <= 7.6e+217) {
tmp = 0.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 550.0: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 6.8e+105: tmp = 0.0 elif x <= 1.55e+168: tmp = (((eps_m * (2.0 + (x * eps_m))) - x) / eps_m) / 2.0 elif x <= 7.6e+217: tmp = 0.0 else: tmp = (x * eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 550.0) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 6.8e+105) tmp = 0.0; elseif (x <= 1.55e+168) tmp = Float64(Float64(Float64(Float64(eps_m * Float64(2.0 + Float64(x * eps_m))) - x) / eps_m) / 2.0); elseif (x <= 7.6e+217) tmp = 0.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 <= 550.0) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= 6.8e+105) tmp = 0.0; elseif (x <= 1.55e+168) tmp = (((eps_m * (2.0 + (x * eps_m))) - x) / eps_m) / 2.0; elseif (x <= 7.6e+217) tmp = 0.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, 550.0], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 6.8e+105], 0.0, If[LessEqual[x, 1.55e+168], N[(N[(N[(N[(eps$95$m * N[(2.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 7.6e+217], 0.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 550:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{+105}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{+168}:\\
\;\;\;\;\frac{\frac{eps\_m \cdot \left(2 + x \cdot eps\_m\right) - x}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq 7.6 \cdot 10^{+217}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < 550Initial program 65.8%
Simplified49.1%
Taylor expanded in eps around inf 98.7%
Taylor expanded in eps around inf 98.7%
*-commutative98.7%
Simplified98.7%
Taylor expanded in eps around 0 75.0%
neg-mul-175.0%
Simplified75.0%
if 550 < x < 6.7999999999999999e105 or 1.54999999999999998e168 < x < 7.60000000000000004e217Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 63.1%
mul-1-neg63.1%
mul-1-neg63.1%
rec-exp63.1%
sub-neg63.1%
div-sub63.1%
mul-1-neg63.1%
rec-exp63.1%
+-inverses63.1%
Simplified63.1%
if 6.7999999999999999e105 < x < 1.54999999999999998e168Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 42.5%
Taylor expanded in x around 0 30.8%
Taylor expanded in eps around 0 41.8%
if 7.60000000000000004e217 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 39.1%
Taylor expanded in eps around inf 35.9%
Final simplification66.5%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 230.0)
(/ (+ 1.0 (- 1.0 (* x eps_m))) 2.0)
(if (<= x 1e+105)
0.0
(if (<= x 8.5e+166)
(/ (/ (- (* eps_m (+ 2.0 (* x eps_m))) x) eps_m) 2.0)
(if (<= x 8e+217) 0.0 (/ (* x eps_m) 2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 230.0) {
tmp = (1.0 + (1.0 - (x * eps_m))) / 2.0;
} else if (x <= 1e+105) {
tmp = 0.0;
} else if (x <= 8.5e+166) {
tmp = (((eps_m * (2.0 + (x * eps_m))) - x) / eps_m) / 2.0;
} else if (x <= 8e+217) {
tmp = 0.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 <= 230.0d0) then
tmp = (1.0d0 + (1.0d0 - (x * eps_m))) / 2.0d0
else if (x <= 1d+105) then
tmp = 0.0d0
else if (x <= 8.5d+166) then
tmp = (((eps_m * (2.0d0 + (x * eps_m))) - x) / eps_m) / 2.0d0
else if (x <= 8d+217) then
tmp = 0.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 <= 230.0) {
tmp = (1.0 + (1.0 - (x * eps_m))) / 2.0;
} else if (x <= 1e+105) {
tmp = 0.0;
} else if (x <= 8.5e+166) {
tmp = (((eps_m * (2.0 + (x * eps_m))) - x) / eps_m) / 2.0;
} else if (x <= 8e+217) {
tmp = 0.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 230.0: tmp = (1.0 + (1.0 - (x * eps_m))) / 2.0 elif x <= 1e+105: tmp = 0.0 elif x <= 8.5e+166: tmp = (((eps_m * (2.0 + (x * eps_m))) - x) / eps_m) / 2.0 elif x <= 8e+217: tmp = 0.0 else: tmp = (x * eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 230.0) tmp = Float64(Float64(1.0 + Float64(1.0 - Float64(x * eps_m))) / 2.0); elseif (x <= 1e+105) tmp = 0.0; elseif (x <= 8.5e+166) tmp = Float64(Float64(Float64(Float64(eps_m * Float64(2.0 + Float64(x * eps_m))) - x) / eps_m) / 2.0); elseif (x <= 8e+217) tmp = 0.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 <= 230.0) tmp = (1.0 + (1.0 - (x * eps_m))) / 2.0; elseif (x <= 1e+105) tmp = 0.0; elseif (x <= 8.5e+166) tmp = (((eps_m * (2.0 + (x * eps_m))) - x) / eps_m) / 2.0; elseif (x <= 8e+217) tmp = 0.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, 230.0], N[(N[(1.0 + N[(1.0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1e+105], 0.0, If[LessEqual[x, 8.5e+166], N[(N[(N[(N[(eps$95$m * N[(2.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 8e+217], 0.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 230:\\
\;\;\;\;\frac{1 + \left(1 - x \cdot eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 10^{+105}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{+166}:\\
\;\;\;\;\frac{\frac{eps\_m \cdot \left(2 + x \cdot eps\_m\right) - x}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq 8 \cdot 10^{+217}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < 230Initial program 65.8%
Simplified49.1%
Taylor expanded in eps around inf 98.7%
Taylor expanded in eps around inf 98.7%
*-commutative98.7%
Simplified98.7%
Taylor expanded in x around 0 72.6%
associate-*r*72.6%
mul-1-neg72.6%
cancel-sign-sub-inv72.6%
Simplified72.6%
Taylor expanded in x around 0 60.1%
if 230 < x < 9.9999999999999994e104 or 8.5000000000000001e166 < x < 7.99999999999999968e217Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 63.1%
mul-1-neg63.1%
mul-1-neg63.1%
rec-exp63.1%
sub-neg63.1%
div-sub63.1%
mul-1-neg63.1%
rec-exp63.1%
+-inverses63.1%
Simplified63.1%
if 9.9999999999999994e104 < x < 8.5000000000000001e166Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 42.5%
Taylor expanded in x around 0 30.8%
Taylor expanded in eps around 0 41.8%
if 7.99999999999999968e217 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 39.1%
Taylor expanded in eps around inf 35.9%
Final simplification56.6%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -0.85) (/ (* x (- eps_m)) 2.0) (if (<= x 520.0) 1.0 (if (<= x 7.6e+217) 0.0 (/ (* x eps_m) 2.0)))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -0.85) {
tmp = (x * -eps_m) / 2.0;
} else if (x <= 520.0) {
tmp = 1.0;
} else if (x <= 7.6e+217) {
tmp = 0.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.85d0)) then
tmp = (x * -eps_m) / 2.0d0
else if (x <= 520.0d0) then
tmp = 1.0d0
else if (x <= 7.6d+217) then
tmp = 0.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.85) {
tmp = (x * -eps_m) / 2.0;
} else if (x <= 520.0) {
tmp = 1.0;
} else if (x <= 7.6e+217) {
tmp = 0.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.85: tmp = (x * -eps_m) / 2.0 elif x <= 520.0: tmp = 1.0 elif x <= 7.6e+217: tmp = 0.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.85) tmp = Float64(Float64(x * Float64(-eps_m)) / 2.0); elseif (x <= 520.0) tmp = 1.0; elseif (x <= 7.6e+217) tmp = 0.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.85) tmp = (x * -eps_m) / 2.0; elseif (x <= 520.0) tmp = 1.0; elseif (x <= 7.6e+217) tmp = 0.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.85], N[(N[(x * (-eps$95$m)), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 520.0], 1.0, If[LessEqual[x, 7.6e+217], 0.0, N[(N[(x * eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.85:\\
\;\;\;\;\frac{x \cdot \left(-eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 520:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 7.6 \cdot 10^{+217}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < -0.849999999999999978Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 36.1%
associate-*r*36.1%
mul-1-neg36.1%
cancel-sign-sub-inv36.1%
Simplified36.1%
Taylor expanded in eps around inf 24.7%
associate-*r*24.7%
mul-1-neg24.7%
Simplified24.7%
if -0.849999999999999978 < x < 520Initial program 56.9%
Simplified56.9%
Taylor expanded in x around 0 70.1%
if 520 < x < 7.60000000000000004e217Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 55.1%
mul-1-neg55.1%
mul-1-neg55.1%
rec-exp55.1%
sub-neg55.1%
div-sub55.1%
mul-1-neg55.1%
rec-exp55.1%
+-inverses55.1%
Simplified55.1%
if 7.60000000000000004e217 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 39.1%
Taylor expanded in eps around inf 35.9%
Final simplification56.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 460.0) 1.0 (if (<= x 8e+217) 0.0 (/ (* x eps_m) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 460.0) {
tmp = 1.0;
} else if (x <= 8e+217) {
tmp = 0.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 <= 460.0d0) then
tmp = 1.0d0
else if (x <= 8d+217) then
tmp = 0.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 <= 460.0) {
tmp = 1.0;
} else if (x <= 8e+217) {
tmp = 0.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 460.0: tmp = 1.0 elif x <= 8e+217: tmp = 0.0 else: tmp = (x * eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 460.0) tmp = 1.0; elseif (x <= 8e+217) tmp = 0.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 <= 460.0) tmp = 1.0; elseif (x <= 8e+217) tmp = 0.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, 460.0], 1.0, If[LessEqual[x, 8e+217], 0.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 460:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 8 \cdot 10^{+217}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < 460Initial program 65.8%
Simplified65.8%
Taylor expanded in x around 0 56.3%
if 460 < x < 7.99999999999999968e217Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 55.1%
mul-1-neg55.1%
mul-1-neg55.1%
rec-exp55.1%
sub-neg55.1%
div-sub55.1%
mul-1-neg55.1%
rec-exp55.1%
+-inverses55.1%
Simplified55.1%
if 7.99999999999999968e217 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 39.1%
Taylor expanded in eps around inf 35.9%
Final simplification53.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 240.0) (/ (+ 1.0 (- 1.0 (* x eps_m))) 2.0) (if (<= x 7.6e+217) 0.0 (/ (* x eps_m) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 240.0) {
tmp = (1.0 + (1.0 - (x * eps_m))) / 2.0;
} else if (x <= 7.6e+217) {
tmp = 0.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 <= 240.0d0) then
tmp = (1.0d0 + (1.0d0 - (x * eps_m))) / 2.0d0
else if (x <= 7.6d+217) then
tmp = 0.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 <= 240.0) {
tmp = (1.0 + (1.0 - (x * eps_m))) / 2.0;
} else if (x <= 7.6e+217) {
tmp = 0.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 240.0: tmp = (1.0 + (1.0 - (x * eps_m))) / 2.0 elif x <= 7.6e+217: tmp = 0.0 else: tmp = (x * eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 240.0) tmp = Float64(Float64(1.0 + Float64(1.0 - Float64(x * eps_m))) / 2.0); elseif (x <= 7.6e+217) tmp = 0.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 <= 240.0) tmp = (1.0 + (1.0 - (x * eps_m))) / 2.0; elseif (x <= 7.6e+217) tmp = 0.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, 240.0], N[(N[(1.0 + N[(1.0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 7.6e+217], 0.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 240:\\
\;\;\;\;\frac{1 + \left(1 - x \cdot eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 7.6 \cdot 10^{+217}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < 240Initial program 65.8%
Simplified49.1%
Taylor expanded in eps around inf 98.7%
Taylor expanded in eps around inf 98.7%
*-commutative98.7%
Simplified98.7%
Taylor expanded in x around 0 72.6%
associate-*r*72.6%
mul-1-neg72.6%
cancel-sign-sub-inv72.6%
Simplified72.6%
Taylor expanded in x around 0 60.1%
if 240 < x < 7.60000000000000004e217Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 55.1%
mul-1-neg55.1%
mul-1-neg55.1%
rec-exp55.1%
sub-neg55.1%
div-sub55.1%
mul-1-neg55.1%
rec-exp55.1%
+-inverses55.1%
Simplified55.1%
if 7.60000000000000004e217 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 39.1%
Taylor expanded in eps around inf 35.9%
Final simplification56.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 620.0) 1.0 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 620.0) {
tmp = 1.0;
} else {
tmp = 0.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 <= 620.0d0) then
tmp = 1.0d0
else
tmp = 0.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 <= 620.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 620.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 620.0) tmp = 1.0; else tmp = 0.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 620.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 620.0], 1.0, 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 620:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 620Initial program 65.8%
Simplified65.8%
Taylor expanded in x around 0 56.3%
if 620 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 48.5%
mul-1-neg48.5%
mul-1-neg48.5%
rec-exp48.5%
sub-neg48.5%
div-sub48.5%
mul-1-neg48.5%
rec-exp48.5%
+-inverses48.5%
Simplified48.5%
Final simplification53.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 0.0)
eps_m = fabs(eps);
double code(double x, double eps_m) {
return 0.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = 0.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return 0.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return 0.0
eps_m = abs(eps) function code(x, eps_m) return 0.0 end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = 0.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := 0.0
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
0
\end{array}
Initial program 77.3%
Simplified66.2%
Taylor expanded in eps around 0 17.7%
mul-1-neg17.7%
mul-1-neg17.7%
rec-exp17.7%
sub-neg17.7%
div-sub17.7%
mul-1-neg17.7%
rec-exp17.7%
+-inverses17.9%
Simplified17.9%
Final simplification17.9%
herbie shell --seed 2024055
(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))