
(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 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (* x (+ -1.0 eps_m)))))
(if (<= x -1.25e-245)
(/ (+ t_0 (exp (* x (- eps_m)))) 2.0)
(/ (+ t_0 (exp (- x))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * (-1.0 + eps_m)));
double tmp;
if (x <= -1.25e-245) {
tmp = (t_0 + exp((x * -eps_m))) / 2.0;
} else {
tmp = (t_0 + exp(-x)) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: tmp
t_0 = exp((x * ((-1.0d0) + eps_m)))
if (x <= (-1.25d-245)) then
tmp = (t_0 + exp((x * -eps_m))) / 2.0d0
else
tmp = (t_0 + exp(-x)) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = Math.exp((x * (-1.0 + eps_m)));
double tmp;
if (x <= -1.25e-245) {
tmp = (t_0 + Math.exp((x * -eps_m))) / 2.0;
} else {
tmp = (t_0 + Math.exp(-x)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * (-1.0 + eps_m))) tmp = 0 if x <= -1.25e-245: tmp = (t_0 + math.exp((x * -eps_m))) / 2.0 else: tmp = (t_0 + math.exp(-x)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * Float64(-1.0 + eps_m))) tmp = 0.0 if (x <= -1.25e-245) tmp = Float64(Float64(t_0 + exp(Float64(x * Float64(-eps_m)))) / 2.0); else tmp = Float64(Float64(t_0 + exp(Float64(-x))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp((x * (-1.0 + eps_m))); tmp = 0.0; if (x <= -1.25e-245) tmp = (t_0 + exp((x * -eps_m))) / 2.0; else tmp = (t_0 + exp(-x)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -1.25e-245], N[(N[(t$95$0 + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(t$95$0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(-1 + eps\_m\right)}\\
\mathbf{if}\;x \leq -1.25 \cdot 10^{-245}:\\
\;\;\;\;\frac{t\_0 + e^{x \cdot \left(-eps\_m\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 + e^{-x}}{2}\\
\end{array}
\end{array}
if x < -1.2499999999999999e-245Initial program 67.4%
Simplified57.4%
Taylor expanded in eps around inf 98.6%
Taylor expanded in eps around inf 98.6%
*-commutative98.6%
Simplified98.6%
if -1.2499999999999999e-245 < x Initial program 73.9%
Simplified60.2%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around 0 82.6%
Final simplification89.1%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.25e-245) (/ (+ 1.0 (exp (* x (- eps_m)))) 2.0) (/ (+ (exp (* x (+ -1.0 eps_m))) (exp (- x))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.25e-245) {
tmp = (1.0 + exp((x * -eps_m))) / 2.0;
} else {
tmp = (exp((x * (-1.0 + eps_m))) + exp(-x)) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-1.25d-245)) then
tmp = (1.0d0 + exp((x * -eps_m))) / 2.0d0
else
tmp = (exp((x * ((-1.0d0) + eps_m))) + exp(-x)) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1.25e-245) {
tmp = (1.0 + Math.exp((x * -eps_m))) / 2.0;
} else {
tmp = (Math.exp((x * (-1.0 + eps_m))) + Math.exp(-x)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.25e-245: tmp = (1.0 + math.exp((x * -eps_m))) / 2.0 else: tmp = (math.exp((x * (-1.0 + eps_m))) + math.exp(-x)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.25e-245) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-eps_m)))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(-1.0 + eps_m))) + exp(Float64(-x))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.25e-245) tmp = (1.0 + exp((x * -eps_m))) / 2.0; else tmp = (exp((x * (-1.0 + eps_m))) + exp(-x)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.25e-245], N[(N[(1.0 + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.25 \cdot 10^{-245}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-eps\_m\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(-1 + eps\_m\right)} + e^{-x}}{2}\\
\end{array}
\end{array}
if x < -1.2499999999999999e-245Initial program 67.4%
Simplified67.4%
Taylor expanded in x around 0 42.6%
Taylor expanded in eps around inf 73.7%
Taylor expanded in eps around inf 74.2%
*-commutative98.6%
Simplified74.2%
if -1.2499999999999999e-245 < x Initial program 73.9%
Simplified60.2%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around 0 82.6%
Final simplification79.2%
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 71.2%
Simplified59.1%
Taylor expanded in eps around inf 99.4%
Final simplification99.4%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1.25e-245)
(/ (* 2.0 (exp (- x))) 2.0)
(if (or (<= x 6e+68) (not (<= x 2.4e+161)))
(/ (+ 1.0 (exp (* x (+ -1.0 eps_m)))) 2.0)
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.25e-245) {
tmp = (2.0 * exp(-x)) / 2.0;
} else if ((x <= 6e+68) || !(x <= 2.4e+161)) {
tmp = (1.0 + exp((x * (-1.0 + eps_m)))) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
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-245)) then
tmp = (2.0d0 * exp(-x)) / 2.0d0
else if ((x <= 6d+68) .or. (.not. (x <= 2.4d+161))) then
tmp = (1.0d0 + exp((x * ((-1.0d0) + eps_m)))) / 2.0d0
else
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 + ((-1.0d0) / eps_m))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1.25e-245) {
tmp = (2.0 * Math.exp(-x)) / 2.0;
} else if ((x <= 6e+68) || !(x <= 2.4e+161)) {
tmp = (1.0 + Math.exp((x * (-1.0 + eps_m)))) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.25e-245: tmp = (2.0 * math.exp(-x)) / 2.0 elif (x <= 6e+68) or not (x <= 2.4e+161): tmp = (1.0 + math.exp((x * (-1.0 + eps_m)))) / 2.0 else: tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.25e-245) tmp = Float64(Float64(2.0 * exp(Float64(-x))) / 2.0); elseif ((x <= 6e+68) || !(x <= 2.4e+161)) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 + eps_m)))) / 2.0); else tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.25e-245) tmp = (2.0 * exp(-x)) / 2.0; elseif ((x <= 6e+68) || ~((x <= 2.4e+161))) tmp = (1.0 + exp((x * (-1.0 + eps_m)))) / 2.0; else tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.25e-245], N[(N[(2.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 6e+68], N[Not[LessEqual[x, 2.4e+161]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.25 \cdot 10^{-245}:\\
\;\;\;\;\frac{2 \cdot e^{-x}}{2}\\
\mathbf{elif}\;x \leq 6 \cdot 10^{+68} \lor \neg \left(x \leq 2.4 \cdot 10^{+161}\right):\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 + eps\_m\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\end{array}
\end{array}
if x < -1.2499999999999999e-245Initial program 67.4%
Simplified57.4%
Taylor expanded in eps around inf 98.6%
Taylor expanded in eps around 0 88.6%
Taylor expanded in eps around 0 79.0%
mul-1-neg79.0%
Simplified79.0%
if -1.2499999999999999e-245 < x < 6.0000000000000004e68 or 2.3999999999999999e161 < x Initial program 69.4%
Simplified69.4%
Taylor expanded in x around 0 40.3%
Taylor expanded in eps around inf 70.9%
sub-neg70.9%
mul-1-neg70.9%
associate-*r*70.9%
mul-1-neg70.9%
mul-1-neg70.9%
sub-neg70.9%
Simplified70.9%
if 6.0000000000000004e68 < x < 2.3999999999999999e161Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 20.1%
Taylor expanded in x around 0 69.2%
Final simplification74.1%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1.25e-245)
(/ (+ 1.0 (exp (* x (- eps_m)))) 2.0)
(if (or (<= x 9.2e+70) (not (<= x 2.5e+161)))
(/ (+ 1.0 (exp (* x (+ -1.0 eps_m)))) 2.0)
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.25e-245) {
tmp = (1.0 + exp((x * -eps_m))) / 2.0;
} else if ((x <= 9.2e+70) || !(x <= 2.5e+161)) {
tmp = (1.0 + exp((x * (-1.0 + eps_m)))) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
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-245)) then
tmp = (1.0d0 + exp((x * -eps_m))) / 2.0d0
else if ((x <= 9.2d+70) .or. (.not. (x <= 2.5d+161))) then
tmp = (1.0d0 + exp((x * ((-1.0d0) + eps_m)))) / 2.0d0
else
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 + ((-1.0d0) / eps_m))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1.25e-245) {
tmp = (1.0 + Math.exp((x * -eps_m))) / 2.0;
} else if ((x <= 9.2e+70) || !(x <= 2.5e+161)) {
tmp = (1.0 + Math.exp((x * (-1.0 + eps_m)))) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.25e-245: tmp = (1.0 + math.exp((x * -eps_m))) / 2.0 elif (x <= 9.2e+70) or not (x <= 2.5e+161): tmp = (1.0 + math.exp((x * (-1.0 + eps_m)))) / 2.0 else: tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.25e-245) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-eps_m)))) / 2.0); elseif ((x <= 9.2e+70) || !(x <= 2.5e+161)) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 + eps_m)))) / 2.0); else tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.25e-245) tmp = (1.0 + exp((x * -eps_m))) / 2.0; elseif ((x <= 9.2e+70) || ~((x <= 2.5e+161))) tmp = (1.0 + exp((x * (-1.0 + eps_m)))) / 2.0; else tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.25e-245], N[(N[(1.0 + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 9.2e+70], N[Not[LessEqual[x, 2.5e+161]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.25 \cdot 10^{-245}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-eps\_m\right)}}{2}\\
\mathbf{elif}\;x \leq 9.2 \cdot 10^{+70} \lor \neg \left(x \leq 2.5 \cdot 10^{+161}\right):\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 + eps\_m\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\end{array}
\end{array}
if x < -1.2499999999999999e-245Initial program 67.4%
Simplified67.4%
Taylor expanded in x around 0 42.6%
Taylor expanded in eps around inf 73.7%
Taylor expanded in eps around inf 74.2%
*-commutative98.6%
Simplified74.2%
if -1.2499999999999999e-245 < x < 9.19999999999999975e70 or 2.4999999999999998e161 < x Initial program 69.4%
Simplified69.4%
Taylor expanded in x around 0 40.3%
Taylor expanded in eps around inf 70.9%
sub-neg70.9%
mul-1-neg70.9%
associate-*r*70.9%
mul-1-neg70.9%
mul-1-neg70.9%
sub-neg70.9%
Simplified70.9%
if 9.19999999999999975e70 < x < 2.4999999999999998e161Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 20.1%
Taylor expanded in x around 0 69.2%
Final simplification72.1%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 1.85e+181) (/ (* 2.0 (exp (- x))) 2.0) (/ (/ (- (* eps_m (+ 2.0 (* x eps_m))) x) eps_m) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 1.85e+181) {
tmp = (2.0 * exp(-x)) / 2.0;
} else {
tmp = (((eps_m * (2.0 + (x * eps_m))) - 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 <= 1.85d+181) then
tmp = (2.0d0 * exp(-x)) / 2.0d0
else
tmp = (((eps_m * (2.0d0 + (x * eps_m))) - 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 <= 1.85e+181) {
tmp = (2.0 * Math.exp(-x)) / 2.0;
} else {
tmp = (((eps_m * (2.0 + (x * eps_m))) - x) / eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 1.85e+181: tmp = (2.0 * math.exp(-x)) / 2.0 else: tmp = (((eps_m * (2.0 + (x * eps_m))) - x) / eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 1.85e+181) tmp = Float64(Float64(2.0 * exp(Float64(-x))) / 2.0); else tmp = Float64(Float64(Float64(Float64(eps_m * Float64(2.0 + Float64(x * eps_m))) - x) / eps_m) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 1.85e+181) tmp = (2.0 * exp(-x)) / 2.0; else tmp = (((eps_m * (2.0 + (x * eps_m))) - 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, 1.85e+181], N[(N[(2.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 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]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 1.85 \cdot 10^{+181}:\\
\;\;\;\;\frac{2 \cdot e^{-x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{eps\_m \cdot \left(2 + x \cdot eps\_m\right) - x}{eps\_m}}{2}\\
\end{array}
\end{array}
if eps < 1.8500000000000002e181Initial program 67.0%
Simplified53.8%
Taylor expanded in eps around inf 99.3%
Taylor expanded in eps around 0 86.9%
Taylor expanded in eps around 0 78.3%
mul-1-neg78.3%
Simplified78.3%
if 1.8500000000000002e181 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 61.0%
Taylor expanded in x around 0 31.2%
mul-1-neg31.2%
unsub-neg31.2%
*-commutative31.2%
associate-*r*31.2%
Simplified31.2%
Taylor expanded in eps around 0 51.0%
Final simplification74.8%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1.35e-6)
(* (* x eps_m) -0.5)
(if (<= x 350.0)
1.0
(if (or (<= x 3e+161) (not (<= x 2.15e+241)))
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0)
(/ (* x eps_m) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.35e-6) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 350.0) {
tmp = 1.0;
} else if ((x <= 3e+161) || !(x <= 2.15e+241)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-1.35d-6)) then
tmp = (x * eps_m) * (-0.5d0)
else if (x <= 350.0d0) then
tmp = 1.0d0
else if ((x <= 3d+161) .or. (.not. (x <= 2.15d+241))) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 + ((-1.0d0) / eps_m))) / 2.0d0
else
tmp = (x * eps_m) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1.35e-6) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 350.0) {
tmp = 1.0;
} else if ((x <= 3e+161) || !(x <= 2.15e+241)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.35e-6: tmp = (x * eps_m) * -0.5 elif x <= 350.0: tmp = 1.0 elif (x <= 3e+161) or not (x <= 2.15e+241): tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 else: tmp = (x * eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.35e-6) tmp = Float64(Float64(x * eps_m) * -0.5); elseif (x <= 350.0) tmp = 1.0; elseif ((x <= 3e+161) || !(x <= 2.15e+241)) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(x * eps_m) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.35e-6) tmp = (x * eps_m) * -0.5; elseif (x <= 350.0) tmp = 1.0; elseif ((x <= 3e+161) || ~((x <= 2.15e+241))) tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0; else tmp = (x * eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.35e-6], N[(N[(x * eps$95$m), $MachinePrecision] * -0.5), $MachinePrecision], If[LessEqual[x, 350.0], 1.0, If[Or[LessEqual[x, 3e+161], N[Not[LessEqual[x, 2.15e+241]], $MachinePrecision]], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x * eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{-6}:\\
\;\;\;\;\left(x \cdot eps\_m\right) \cdot -0.5\\
\mathbf{elif}\;x \leq 350:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 3 \cdot 10^{+161} \lor \neg \left(x \leq 2.15 \cdot 10^{+241}\right):\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < -1.34999999999999999e-6Initial program 97.1%
Simplified97.1%
Taylor expanded in x around 0 50.2%
Taylor expanded in x around 0 24.2%
mul-1-neg24.2%
unsub-neg24.2%
*-commutative24.2%
associate-*r*24.2%
Simplified24.2%
Taylor expanded in eps around inf 24.1%
frac-2neg24.1%
div-inv24.1%
distribute-rgt-neg-in24.1%
mul-1-neg24.1%
add-sqr-sqrt24.1%
sqrt-unprod26.8%
mul-1-neg26.8%
mul-1-neg26.8%
sqr-neg26.8%
sqrt-unprod0.0%
add-sqr-sqrt24.9%
*-commutative24.9%
metadata-eval24.9%
metadata-eval24.9%
Applied egg-rr24.9%
if -1.34999999999999999e-6 < x < 350Initial program 53.1%
Simplified53.1%
Taylor expanded in x around 0 76.2%
if 350 < x < 3.00000000000000011e161 or 2.15000000000000002e241 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 21.1%
Taylor expanded in x around 0 54.7%
if 3.00000000000000011e161 < x < 2.15000000000000002e241Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 53.9%
Taylor expanded in x around 0 33.3%
mul-1-neg33.3%
unsub-neg33.3%
*-commutative33.3%
associate-*r*33.3%
Simplified33.3%
Taylor expanded in eps around inf 33.7%
Final simplification62.1%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1.35e-6)
(* (* x eps_m) -0.5)
(if (<= x 350.0)
1.0
(if (or (<= x 3e+161) (not (<= x 5.3e+241)))
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0)
(/ (/ (- (* eps_m (+ 2.0 (* x eps_m))) x) eps_m) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.35e-6) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 350.0) {
tmp = 1.0;
} else if ((x <= 3e+161) || !(x <= 5.3e+241)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (((eps_m * (2.0 + (x * eps_m))) - 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.35d-6)) then
tmp = (x * eps_m) * (-0.5d0)
else if (x <= 350.0d0) then
tmp = 1.0d0
else if ((x <= 3d+161) .or. (.not. (x <= 5.3d+241))) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 + ((-1.0d0) / eps_m))) / 2.0d0
else
tmp = (((eps_m * (2.0d0 + (x * eps_m))) - 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.35e-6) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 350.0) {
tmp = 1.0;
} else if ((x <= 3e+161) || !(x <= 5.3e+241)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (((eps_m * (2.0 + (x * eps_m))) - x) / eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.35e-6: tmp = (x * eps_m) * -0.5 elif x <= 350.0: tmp = 1.0 elif (x <= 3e+161) or not (x <= 5.3e+241): tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 else: tmp = (((eps_m * (2.0 + (x * eps_m))) - x) / eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.35e-6) tmp = Float64(Float64(x * eps_m) * -0.5); elseif (x <= 350.0) tmp = 1.0; elseif ((x <= 3e+161) || !(x <= 5.3e+241)) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(Float64(Float64(eps_m * Float64(2.0 + Float64(x * eps_m))) - 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.35e-6) tmp = (x * eps_m) * -0.5; elseif (x <= 350.0) tmp = 1.0; elseif ((x <= 3e+161) || ~((x <= 5.3e+241))) tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0; else tmp = (((eps_m * (2.0 + (x * eps_m))) - 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.35e-6], N[(N[(x * eps$95$m), $MachinePrecision] * -0.5), $MachinePrecision], If[LessEqual[x, 350.0], 1.0, If[Or[LessEqual[x, 3e+161], N[Not[LessEqual[x, 5.3e+241]], $MachinePrecision]], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(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]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{-6}:\\
\;\;\;\;\left(x \cdot eps\_m\right) \cdot -0.5\\
\mathbf{elif}\;x \leq 350:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 3 \cdot 10^{+161} \lor \neg \left(x \leq 5.3 \cdot 10^{+241}\right):\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{eps\_m \cdot \left(2 + x \cdot eps\_m\right) - x}{eps\_m}}{2}\\
\end{array}
\end{array}
if x < -1.34999999999999999e-6Initial program 97.1%
Simplified97.1%
Taylor expanded in x around 0 50.2%
Taylor expanded in x around 0 24.2%
mul-1-neg24.2%
unsub-neg24.2%
*-commutative24.2%
associate-*r*24.2%
Simplified24.2%
Taylor expanded in eps around inf 24.1%
frac-2neg24.1%
div-inv24.1%
distribute-rgt-neg-in24.1%
mul-1-neg24.1%
add-sqr-sqrt24.1%
sqrt-unprod26.8%
mul-1-neg26.8%
mul-1-neg26.8%
sqr-neg26.8%
sqrt-unprod0.0%
add-sqr-sqrt24.9%
*-commutative24.9%
metadata-eval24.9%
metadata-eval24.9%
Applied egg-rr24.9%
if -1.34999999999999999e-6 < x < 350Initial program 53.1%
Simplified53.1%
Taylor expanded in x around 0 76.2%
if 350 < x < 3.00000000000000011e161 or 5.3000000000000001e241 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 21.1%
Taylor expanded in x around 0 54.7%
if 3.00000000000000011e161 < x < 5.3000000000000001e241Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 53.9%
Taylor expanded in x around 0 33.3%
mul-1-neg33.3%
unsub-neg33.3%
*-commutative33.3%
associate-*r*33.3%
Simplified33.3%
Taylor expanded in eps around 0 38.2%
Final simplification62.4%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1.35e-6)
(/ (+ 2.0 (* x (* (+ 1.0 eps_m) (+ -1.0 (/ 1.0 eps_m))))) 2.0)
(if (<= x 350.0)
1.0
(if (or (<= x 2.4e+161) (not (<= x 5.2e+233)))
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0)
(/ (/ (- (* eps_m (+ 2.0 (* x eps_m))) x) eps_m) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.35e-6) {
tmp = (2.0 + (x * ((1.0 + eps_m) * (-1.0 + (1.0 / eps_m))))) / 2.0;
} else if (x <= 350.0) {
tmp = 1.0;
} else if ((x <= 2.4e+161) || !(x <= 5.2e+233)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (((eps_m * (2.0 + (x * eps_m))) - 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.35d-6)) then
tmp = (2.0d0 + (x * ((1.0d0 + eps_m) * ((-1.0d0) + (1.0d0 / eps_m))))) / 2.0d0
else if (x <= 350.0d0) then
tmp = 1.0d0
else if ((x <= 2.4d+161) .or. (.not. (x <= 5.2d+233))) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 + ((-1.0d0) / eps_m))) / 2.0d0
else
tmp = (((eps_m * (2.0d0 + (x * eps_m))) - 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.35e-6) {
tmp = (2.0 + (x * ((1.0 + eps_m) * (-1.0 + (1.0 / eps_m))))) / 2.0;
} else if (x <= 350.0) {
tmp = 1.0;
} else if ((x <= 2.4e+161) || !(x <= 5.2e+233)) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (((eps_m * (2.0 + (x * eps_m))) - x) / eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.35e-6: tmp = (2.0 + (x * ((1.0 + eps_m) * (-1.0 + (1.0 / eps_m))))) / 2.0 elif x <= 350.0: tmp = 1.0 elif (x <= 2.4e+161) or not (x <= 5.2e+233): tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 else: tmp = (((eps_m * (2.0 + (x * eps_m))) - x) / eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.35e-6) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(1.0 + eps_m) * Float64(-1.0 + Float64(1.0 / eps_m))))) / 2.0); elseif (x <= 350.0) tmp = 1.0; elseif ((x <= 2.4e+161) || !(x <= 5.2e+233)) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(Float64(Float64(eps_m * Float64(2.0 + Float64(x * eps_m))) - 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.35e-6) tmp = (2.0 + (x * ((1.0 + eps_m) * (-1.0 + (1.0 / eps_m))))) / 2.0; elseif (x <= 350.0) tmp = 1.0; elseif ((x <= 2.4e+161) || ~((x <= 5.2e+233))) tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0; else tmp = (((eps_m * (2.0 + (x * eps_m))) - 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.35e-6], N[(N[(2.0 + N[(x * N[(N[(1.0 + eps$95$m), $MachinePrecision] * N[(-1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 350.0], 1.0, If[Or[LessEqual[x, 2.4e+161], N[Not[LessEqual[x, 5.2e+233]], $MachinePrecision]], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(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]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{-6}:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(1 + eps\_m\right) \cdot \left(-1 + \frac{1}{eps\_m}\right)\right)}{2}\\
\mathbf{elif}\;x \leq 350:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{+161} \lor \neg \left(x \leq 5.2 \cdot 10^{+233}\right):\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{eps\_m \cdot \left(2 + x \cdot eps\_m\right) - x}{eps\_m}}{2}\\
\end{array}
\end{array}
if x < -1.34999999999999999e-6Initial program 97.1%
Simplified97.1%
Taylor expanded in x around 0 52.9%
Taylor expanded in x around 0 24.8%
if -1.34999999999999999e-6 < x < 350Initial program 53.1%
Simplified53.1%
Taylor expanded in x around 0 76.2%
if 350 < x < 2.3999999999999999e161 or 5.20000000000000013e233 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 21.1%
Taylor expanded in x around 0 54.7%
if 2.3999999999999999e161 < x < 5.20000000000000013e233Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 53.9%
Taylor expanded in x around 0 33.3%
mul-1-neg33.3%
unsub-neg33.3%
*-commutative33.3%
associate-*r*33.3%
Simplified33.3%
Taylor expanded in eps around 0 38.2%
Final simplification62.4%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1.35e-6)
(* (* x eps_m) -0.5)
(if (<= x 350.0)
1.0
(if (or (<= x 3.3e+161) (not (<= x 1.92e+233)))
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (/ -1.0 eps_m)) 2.0)
(/ (* x eps_m) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.35e-6) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 350.0) {
tmp = 1.0;
} else if ((x <= 3.3e+161) || !(x <= 1.92e+233)) {
tmp = ((1.0 + (1.0 / eps_m)) + (-1.0 / eps_m)) / 2.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-1.35d-6)) then
tmp = (x * eps_m) * (-0.5d0)
else if (x <= 350.0d0) then
tmp = 1.0d0
else if ((x <= 3.3d+161) .or. (.not. (x <= 1.92d+233))) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + ((-1.0d0) / eps_m)) / 2.0d0
else
tmp = (x * eps_m) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1.35e-6) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 350.0) {
tmp = 1.0;
} else if ((x <= 3.3e+161) || !(x <= 1.92e+233)) {
tmp = ((1.0 + (1.0 / eps_m)) + (-1.0 / eps_m)) / 2.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.35e-6: tmp = (x * eps_m) * -0.5 elif x <= 350.0: tmp = 1.0 elif (x <= 3.3e+161) or not (x <= 1.92e+233): tmp = ((1.0 + (1.0 / eps_m)) + (-1.0 / eps_m)) / 2.0 else: tmp = (x * eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.35e-6) tmp = Float64(Float64(x * eps_m) * -0.5); elseif (x <= 350.0) tmp = 1.0; elseif ((x <= 3.3e+161) || !(x <= 1.92e+233)) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(-1.0 / eps_m)) / 2.0); else tmp = Float64(Float64(x * eps_m) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.35e-6) tmp = (x * eps_m) * -0.5; elseif (x <= 350.0) tmp = 1.0; elseif ((x <= 3.3e+161) || ~((x <= 1.92e+233))) tmp = ((1.0 + (1.0 / eps_m)) + (-1.0 / eps_m)) / 2.0; else tmp = (x * eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.35e-6], N[(N[(x * eps$95$m), $MachinePrecision] * -0.5), $MachinePrecision], If[LessEqual[x, 350.0], 1.0, If[Or[LessEqual[x, 3.3e+161], N[Not[LessEqual[x, 1.92e+233]], $MachinePrecision]], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x * eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{-6}:\\
\;\;\;\;\left(x \cdot eps\_m\right) \cdot -0.5\\
\mathbf{elif}\;x \leq 350:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 3.3 \cdot 10^{+161} \lor \neg \left(x \leq 1.92 \cdot 10^{+233}\right):\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \frac{-1}{eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < -1.34999999999999999e-6Initial program 97.1%
Simplified97.1%
Taylor expanded in x around 0 50.2%
Taylor expanded in x around 0 24.2%
mul-1-neg24.2%
unsub-neg24.2%
*-commutative24.2%
associate-*r*24.2%
Simplified24.2%
Taylor expanded in eps around inf 24.1%
frac-2neg24.1%
div-inv24.1%
distribute-rgt-neg-in24.1%
mul-1-neg24.1%
add-sqr-sqrt24.1%
sqrt-unprod26.8%
mul-1-neg26.8%
mul-1-neg26.8%
sqr-neg26.8%
sqrt-unprod0.0%
add-sqr-sqrt24.9%
*-commutative24.9%
metadata-eval24.9%
metadata-eval24.9%
Applied egg-rr24.9%
if -1.34999999999999999e-6 < x < 350Initial program 53.1%
Simplified53.1%
Taylor expanded in x around 0 76.2%
if 350 < x < 3.29999999999999997e161 or 1.9200000000000001e233 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 21.1%
Taylor expanded in x around 0 54.7%
Taylor expanded in eps around 0 54.7%
if 3.29999999999999997e161 < x < 1.9200000000000001e233Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 53.9%
Taylor expanded in x around 0 33.3%
mul-1-neg33.3%
unsub-neg33.3%
*-commutative33.3%
associate-*r*33.3%
Simplified33.3%
Taylor expanded in eps around inf 33.7%
Final simplification62.1%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1.35e-6)
(/ (+ 2.0 (* x (* (+ 1.0 eps_m) (+ -1.0 (/ 1.0 eps_m))))) 2.0)
(if (<= x 350.0)
1.0
(if (<= x 2.4e+161)
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0)
(/
(/ (* x (- 1.0 (* x (- 0.5 (* x 0.16666666666666666))))) eps_m)
2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.35e-6) {
tmp = (2.0 + (x * ((1.0 + eps_m) * (-1.0 + (1.0 / eps_m))))) / 2.0;
} else if (x <= 350.0) {
tmp = 1.0;
} else if (x <= 2.4e+161) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = ((x * (1.0 - (x * (0.5 - (x * 0.16666666666666666))))) / 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.35d-6)) then
tmp = (2.0d0 + (x * ((1.0d0 + eps_m) * ((-1.0d0) + (1.0d0 / eps_m))))) / 2.0d0
else if (x <= 350.0d0) then
tmp = 1.0d0
else if (x <= 2.4d+161) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 + ((-1.0d0) / eps_m))) / 2.0d0
else
tmp = ((x * (1.0d0 - (x * (0.5d0 - (x * 0.16666666666666666d0))))) / 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.35e-6) {
tmp = (2.0 + (x * ((1.0 + eps_m) * (-1.0 + (1.0 / eps_m))))) / 2.0;
} else if (x <= 350.0) {
tmp = 1.0;
} else if (x <= 2.4e+161) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = ((x * (1.0 - (x * (0.5 - (x * 0.16666666666666666))))) / eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.35e-6: tmp = (2.0 + (x * ((1.0 + eps_m) * (-1.0 + (1.0 / eps_m))))) / 2.0 elif x <= 350.0: tmp = 1.0 elif x <= 2.4e+161: tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 else: tmp = ((x * (1.0 - (x * (0.5 - (x * 0.16666666666666666))))) / eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.35e-6) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(1.0 + eps_m) * Float64(-1.0 + Float64(1.0 / eps_m))))) / 2.0); elseif (x <= 350.0) tmp = 1.0; elseif (x <= 2.4e+161) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(Float64(x * Float64(1.0 - Float64(x * Float64(0.5 - Float64(x * 0.16666666666666666))))) / 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.35e-6) tmp = (2.0 + (x * ((1.0 + eps_m) * (-1.0 + (1.0 / eps_m))))) / 2.0; elseif (x <= 350.0) tmp = 1.0; elseif (x <= 2.4e+161) tmp = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0; else tmp = ((x * (1.0 - (x * (0.5 - (x * 0.16666666666666666))))) / eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.35e-6], N[(N[(2.0 + N[(x * N[(N[(1.0 + eps$95$m), $MachinePrecision] * N[(-1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 350.0], 1.0, If[LessEqual[x, 2.4e+161], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(x * N[(1.0 - N[(x * N[(0.5 - N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $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.35 \cdot 10^{-6}:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(1 + eps\_m\right) \cdot \left(-1 + \frac{1}{eps\_m}\right)\right)}{2}\\
\mathbf{elif}\;x \leq 350:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{+161}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x \cdot \left(1 - x \cdot \left(0.5 - x \cdot 0.16666666666666666\right)\right)}{eps\_m}}{2}\\
\end{array}
\end{array}
if x < -1.34999999999999999e-6Initial program 97.1%
Simplified97.1%
Taylor expanded in x around 0 52.9%
Taylor expanded in x around 0 24.8%
if -1.34999999999999999e-6 < x < 350Initial program 53.1%
Simplified53.1%
Taylor expanded in x around 0 76.2%
if 350 < x < 2.3999999999999999e161Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 22.6%
Taylor expanded in x around 0 54.4%
if 2.3999999999999999e161 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 27.0%
Taylor expanded in eps around 0 1.9%
mul-1-neg1.9%
Simplified1.9%
Taylor expanded in x around 0 38.1%
Final simplification61.5%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.35e-6) (* (* x eps_m) -0.5) (if (<= x 145.0) 1.0 (/ (* x eps_m) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.35e-6) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 145.0) {
tmp = 1.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-1.35d-6)) then
tmp = (x * eps_m) * (-0.5d0)
else if (x <= 145.0d0) then
tmp = 1.0d0
else
tmp = (x * eps_m) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1.35e-6) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 145.0) {
tmp = 1.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.35e-6: tmp = (x * eps_m) * -0.5 elif x <= 145.0: tmp = 1.0 else: tmp = (x * eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.35e-6) tmp = Float64(Float64(x * eps_m) * -0.5); elseif (x <= 145.0) tmp = 1.0; else tmp = Float64(Float64(x * eps_m) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.35e-6) tmp = (x * eps_m) * -0.5; elseif (x <= 145.0) tmp = 1.0; else tmp = (x * eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.35e-6], N[(N[(x * eps$95$m), $MachinePrecision] * -0.5), $MachinePrecision], If[LessEqual[x, 145.0], 1.0, N[(N[(x * eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{-6}:\\
\;\;\;\;\left(x \cdot eps\_m\right) \cdot -0.5\\
\mathbf{elif}\;x \leq 145:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < -1.34999999999999999e-6Initial program 97.1%
Simplified97.1%
Taylor expanded in x around 0 50.2%
Taylor expanded in x around 0 24.2%
mul-1-neg24.2%
unsub-neg24.2%
*-commutative24.2%
associate-*r*24.2%
Simplified24.2%
Taylor expanded in eps around inf 24.1%
frac-2neg24.1%
div-inv24.1%
distribute-rgt-neg-in24.1%
mul-1-neg24.1%
add-sqr-sqrt24.1%
sqrt-unprod26.8%
mul-1-neg26.8%
mul-1-neg26.8%
sqr-neg26.8%
sqrt-unprod0.0%
add-sqr-sqrt24.9%
*-commutative24.9%
metadata-eval24.9%
metadata-eval24.9%
Applied egg-rr24.9%
if -1.34999999999999999e-6 < x < 145Initial program 53.1%
Simplified53.1%
Taylor expanded in x around 0 76.2%
if 145 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 30.6%
Taylor expanded in x around 0 16.9%
mul-1-neg16.9%
unsub-neg16.9%
*-commutative16.9%
associate-*r*16.9%
Simplified16.9%
Taylor expanded in eps around inf 17.7%
Final simplification54.1%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.35e-6) (* (* x eps_m) -0.5) (/ (+ 2.0 (* x eps_m)) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.35e-6) {
tmp = (x * eps_m) * -0.5;
} else {
tmp = (2.0 + (x * eps_m)) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-1.35d-6)) then
tmp = (x * eps_m) * (-0.5d0)
else
tmp = (2.0d0 + (x * eps_m)) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1.35e-6) {
tmp = (x * eps_m) * -0.5;
} else {
tmp = (2.0 + (x * eps_m)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.35e-6: tmp = (x * eps_m) * -0.5 else: tmp = (2.0 + (x * eps_m)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.35e-6) tmp = Float64(Float64(x * eps_m) * -0.5); else tmp = Float64(Float64(2.0 + Float64(x * eps_m)) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.35e-6) tmp = (x * eps_m) * -0.5; else tmp = (2.0 + (x * eps_m)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.35e-6], N[(N[(x * eps$95$m), $MachinePrecision] * -0.5), $MachinePrecision], N[(N[(2.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{-6}:\\
\;\;\;\;\left(x \cdot eps\_m\right) \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < -1.34999999999999999e-6Initial program 97.1%
Simplified97.1%
Taylor expanded in x around 0 50.2%
Taylor expanded in x around 0 24.2%
mul-1-neg24.2%
unsub-neg24.2%
*-commutative24.2%
associate-*r*24.2%
Simplified24.2%
Taylor expanded in eps around inf 24.1%
frac-2neg24.1%
div-inv24.1%
distribute-rgt-neg-in24.1%
mul-1-neg24.1%
add-sqr-sqrt24.1%
sqrt-unprod26.8%
mul-1-neg26.8%
mul-1-neg26.8%
sqr-neg26.8%
sqrt-unprod0.0%
add-sqr-sqrt24.9%
*-commutative24.9%
metadata-eval24.9%
metadata-eval24.9%
Applied egg-rr24.9%
if -1.34999999999999999e-6 < x Initial program 67.1%
Simplified67.1%
Taylor expanded in x around 0 37.3%
Taylor expanded in x around 0 38.9%
mul-1-neg38.9%
unsub-neg38.9%
*-commutative38.9%
associate-*r*38.9%
Simplified38.9%
Taylor expanded in eps around inf 58.2%
Final simplification53.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.35e-6) (* (* x eps_m) -0.5) 1.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.35e-6) {
tmp = (x * eps_m) * -0.5;
} else {
tmp = 1.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-1.35d-6)) then
tmp = (x * eps_m) * (-0.5d0)
else
tmp = 1.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1.35e-6) {
tmp = (x * eps_m) * -0.5;
} else {
tmp = 1.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.35e-6: tmp = (x * eps_m) * -0.5 else: tmp = 1.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.35e-6) tmp = Float64(Float64(x * eps_m) * -0.5); else tmp = 1.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.35e-6) tmp = (x * eps_m) * -0.5; else tmp = 1.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.35e-6], N[(N[(x * eps$95$m), $MachinePrecision] * -0.5), $MachinePrecision], 1.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{-6}:\\
\;\;\;\;\left(x \cdot eps\_m\right) \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.34999999999999999e-6Initial program 97.1%
Simplified97.1%
Taylor expanded in x around 0 50.2%
Taylor expanded in x around 0 24.2%
mul-1-neg24.2%
unsub-neg24.2%
*-commutative24.2%
associate-*r*24.2%
Simplified24.2%
Taylor expanded in eps around inf 24.1%
frac-2neg24.1%
div-inv24.1%
distribute-rgt-neg-in24.1%
mul-1-neg24.1%
add-sqr-sqrt24.1%
sqrt-unprod26.8%
mul-1-neg26.8%
mul-1-neg26.8%
sqr-neg26.8%
sqrt-unprod0.0%
add-sqr-sqrt24.9%
*-commutative24.9%
metadata-eval24.9%
metadata-eval24.9%
Applied egg-rr24.9%
if -1.34999999999999999e-6 < x Initial program 67.1%
Simplified67.1%
Taylor expanded in x around 0 54.4%
Final simplification50.4%
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 71.2%
Simplified71.2%
Taylor expanded in x around 0 47.4%
Final simplification47.4%
herbie shell --seed 2024067
(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))