
(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 18 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))))
(if (<= eps_m 4e-42)
(/ (+ (* t_0 (+ x 2.0)) (* x t_0)) 2.0)
(/ (+ (exp (* x (+ eps_m -1.0))) (exp (* x (- -1.0 eps_m)))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp(-x);
double tmp;
if (eps_m <= 4e-42) {
tmp = ((t_0 * (x + 2.0)) + (x * t_0)) / 2.0;
} else {
tmp = (exp((x * (eps_m + -1.0))) + exp((x * (-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) :: t_0
real(8) :: tmp
t_0 = exp(-x)
if (eps_m <= 4d-42) then
tmp = ((t_0 * (x + 2.0d0)) + (x * t_0)) / 2.0d0
else
tmp = (exp((x * (eps_m + (-1.0d0)))) + exp((x * ((-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 t_0 = Math.exp(-x);
double tmp;
if (eps_m <= 4e-42) {
tmp = ((t_0 * (x + 2.0)) + (x * t_0)) / 2.0;
} else {
tmp = (Math.exp((x * (eps_m + -1.0))) + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp(-x) tmp = 0 if eps_m <= 4e-42: tmp = ((t_0 * (x + 2.0)) + (x * t_0)) / 2.0 else: tmp = (math.exp((x * (eps_m + -1.0))) + math.exp((x * (-1.0 - eps_m)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(-x)) tmp = 0.0 if (eps_m <= 4e-42) tmp = Float64(Float64(Float64(t_0 * Float64(x + 2.0)) + Float64(x * t_0)) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp(-x); tmp = 0.0; if (eps_m <= 4e-42) tmp = ((t_0 * (x + 2.0)) + (x * t_0)) / 2.0; else tmp = (exp((x * (eps_m + -1.0))) + exp((x * (-1.0 - eps_m)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Exp[(-x)], $MachinePrecision]}, If[LessEqual[eps$95$m, 4e-42], N[(N[(N[(t$95$0 * N[(x + 2.0), $MachinePrecision]), $MachinePrecision] + N[(x * t$95$0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{-x}\\
\mathbf{if}\;eps\_m \leq 4 \cdot 10^{-42}:\\
\;\;\;\;\frac{t\_0 \cdot \left(x + 2\right) + x \cdot t\_0}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(eps\_m + -1\right)} + e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\end{array}
\end{array}
if eps < 4.00000000000000015e-42Initial program 62.6%
Simplified62.6%
Taylor expanded in eps around 0 67.5%
associate--r+67.4%
associate-*r*67.4%
mul-1-neg67.4%
cancel-sign-sub67.4%
distribute-rgt1-in67.4%
distribute-rgt-out--69.1%
mul-1-neg69.1%
mul-1-neg69.1%
Simplified69.1%
Taylor expanded in x around 0 69.1%
+-commutative69.1%
Simplified69.1%
if 4.00000000000000015e-42 < eps Initial program 96.2%
Simplified79.6%
Taylor expanded in eps around inf 100.0%
Final simplification78.4%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (- x))))
(if (<= eps_m 1e-38)
(/ (+ (* t_0 (+ x 2.0)) (* x t_0)) 2.0)
(/ (+ (exp (* x (+ eps_m -1.0))) (exp (* eps_m (- x)))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp(-x);
double tmp;
if (eps_m <= 1e-38) {
tmp = ((t_0 * (x + 2.0)) + (x * t_0)) / 2.0;
} else {
tmp = (exp((x * (eps_m + -1.0))) + exp((eps_m * -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)
if (eps_m <= 1d-38) then
tmp = ((t_0 * (x + 2.0d0)) + (x * t_0)) / 2.0d0
else
tmp = (exp((x * (eps_m + (-1.0d0)))) + exp((eps_m * -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);
double tmp;
if (eps_m <= 1e-38) {
tmp = ((t_0 * (x + 2.0)) + (x * t_0)) / 2.0;
} else {
tmp = (Math.exp((x * (eps_m + -1.0))) + Math.exp((eps_m * -x))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp(-x) tmp = 0 if eps_m <= 1e-38: tmp = ((t_0 * (x + 2.0)) + (x * t_0)) / 2.0 else: tmp = (math.exp((x * (eps_m + -1.0))) + math.exp((eps_m * -x))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(-x)) tmp = 0.0 if (eps_m <= 1e-38) tmp = Float64(Float64(Float64(t_0 * Float64(x + 2.0)) + Float64(x * t_0)) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + exp(Float64(eps_m * Float64(-x)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp(-x); tmp = 0.0; if (eps_m <= 1e-38) tmp = ((t_0 * (x + 2.0)) + (x * t_0)) / 2.0; else tmp = (exp((x * (eps_m + -1.0))) + exp((eps_m * -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[(-x)], $MachinePrecision]}, If[LessEqual[eps$95$m, 1e-38], N[(N[(N[(t$95$0 * N[(x + 2.0), $MachinePrecision]), $MachinePrecision] + N[(x * t$95$0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{-x}\\
\mathbf{if}\;eps\_m \leq 10^{-38}:\\
\;\;\;\;\frac{t\_0 \cdot \left(x + 2\right) + x \cdot t\_0}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(eps\_m + -1\right)} + e^{eps\_m \cdot \left(-x\right)}}{2}\\
\end{array}
\end{array}
if eps < 9.9999999999999996e-39Initial program 62.8%
Simplified62.8%
Taylor expanded in eps around 0 67.6%
associate--r+67.6%
associate-*r*67.6%
mul-1-neg67.6%
cancel-sign-sub67.6%
distribute-rgt1-in67.6%
distribute-rgt-out--69.3%
mul-1-neg69.3%
mul-1-neg69.3%
Simplified69.3%
Taylor expanded in x around 0 69.3%
+-commutative69.3%
Simplified69.3%
if 9.9999999999999996e-39 < eps Initial program 96.2%
Simplified79.4%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification78.4%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 1.7e-38) (/ (* (exp (- x)) (+ 2.0 (* x 2.0))) 2.0) (/ (+ (exp (* x (+ eps_m -1.0))) (exp (* eps_m (- x)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 1.7e-38) {
tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0;
} else {
tmp = (exp((x * (eps_m + -1.0))) + exp((eps_m * -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 (eps_m <= 1.7d-38) then
tmp = (exp(-x) * (2.0d0 + (x * 2.0d0))) / 2.0d0
else
tmp = (exp((x * (eps_m + (-1.0d0)))) + exp((eps_m * -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 (eps_m <= 1.7e-38) {
tmp = (Math.exp(-x) * (2.0 + (x * 2.0))) / 2.0;
} else {
tmp = (Math.exp((x * (eps_m + -1.0))) + Math.exp((eps_m * -x))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 1.7e-38: tmp = (math.exp(-x) * (2.0 + (x * 2.0))) / 2.0 else: tmp = (math.exp((x * (eps_m + -1.0))) + math.exp((eps_m * -x))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 1.7e-38) tmp = Float64(Float64(exp(Float64(-x)) * Float64(2.0 + Float64(x * 2.0))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + exp(Float64(eps_m * Float64(-x)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 1.7e-38) tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0; else tmp = (exp((x * (eps_m + -1.0))) + exp((eps_m * -x))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 1.7e-38], N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 1.7 \cdot 10^{-38}:\\
\;\;\;\;\frac{e^{-x} \cdot \left(2 + x \cdot 2\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(eps\_m + -1\right)} + e^{eps\_m \cdot \left(-x\right)}}{2}\\
\end{array}
\end{array}
if eps < 1.7000000000000001e-38Initial program 62.8%
Simplified53.4%
Taylor expanded in eps around 0 32.0%
Simplified69.3%
Taylor expanded in eps around 0 69.3%
if 1.7000000000000001e-38 < eps Initial program 96.2%
Simplified79.4%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification78.4%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (/ (* (exp (- x)) (+ 2.0 (* x 2.0))) 2.0)))
(if (<= x -0.95)
(/
(+
(+ 1.0 (/ 1.0 eps_m))
(* (exp (* x (- -1.0 eps_m))) (- (/ -1.0 eps_m) -1.0)))
2.0)
(if (<= x -1.2e-18)
t_0
(if (<= x -1e-285)
(/ (+ 1.0 (exp (* eps_m (- x)))) 2.0)
(if (<= x 1800000000.0)
(/ (+ 1.0 (exp (* eps_m x))) 2.0)
(if (<= x 9e+91)
t_0
(/ (+ 1.0 (exp (* x (+ eps_m -1.0)))) 2.0))))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = (exp(-x) * (2.0 + (x * 2.0))) / 2.0;
double tmp;
if (x <= -0.95) {
tmp = ((1.0 + (1.0 / eps_m)) + (exp((x * (-1.0 - eps_m))) * ((-1.0 / eps_m) - -1.0))) / 2.0;
} else if (x <= -1.2e-18) {
tmp = t_0;
} else if (x <= -1e-285) {
tmp = (1.0 + exp((eps_m * -x))) / 2.0;
} else if (x <= 1800000000.0) {
tmp = (1.0 + exp((eps_m * x))) / 2.0;
} else if (x <= 9e+91) {
tmp = t_0;
} else {
tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: tmp
t_0 = (exp(-x) * (2.0d0 + (x * 2.0d0))) / 2.0d0
if (x <= (-0.95d0)) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (exp((x * ((-1.0d0) - eps_m))) * (((-1.0d0) / eps_m) - (-1.0d0)))) / 2.0d0
else if (x <= (-1.2d-18)) then
tmp = t_0
else if (x <= (-1d-285)) then
tmp = (1.0d0 + exp((eps_m * -x))) / 2.0d0
else if (x <= 1800000000.0d0) then
tmp = (1.0d0 + exp((eps_m * x))) / 2.0d0
else if (x <= 9d+91) then
tmp = t_0
else
tmp = (1.0d0 + exp((x * (eps_m + (-1.0d0))))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = (Math.exp(-x) * (2.0 + (x * 2.0))) / 2.0;
double tmp;
if (x <= -0.95) {
tmp = ((1.0 + (1.0 / eps_m)) + (Math.exp((x * (-1.0 - eps_m))) * ((-1.0 / eps_m) - -1.0))) / 2.0;
} else if (x <= -1.2e-18) {
tmp = t_0;
} else if (x <= -1e-285) {
tmp = (1.0 + Math.exp((eps_m * -x))) / 2.0;
} else if (x <= 1800000000.0) {
tmp = (1.0 + Math.exp((eps_m * x))) / 2.0;
} else if (x <= 9e+91) {
tmp = t_0;
} else {
tmp = (1.0 + Math.exp((x * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = (math.exp(-x) * (2.0 + (x * 2.0))) / 2.0 tmp = 0 if x <= -0.95: tmp = ((1.0 + (1.0 / eps_m)) + (math.exp((x * (-1.0 - eps_m))) * ((-1.0 / eps_m) - -1.0))) / 2.0 elif x <= -1.2e-18: tmp = t_0 elif x <= -1e-285: tmp = (1.0 + math.exp((eps_m * -x))) / 2.0 elif x <= 1800000000.0: tmp = (1.0 + math.exp((eps_m * x))) / 2.0 elif x <= 9e+91: tmp = t_0 else: tmp = (1.0 + math.exp((x * (eps_m + -1.0)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(Float64(exp(Float64(-x)) * Float64(2.0 + Float64(x * 2.0))) / 2.0) tmp = 0.0 if (x <= -0.95) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(exp(Float64(x * Float64(-1.0 - eps_m))) * Float64(Float64(-1.0 / eps_m) - -1.0))) / 2.0); elseif (x <= -1.2e-18) tmp = t_0; elseif (x <= -1e-285) tmp = Float64(Float64(1.0 + exp(Float64(eps_m * Float64(-x)))) / 2.0); elseif (x <= 1800000000.0) tmp = Float64(Float64(1.0 + exp(Float64(eps_m * x))) / 2.0); elseif (x <= 9e+91) tmp = t_0; else tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps_m + -1.0)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = (exp(-x) * (2.0 + (x * 2.0))) / 2.0; tmp = 0.0; if (x <= -0.95) tmp = ((1.0 + (1.0 / eps_m)) + (exp((x * (-1.0 - eps_m))) * ((-1.0 / eps_m) - -1.0))) / 2.0; elseif (x <= -1.2e-18) tmp = t_0; elseif (x <= -1e-285) tmp = (1.0 + exp((eps_m * -x))) / 2.0; elseif (x <= 1800000000.0) tmp = (1.0 + exp((eps_m * x))) / 2.0; elseif (x <= 9e+91) tmp = t_0; else tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, -0.95], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(-1.0 / eps$95$m), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -1.2e-18], t$95$0, If[LessEqual[x, -1e-285], N[(N[(1.0 + N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1800000000.0], N[(N[(1.0 + N[Exp[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 9e+91], t$95$0, N[(N[(1.0 + N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := \frac{e^{-x} \cdot \left(2 + x \cdot 2\right)}{2}\\
\mathbf{if}\;x \leq -0.95:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + e^{x \cdot \left(-1 - eps\_m\right)} \cdot \left(\frac{-1}{eps\_m} - -1\right)}{2}\\
\mathbf{elif}\;x \leq -1.2 \cdot 10^{-18}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -1 \cdot 10^{-285}:\\
\;\;\;\;\frac{1 + e^{eps\_m \cdot \left(-x\right)}}{2}\\
\mathbf{elif}\;x \leq 1800000000:\\
\;\;\;\;\frac{1 + e^{eps\_m \cdot x}}{2}\\
\mathbf{elif}\;x \leq 9 \cdot 10^{+91}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\end{array}
\end{array}
if x < -0.94999999999999996Initial program 93.3%
Simplified93.3%
Taylor expanded in x around 0 50.3%
metadata-eval50.3%
distribute-neg-frac50.3%
metadata-eval50.3%
associate-*l/50.3%
*-commutative50.3%
distribute-lft-neg-in50.3%
cancel-sign-sub-inv50.3%
*-commutative50.3%
associate-*l/50.3%
metadata-eval50.3%
Simplified50.3%
if -0.94999999999999996 < x < -1.19999999999999997e-18 or 1.8e9 < x < 9e91Initial program 78.0%
Simplified78.0%
Taylor expanded in eps around 0 60.1%
Simplified81.8%
Taylor expanded in eps around 0 81.9%
if -1.19999999999999997e-18 < x < -1.00000000000000007e-285Initial program 45.7%
Simplified45.7%
Taylor expanded in x around 0 35.1%
metadata-eval35.1%
distribute-neg-frac35.1%
metadata-eval35.1%
associate-*l/35.1%
*-commutative35.1%
distribute-lft-neg-in35.1%
cancel-sign-sub-inv35.1%
*-commutative35.1%
associate-*l/35.1%
metadata-eval35.1%
Simplified35.1%
Taylor expanded in eps around inf 89.4%
associate-*r*89.4%
*-lft-identity89.4%
metadata-eval89.4%
cancel-sign-sub-inv89.4%
associate-*r*89.4%
mul-1-neg89.4%
associate-*r*89.4%
neg-mul-189.4%
cancel-sign-sub-inv89.4%
metadata-eval89.4%
*-lft-identity89.4%
+-commutative89.4%
Simplified89.4%
Taylor expanded in eps around inf 89.4%
associate-*r*89.4%
neg-mul-189.4%
*-commutative89.4%
Simplified89.4%
if -1.00000000000000007e-285 < x < 1.8e9Initial program 60.4%
Simplified60.4%
Taylor expanded in x around 0 42.7%
Taylor expanded in eps around inf 80.9%
neg-mul-180.9%
distribute-rgt-neg-in80.9%
Simplified80.9%
Taylor expanded in eps around inf 81.6%
*-commutative81.6%
Simplified81.6%
if 9e91 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 33.4%
Taylor expanded in eps around inf 33.7%
neg-mul-133.7%
distribute-rgt-neg-in33.7%
Simplified33.7%
Final simplification67.5%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -2e-296)
(/ (+ 1.0 (exp (* eps_m (- x)))) 2.0)
(if (or (<= x 60000000000000.0) (not (<= x 2.9e+92)))
(/ (+ 1.0 (exp (* eps_m x))) 2.0)
(/ (* (exp (- x)) (+ 2.0 (* x 2.0))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -2e-296) {
tmp = (1.0 + exp((eps_m * -x))) / 2.0;
} else if ((x <= 60000000000000.0) || !(x <= 2.9e+92)) {
tmp = (1.0 + exp((eps_m * x))) / 2.0;
} else {
tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-2d-296)) then
tmp = (1.0d0 + exp((eps_m * -x))) / 2.0d0
else if ((x <= 60000000000000.0d0) .or. (.not. (x <= 2.9d+92))) then
tmp = (1.0d0 + exp((eps_m * x))) / 2.0d0
else
tmp = (exp(-x) * (2.0d0 + (x * 2.0d0))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -2e-296) {
tmp = (1.0 + Math.exp((eps_m * -x))) / 2.0;
} else if ((x <= 60000000000000.0) || !(x <= 2.9e+92)) {
tmp = (1.0 + Math.exp((eps_m * x))) / 2.0;
} else {
tmp = (Math.exp(-x) * (2.0 + (x * 2.0))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -2e-296: tmp = (1.0 + math.exp((eps_m * -x))) / 2.0 elif (x <= 60000000000000.0) or not (x <= 2.9e+92): tmp = (1.0 + math.exp((eps_m * x))) / 2.0 else: tmp = (math.exp(-x) * (2.0 + (x * 2.0))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -2e-296) tmp = Float64(Float64(1.0 + exp(Float64(eps_m * Float64(-x)))) / 2.0); elseif ((x <= 60000000000000.0) || !(x <= 2.9e+92)) tmp = Float64(Float64(1.0 + exp(Float64(eps_m * x))) / 2.0); else tmp = Float64(Float64(exp(Float64(-x)) * Float64(2.0 + Float64(x * 2.0))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -2e-296) tmp = (1.0 + exp((eps_m * -x))) / 2.0; elseif ((x <= 60000000000000.0) || ~((x <= 2.9e+92))) tmp = (1.0 + exp((eps_m * x))) / 2.0; else tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -2e-296], N[(N[(1.0 + N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 60000000000000.0], N[Not[LessEqual[x, 2.9e+92]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-296}:\\
\;\;\;\;\frac{1 + e^{eps\_m \cdot \left(-x\right)}}{2}\\
\mathbf{elif}\;x \leq 60000000000000 \lor \neg \left(x \leq 2.9 \cdot 10^{+92}\right):\\
\;\;\;\;\frac{1 + e^{eps\_m \cdot x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{-x} \cdot \left(2 + x \cdot 2\right)}{2}\\
\end{array}
\end{array}
if x < -2e-296Initial program 62.3%
Simplified62.3%
Taylor expanded in x around 0 39.6%
metadata-eval39.6%
distribute-neg-frac39.6%
metadata-eval39.6%
associate-*l/39.6%
*-commutative39.6%
distribute-lft-neg-in39.6%
cancel-sign-sub-inv39.6%
*-commutative39.6%
associate-*l/39.6%
metadata-eval39.6%
Simplified39.6%
Taylor expanded in eps around inf 72.0%
associate-*r*72.0%
*-lft-identity72.0%
metadata-eval72.0%
cancel-sign-sub-inv72.0%
associate-*r*72.0%
mul-1-neg72.0%
associate-*r*72.0%
neg-mul-172.0%
cancel-sign-sub-inv72.0%
metadata-eval72.0%
*-lft-identity72.0%
+-commutative72.0%
Simplified72.0%
Taylor expanded in eps around inf 72.2%
associate-*r*72.2%
neg-mul-172.2%
*-commutative72.2%
Simplified72.2%
if -2e-296 < x < 6e13 or 2.9000000000000001e92 < x Initial program 78.7%
Simplified78.7%
Taylor expanded in x around 0 38.4%
Taylor expanded in eps around inf 59.0%
neg-mul-159.0%
distribute-rgt-neg-in59.0%
Simplified59.0%
Taylor expanded in eps around inf 59.3%
*-commutative59.3%
Simplified59.3%
if 6e13 < x < 2.9000000000000001e92Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 76.8%
Simplified76.8%
Taylor expanded in eps around 0 76.8%
Final simplification66.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1e-285)
(/ (+ 1.0 (exp (* eps_m (- x)))) 2.0)
(if (<= x 60000000000000.0)
(/ (+ 1.0 (exp (* eps_m x))) 2.0)
(if (<= x 9e+91)
(/ (* (exp (- x)) (+ 2.0 (* x 2.0))) 2.0)
(/ (+ 1.0 (exp (* x (+ eps_m -1.0)))) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1e-285) {
tmp = (1.0 + exp((eps_m * -x))) / 2.0;
} else if (x <= 60000000000000.0) {
tmp = (1.0 + exp((eps_m * x))) / 2.0;
} else if (x <= 9e+91) {
tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0;
} else {
tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-1d-285)) then
tmp = (1.0d0 + exp((eps_m * -x))) / 2.0d0
else if (x <= 60000000000000.0d0) then
tmp = (1.0d0 + exp((eps_m * x))) / 2.0d0
else if (x <= 9d+91) then
tmp = (exp(-x) * (2.0d0 + (x * 2.0d0))) / 2.0d0
else
tmp = (1.0d0 + exp((x * (eps_m + (-1.0d0))))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1e-285) {
tmp = (1.0 + Math.exp((eps_m * -x))) / 2.0;
} else if (x <= 60000000000000.0) {
tmp = (1.0 + Math.exp((eps_m * x))) / 2.0;
} else if (x <= 9e+91) {
tmp = (Math.exp(-x) * (2.0 + (x * 2.0))) / 2.0;
} else {
tmp = (1.0 + Math.exp((x * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1e-285: tmp = (1.0 + math.exp((eps_m * -x))) / 2.0 elif x <= 60000000000000.0: tmp = (1.0 + math.exp((eps_m * x))) / 2.0 elif x <= 9e+91: tmp = (math.exp(-x) * (2.0 + (x * 2.0))) / 2.0 else: tmp = (1.0 + math.exp((x * (eps_m + -1.0)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1e-285) tmp = Float64(Float64(1.0 + exp(Float64(eps_m * Float64(-x)))) / 2.0); elseif (x <= 60000000000000.0) tmp = Float64(Float64(1.0 + exp(Float64(eps_m * x))) / 2.0); elseif (x <= 9e+91) tmp = Float64(Float64(exp(Float64(-x)) * Float64(2.0 + Float64(x * 2.0))) / 2.0); else tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps_m + -1.0)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1e-285) tmp = (1.0 + exp((eps_m * -x))) / 2.0; elseif (x <= 60000000000000.0) tmp = (1.0 + exp((eps_m * x))) / 2.0; elseif (x <= 9e+91) tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0; else tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1e-285], N[(N[(1.0 + N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 60000000000000.0], N[(N[(1.0 + N[Exp[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 9e+91], N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-285}:\\
\;\;\;\;\frac{1 + e^{eps\_m \cdot \left(-x\right)}}{2}\\
\mathbf{elif}\;x \leq 60000000000000:\\
\;\;\;\;\frac{1 + e^{eps\_m \cdot x}}{2}\\
\mathbf{elif}\;x \leq 9 \cdot 10^{+91}:\\
\;\;\;\;\frac{e^{-x} \cdot \left(2 + x \cdot 2\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\end{array}
\end{array}
if x < -1.00000000000000007e-285Initial program 62.3%
Simplified62.3%
Taylor expanded in x around 0 39.6%
metadata-eval39.6%
distribute-neg-frac39.6%
metadata-eval39.6%
associate-*l/39.6%
*-commutative39.6%
distribute-lft-neg-in39.6%
cancel-sign-sub-inv39.6%
*-commutative39.6%
associate-*l/39.6%
metadata-eval39.6%
Simplified39.6%
Taylor expanded in eps around inf 72.0%
associate-*r*72.0%
*-lft-identity72.0%
metadata-eval72.0%
cancel-sign-sub-inv72.0%
associate-*r*72.0%
mul-1-neg72.0%
associate-*r*72.0%
neg-mul-172.0%
cancel-sign-sub-inv72.0%
metadata-eval72.0%
*-lft-identity72.0%
+-commutative72.0%
Simplified72.0%
Taylor expanded in eps around inf 72.2%
associate-*r*72.2%
neg-mul-172.2%
*-commutative72.2%
Simplified72.2%
if -1.00000000000000007e-285 < x < 6e13Initial program 60.4%
Simplified60.4%
Taylor expanded in x around 0 42.7%
Taylor expanded in eps around inf 80.9%
neg-mul-180.9%
distribute-rgt-neg-in80.9%
Simplified80.9%
Taylor expanded in eps around inf 81.6%
*-commutative81.6%
Simplified81.6%
if 6e13 < x < 9e91Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 76.8%
Simplified76.8%
Taylor expanded in eps around 0 76.8%
if 9e91 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 33.4%
Taylor expanded in eps around inf 33.7%
neg-mul-133.7%
distribute-rgt-neg-in33.7%
Simplified33.7%
Final simplification66.4%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -5e-299)
(/ (+ (exp (- x)) 1.0) 2.0)
(if (or (<= x 210000000000.0) (not (<= x 9e+91)))
(/ (+ 1.0 (exp (* eps_m x))) 2.0)
0.0)))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -5e-299) {
tmp = (exp(-x) + 1.0) / 2.0;
} else if ((x <= 210000000000.0) || !(x <= 9e+91)) {
tmp = (1.0 + exp((eps_m * x))) / 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 <= (-5d-299)) then
tmp = (exp(-x) + 1.0d0) / 2.0d0
else if ((x <= 210000000000.0d0) .or. (.not. (x <= 9d+91))) then
tmp = (1.0d0 + exp((eps_m * x))) / 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 <= -5e-299) {
tmp = (Math.exp(-x) + 1.0) / 2.0;
} else if ((x <= 210000000000.0) || !(x <= 9e+91)) {
tmp = (1.0 + Math.exp((eps_m * x))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -5e-299: tmp = (math.exp(-x) + 1.0) / 2.0 elif (x <= 210000000000.0) or not (x <= 9e+91): tmp = (1.0 + math.exp((eps_m * x))) / 2.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -5e-299) tmp = Float64(Float64(exp(Float64(-x)) + 1.0) / 2.0); elseif ((x <= 210000000000.0) || !(x <= 9e+91)) tmp = Float64(Float64(1.0 + exp(Float64(eps_m * x))) / 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 <= -5e-299) tmp = (exp(-x) + 1.0) / 2.0; elseif ((x <= 210000000000.0) || ~((x <= 9e+91))) tmp = (1.0 + exp((eps_m * x))) / 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, -5e-299], N[(N[(N[Exp[(-x)], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 210000000000.0], N[Not[LessEqual[x, 9e+91]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-299}:\\
\;\;\;\;\frac{e^{-x} + 1}{2}\\
\mathbf{elif}\;x \leq 210000000000 \lor \neg \left(x \leq 9 \cdot 10^{+91}\right):\\
\;\;\;\;\frac{1 + e^{eps\_m \cdot x}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -4.99999999999999956e-299Initial program 62.3%
Simplified49.2%
Taylor expanded in eps around inf 95.5%
Taylor expanded in eps around inf 95.6%
*-commutative95.6%
Simplified95.6%
Taylor expanded in eps around 0 83.3%
mul-1-neg83.3%
Simplified83.3%
if -4.99999999999999956e-299 < x < 2.1e11 or 9e91 < x Initial program 78.7%
Simplified78.7%
Taylor expanded in x around 0 38.4%
Taylor expanded in eps around inf 59.0%
neg-mul-159.0%
distribute-rgt-neg-in59.0%
Simplified59.0%
Taylor expanded in eps around inf 59.3%
*-commutative59.3%
Simplified59.3%
if 2.1e11 < x < 9e91Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 76.8%
mul-1-neg76.8%
mul-1-neg76.8%
rec-exp76.8%
sub-neg76.8%
div-sub76.8%
mul-1-neg76.8%
rec-exp76.8%
+-inverses76.8%
Simplified76.8%
Final simplification71.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1e-285)
(/ (+ 1.0 (exp (* eps_m (- x)))) 2.0)
(if (or (<= x 46000000000000.0) (not (<= x 9.5e+91)))
(/ (+ 1.0 (exp (* eps_m x))) 2.0)
0.0)))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1e-285) {
tmp = (1.0 + exp((eps_m * -x))) / 2.0;
} else if ((x <= 46000000000000.0) || !(x <= 9.5e+91)) {
tmp = (1.0 + exp((eps_m * x))) / 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 <= (-1d-285)) then
tmp = (1.0d0 + exp((eps_m * -x))) / 2.0d0
else if ((x <= 46000000000000.0d0) .or. (.not. (x <= 9.5d+91))) then
tmp = (1.0d0 + exp((eps_m * x))) / 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 <= -1e-285) {
tmp = (1.0 + Math.exp((eps_m * -x))) / 2.0;
} else if ((x <= 46000000000000.0) || !(x <= 9.5e+91)) {
tmp = (1.0 + Math.exp((eps_m * x))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1e-285: tmp = (1.0 + math.exp((eps_m * -x))) / 2.0 elif (x <= 46000000000000.0) or not (x <= 9.5e+91): tmp = (1.0 + math.exp((eps_m * x))) / 2.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1e-285) tmp = Float64(Float64(1.0 + exp(Float64(eps_m * Float64(-x)))) / 2.0); elseif ((x <= 46000000000000.0) || !(x <= 9.5e+91)) tmp = Float64(Float64(1.0 + exp(Float64(eps_m * x))) / 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 <= -1e-285) tmp = (1.0 + exp((eps_m * -x))) / 2.0; elseif ((x <= 46000000000000.0) || ~((x <= 9.5e+91))) tmp = (1.0 + exp((eps_m * x))) / 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, -1e-285], N[(N[(1.0 + N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 46000000000000.0], N[Not[LessEqual[x, 9.5e+91]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-285}:\\
\;\;\;\;\frac{1 + e^{eps\_m \cdot \left(-x\right)}}{2}\\
\mathbf{elif}\;x \leq 46000000000000 \lor \neg \left(x \leq 9.5 \cdot 10^{+91}\right):\\
\;\;\;\;\frac{1 + e^{eps\_m \cdot x}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -1.00000000000000007e-285Initial program 62.3%
Simplified62.3%
Taylor expanded in x around 0 39.6%
metadata-eval39.6%
distribute-neg-frac39.6%
metadata-eval39.6%
associate-*l/39.6%
*-commutative39.6%
distribute-lft-neg-in39.6%
cancel-sign-sub-inv39.6%
*-commutative39.6%
associate-*l/39.6%
metadata-eval39.6%
Simplified39.6%
Taylor expanded in eps around inf 72.0%
associate-*r*72.0%
*-lft-identity72.0%
metadata-eval72.0%
cancel-sign-sub-inv72.0%
associate-*r*72.0%
mul-1-neg72.0%
associate-*r*72.0%
neg-mul-172.0%
cancel-sign-sub-inv72.0%
metadata-eval72.0%
*-lft-identity72.0%
+-commutative72.0%
Simplified72.0%
Taylor expanded in eps around inf 72.2%
associate-*r*72.2%
neg-mul-172.2%
*-commutative72.2%
Simplified72.2%
if -1.00000000000000007e-285 < x < 4.6e13 or 9.5000000000000001e91 < x Initial program 78.7%
Simplified78.7%
Taylor expanded in x around 0 38.4%
Taylor expanded in eps around inf 59.0%
neg-mul-159.0%
distribute-rgt-neg-in59.0%
Simplified59.0%
Taylor expanded in eps around inf 59.3%
*-commutative59.3%
Simplified59.3%
if 4.6e13 < x < 9.5000000000000001e91Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 76.8%
mul-1-neg76.8%
mul-1-neg76.8%
rec-exp76.8%
sub-neg76.8%
div-sub76.8%
mul-1-neg76.8%
rec-exp76.8%
+-inverses76.8%
Simplified76.8%
Final simplification66.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 1.6e-85)
(/ (+ 2.0 (* x (+ -1.0 (* x (+ 0.5 (* x -0.16666666666666666)))))) 2.0)
(if (<= x 1950.0)
(/ (/ (- (* eps_m (+ 2.0 (+ x (- (* eps_m x) x)))) x) eps_m) 2.0)
(if (<= x 1.05e+92) 0.0 (/ (+ 1.0 (exp x)) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1.6e-85) {
tmp = (2.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) / 2.0;
} else if (x <= 1950.0) {
tmp = (((eps_m * (2.0 + (x + ((eps_m * x) - x)))) - x) / eps_m) / 2.0;
} else if (x <= 1.05e+92) {
tmp = 0.0;
} else {
tmp = (1.0 + exp(x)) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 1.6d-85) then
tmp = (2.0d0 + (x * ((-1.0d0) + (x * (0.5d0 + (x * (-0.16666666666666666d0))))))) / 2.0d0
else if (x <= 1950.0d0) then
tmp = (((eps_m * (2.0d0 + (x + ((eps_m * x) - x)))) - x) / eps_m) / 2.0d0
else if (x <= 1.05d+92) then
tmp = 0.0d0
else
tmp = (1.0d0 + exp(x)) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 1.6e-85) {
tmp = (2.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) / 2.0;
} else if (x <= 1950.0) {
tmp = (((eps_m * (2.0 + (x + ((eps_m * x) - x)))) - x) / eps_m) / 2.0;
} else if (x <= 1.05e+92) {
tmp = 0.0;
} else {
tmp = (1.0 + Math.exp(x)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1.6e-85: tmp = (2.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) / 2.0 elif x <= 1950.0: tmp = (((eps_m * (2.0 + (x + ((eps_m * x) - x)))) - x) / eps_m) / 2.0 elif x <= 1.05e+92: tmp = 0.0 else: tmp = (1.0 + math.exp(x)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1.6e-85) tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(x * Float64(0.5 + Float64(x * -0.16666666666666666)))))) / 2.0); elseif (x <= 1950.0) tmp = Float64(Float64(Float64(Float64(eps_m * Float64(2.0 + Float64(x + Float64(Float64(eps_m * x) - x)))) - x) / eps_m) / 2.0); elseif (x <= 1.05e+92) tmp = 0.0; else tmp = Float64(Float64(1.0 + exp(x)) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 1.6e-85) tmp = (2.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) / 2.0; elseif (x <= 1950.0) tmp = (((eps_m * (2.0 + (x + ((eps_m * x) - x)))) - x) / eps_m) / 2.0; elseif (x <= 1.05e+92) tmp = 0.0; else tmp = (1.0 + exp(x)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 1.6e-85], N[(N[(2.0 + N[(x * N[(-1.0 + N[(x * N[(0.5 + N[(x * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1950.0], N[(N[(N[(N[(eps$95$m * N[(2.0 + N[(x + N[(N[(eps$95$m * x), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.05e+92], 0.0, N[(N[(1.0 + N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.6 \cdot 10^{-85}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + x \cdot \left(0.5 + x \cdot -0.16666666666666666\right)\right)}{2}\\
\mathbf{elif}\;x \leq 1950:\\
\;\;\;\;\frac{\frac{eps\_m \cdot \left(2 + \left(x + \left(eps\_m \cdot x - x\right)\right)\right) - x}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{+92}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x}}{2}\\
\end{array}
\end{array}
if x < 1.60000000000000014e-85Initial program 58.6%
Simplified40.2%
Taylor expanded in eps around inf 96.7%
Taylor expanded in eps around inf 96.7%
*-commutative96.7%
Simplified96.7%
Taylor expanded in eps around 0 85.8%
mul-1-neg85.8%
Simplified85.8%
Taylor expanded in x around 0 78.0%
if 1.60000000000000014e-85 < x < 1950Initial program 78.9%
Simplified78.9%
Taylor expanded in x around 0 40.8%
Taylor expanded in x around 0 17.4%
mul-1-neg17.4%
associate-*r*17.4%
distribute-rgt-neg-in17.4%
distribute-lft-in17.4%
*-rgt-identity17.4%
associate-*r/17.4%
*-rgt-identity17.4%
sub-neg17.4%
distribute-neg-in17.4%
metadata-eval17.4%
remove-double-neg17.4%
+-commutative17.4%
Simplified17.4%
Taylor expanded in eps around 0 29.7%
if 1950 < x < 1.04999999999999993e92Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 74.1%
mul-1-neg74.1%
mul-1-neg74.1%
rec-exp74.1%
sub-neg74.1%
div-sub74.1%
mul-1-neg74.1%
rec-exp74.1%
+-inverses74.1%
Simplified74.1%
if 1.04999999999999993e92 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 79.5%
*-commutative79.5%
Simplified79.5%
Taylor expanded in eps around 0 3.1%
mul-1-neg3.1%
Simplified3.1%
*-un-lft-identity3.1%
add-sqr-sqrt0.0%
sqrt-unprod60.3%
sqr-neg60.3%
sqrt-unprod60.3%
add-sqr-sqrt60.3%
Applied egg-rr60.3%
*-lft-identity60.3%
Simplified60.3%
Final simplification69.4%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 9e-92)
(/ (+ (exp (- x)) 1.0) 2.0)
(if (<= x 1950.0)
(/ (/ (- (* eps_m (+ 2.0 (+ x (- (* eps_m x) x)))) x) eps_m) 2.0)
(if (<= x 2.1e+92) 0.0 (/ (+ 1.0 (exp x)) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 9e-92) {
tmp = (exp(-x) + 1.0) / 2.0;
} else if (x <= 1950.0) {
tmp = (((eps_m * (2.0 + (x + ((eps_m * x) - x)))) - x) / eps_m) / 2.0;
} else if (x <= 2.1e+92) {
tmp = 0.0;
} else {
tmp = (1.0 + exp(x)) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 9d-92) then
tmp = (exp(-x) + 1.0d0) / 2.0d0
else if (x <= 1950.0d0) then
tmp = (((eps_m * (2.0d0 + (x + ((eps_m * x) - x)))) - x) / eps_m) / 2.0d0
else if (x <= 2.1d+92) then
tmp = 0.0d0
else
tmp = (1.0d0 + exp(x)) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 9e-92) {
tmp = (Math.exp(-x) + 1.0) / 2.0;
} else if (x <= 1950.0) {
tmp = (((eps_m * (2.0 + (x + ((eps_m * x) - x)))) - x) / eps_m) / 2.0;
} else if (x <= 2.1e+92) {
tmp = 0.0;
} else {
tmp = (1.0 + Math.exp(x)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 9e-92: tmp = (math.exp(-x) + 1.0) / 2.0 elif x <= 1950.0: tmp = (((eps_m * (2.0 + (x + ((eps_m * x) - x)))) - x) / eps_m) / 2.0 elif x <= 2.1e+92: tmp = 0.0 else: tmp = (1.0 + math.exp(x)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 9e-92) tmp = Float64(Float64(exp(Float64(-x)) + 1.0) / 2.0); elseif (x <= 1950.0) tmp = Float64(Float64(Float64(Float64(eps_m * Float64(2.0 + Float64(x + Float64(Float64(eps_m * x) - x)))) - x) / eps_m) / 2.0); elseif (x <= 2.1e+92) tmp = 0.0; else tmp = Float64(Float64(1.0 + exp(x)) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 9e-92) tmp = (exp(-x) + 1.0) / 2.0; elseif (x <= 1950.0) tmp = (((eps_m * (2.0 + (x + ((eps_m * x) - x)))) - x) / eps_m) / 2.0; elseif (x <= 2.1e+92) tmp = 0.0; else tmp = (1.0 + exp(x)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 9e-92], N[(N[(N[Exp[(-x)], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1950.0], N[(N[(N[(N[(eps$95$m * N[(2.0 + N[(x + N[(N[(eps$95$m * x), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.1e+92], 0.0, N[(N[(1.0 + N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 9 \cdot 10^{-92}:\\
\;\;\;\;\frac{e^{-x} + 1}{2}\\
\mathbf{elif}\;x \leq 1950:\\
\;\;\;\;\frac{\frac{eps\_m \cdot \left(2 + \left(x + \left(eps\_m \cdot x - x\right)\right)\right) - x}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{+92}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x}}{2}\\
\end{array}
\end{array}
if x < 9.0000000000000001e-92Initial program 58.6%
Simplified40.2%
Taylor expanded in eps around inf 96.7%
Taylor expanded in eps around inf 96.7%
*-commutative96.7%
Simplified96.7%
Taylor expanded in eps around 0 85.8%
mul-1-neg85.8%
Simplified85.8%
if 9.0000000000000001e-92 < x < 1950Initial program 78.9%
Simplified78.9%
Taylor expanded in x around 0 40.8%
Taylor expanded in x around 0 17.4%
mul-1-neg17.4%
associate-*r*17.4%
distribute-rgt-neg-in17.4%
distribute-lft-in17.4%
*-rgt-identity17.4%
associate-*r/17.4%
*-rgt-identity17.4%
sub-neg17.4%
distribute-neg-in17.4%
metadata-eval17.4%
remove-double-neg17.4%
+-commutative17.4%
Simplified17.4%
Taylor expanded in eps around 0 29.7%
if 1950 < x < 2.09999999999999986e92Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 74.1%
mul-1-neg74.1%
mul-1-neg74.1%
rec-exp74.1%
sub-neg74.1%
div-sub74.1%
mul-1-neg74.1%
rec-exp74.1%
+-inverses74.1%
Simplified74.1%
if 2.09999999999999986e92 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 79.5%
*-commutative79.5%
Simplified79.5%
Taylor expanded in eps around 0 3.1%
mul-1-neg3.1%
Simplified3.1%
*-un-lft-identity3.1%
add-sqr-sqrt0.0%
sqrt-unprod60.3%
sqr-neg60.3%
sqrt-unprod60.3%
add-sqr-sqrt60.3%
Applied egg-rr60.3%
*-lft-identity60.3%
Simplified60.3%
Final simplification74.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 1.3e-95)
(/ (+ 2.0 (* x (+ -1.0 (* x (+ 0.5 (* x -0.16666666666666666)))))) 2.0)
(if (<= x 1750.0)
(/ (/ (- (* eps_m (+ 2.0 (+ x (- (* eps_m x) x)))) x) eps_m) 2.0)
(if (<= x 1.92e+154) 0.0 (/ (+ 2.0 (* x (+ -1.0 (* x 0.5)))) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1.3e-95) {
tmp = (2.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) / 2.0;
} else if (x <= 1750.0) {
tmp = (((eps_m * (2.0 + (x + ((eps_m * x) - x)))) - x) / eps_m) / 2.0;
} else if (x <= 1.92e+154) {
tmp = 0.0;
} else {
tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 1.3d-95) then
tmp = (2.0d0 + (x * ((-1.0d0) + (x * (0.5d0 + (x * (-0.16666666666666666d0))))))) / 2.0d0
else if (x <= 1750.0d0) then
tmp = (((eps_m * (2.0d0 + (x + ((eps_m * x) - x)))) - x) / eps_m) / 2.0d0
else if (x <= 1.92d+154) then
tmp = 0.0d0
else
tmp = (2.0d0 + (x * ((-1.0d0) + (x * 0.5d0)))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 1.3e-95) {
tmp = (2.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) / 2.0;
} else if (x <= 1750.0) {
tmp = (((eps_m * (2.0 + (x + ((eps_m * x) - x)))) - x) / eps_m) / 2.0;
} else if (x <= 1.92e+154) {
tmp = 0.0;
} else {
tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1.3e-95: tmp = (2.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) / 2.0 elif x <= 1750.0: tmp = (((eps_m * (2.0 + (x + ((eps_m * x) - x)))) - x) / eps_m) / 2.0 elif x <= 1.92e+154: tmp = 0.0 else: tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1.3e-95) tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(x * Float64(0.5 + Float64(x * -0.16666666666666666)))))) / 2.0); elseif (x <= 1750.0) tmp = Float64(Float64(Float64(Float64(eps_m * Float64(2.0 + Float64(x + Float64(Float64(eps_m * x) - x)))) - x) / eps_m) / 2.0); elseif (x <= 1.92e+154) tmp = 0.0; else tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(x * 0.5)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 1.3e-95) tmp = (2.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) / 2.0; elseif (x <= 1750.0) tmp = (((eps_m * (2.0 + (x + ((eps_m * x) - x)))) - x) / eps_m) / 2.0; elseif (x <= 1.92e+154) tmp = 0.0; else tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 1.3e-95], N[(N[(2.0 + N[(x * N[(-1.0 + N[(x * N[(0.5 + N[(x * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1750.0], N[(N[(N[(N[(eps$95$m * N[(2.0 + N[(x + N[(N[(eps$95$m * x), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.92e+154], 0.0, N[(N[(2.0 + N[(x * N[(-1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.3 \cdot 10^{-95}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + x \cdot \left(0.5 + x \cdot -0.16666666666666666\right)\right)}{2}\\
\mathbf{elif}\;x \leq 1750:\\
\;\;\;\;\frac{\frac{eps\_m \cdot \left(2 + \left(x + \left(eps\_m \cdot x - x\right)\right)\right) - x}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq 1.92 \cdot 10^{+154}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + x \cdot 0.5\right)}{2}\\
\end{array}
\end{array}
if x < 1.3e-95Initial program 58.6%
Simplified40.2%
Taylor expanded in eps around inf 96.7%
Taylor expanded in eps around inf 96.7%
*-commutative96.7%
Simplified96.7%
Taylor expanded in eps around 0 85.8%
mul-1-neg85.8%
Simplified85.8%
Taylor expanded in x around 0 78.0%
if 1.3e-95 < x < 1750Initial program 78.9%
Simplified78.9%
Taylor expanded in x around 0 40.8%
Taylor expanded in x around 0 17.4%
mul-1-neg17.4%
associate-*r*17.4%
distribute-rgt-neg-in17.4%
distribute-lft-in17.4%
*-rgt-identity17.4%
associate-*r/17.4%
*-rgt-identity17.4%
sub-neg17.4%
distribute-neg-in17.4%
metadata-eval17.4%
remove-double-neg17.4%
+-commutative17.4%
Simplified17.4%
Taylor expanded in eps around 0 29.7%
if 1750 < x < 1.91999999999999994e154Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 62.8%
mul-1-neg62.8%
mul-1-neg62.8%
rec-exp62.8%
sub-neg62.8%
div-sub62.8%
mul-1-neg62.8%
rec-exp62.8%
+-inverses62.8%
Simplified62.8%
if 1.91999999999999994e154 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 87.4%
*-commutative87.4%
Simplified87.4%
Taylor expanded in eps around 0 3.1%
mul-1-neg3.1%
Simplified3.1%
Taylor expanded in x around 0 64.7%
Final simplification69.4%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (/ (+ 2.0 (* x (+ -1.0 (* x 0.5)))) 2.0)))
(if (<= x -1.9e+154)
t_0
(if (<= x 2.0)
(/ (+ 2.0 (* x (- -1.0 eps_m))) 2.0)
(if (<= x 1.9e+154) 0.0 t_0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0;
double tmp;
if (x <= -1.9e+154) {
tmp = t_0;
} else if (x <= 2.0) {
tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0;
} else if (x <= 1.9e+154) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: tmp
t_0 = (2.0d0 + (x * ((-1.0d0) + (x * 0.5d0)))) / 2.0d0
if (x <= (-1.9d+154)) then
tmp = t_0
else if (x <= 2.0d0) then
tmp = (2.0d0 + (x * ((-1.0d0) - eps_m))) / 2.0d0
else if (x <= 1.9d+154) then
tmp = 0.0d0
else
tmp = t_0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0;
double tmp;
if (x <= -1.9e+154) {
tmp = t_0;
} else if (x <= 2.0) {
tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0;
} else if (x <= 1.9e+154) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0 tmp = 0 if x <= -1.9e+154: tmp = t_0 elif x <= 2.0: tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0 elif x <= 1.9e+154: tmp = 0.0 else: tmp = t_0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(x * 0.5)))) / 2.0) tmp = 0.0 if (x <= -1.9e+154) tmp = t_0; elseif (x <= 2.0) tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 - eps_m))) / 2.0); elseif (x <= 1.9e+154) tmp = 0.0; else tmp = t_0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0; tmp = 0.0; if (x <= -1.9e+154) tmp = t_0; elseif (x <= 2.0) tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0; elseif (x <= 1.9e+154) tmp = 0.0; else tmp = t_0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(N[(2.0 + N[(x * N[(-1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, -1.9e+154], t$95$0, If[LessEqual[x, 2.0], N[(N[(2.0 + N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.9e+154], 0.0, t$95$0]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := \frac{2 + x \cdot \left(-1 + x \cdot 0.5\right)}{2}\\
\mathbf{if}\;x \leq -1.9 \cdot 10^{+154}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 - eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{+154}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.8999999999999999e154 or 1.8999999999999999e154 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 91.7%
*-commutative91.7%
Simplified91.7%
Taylor expanded in eps around 0 36.0%
mul-1-neg36.0%
Simplified36.0%
Taylor expanded in x around 0 76.6%
if -1.8999999999999999e154 < x < 2Initial program 56.1%
Simplified56.1%
Taylor expanded in x around 0 40.1%
metadata-eval40.1%
distribute-neg-frac40.1%
metadata-eval40.1%
associate-*l/40.1%
*-commutative40.1%
distribute-lft-neg-in40.1%
cancel-sign-sub-inv40.1%
*-commutative40.1%
associate-*l/40.1%
metadata-eval40.1%
Simplified40.1%
Taylor expanded in eps around inf 79.6%
associate-*r*79.6%
*-lft-identity79.6%
metadata-eval79.6%
cancel-sign-sub-inv79.6%
associate-*r*79.6%
mul-1-neg79.6%
associate-*r*79.6%
neg-mul-179.6%
cancel-sign-sub-inv79.6%
metadata-eval79.6%
*-lft-identity79.6%
+-commutative79.6%
Simplified79.6%
Taylor expanded in x around 0 65.9%
if 2 < x < 1.8999999999999999e154Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 61.1%
mul-1-neg61.1%
mul-1-neg61.1%
rec-exp61.1%
sub-neg61.1%
div-sub61.1%
mul-1-neg61.1%
rec-exp61.1%
+-inverses61.1%
Simplified61.1%
Final simplification67.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 2.55) (/ (+ 2.0 (* x (+ -1.0 (* x (+ 0.5 (* x -0.16666666666666666)))))) 2.0) (if (<= x 1.9e+154) 0.0 (/ (+ 2.0 (* x (+ -1.0 (* x 0.5)))) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 2.55) {
tmp = (2.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) / 2.0;
} else if (x <= 1.9e+154) {
tmp = 0.0;
} else {
tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 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 <= 2.55d0) then
tmp = (2.0d0 + (x * ((-1.0d0) + (x * (0.5d0 + (x * (-0.16666666666666666d0))))))) / 2.0d0
else if (x <= 1.9d+154) then
tmp = 0.0d0
else
tmp = (2.0d0 + (x * ((-1.0d0) + (x * 0.5d0)))) / 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 <= 2.55) {
tmp = (2.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) / 2.0;
} else if (x <= 1.9e+154) {
tmp = 0.0;
} else {
tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 2.55: tmp = (2.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) / 2.0 elif x <= 1.9e+154: tmp = 0.0 else: tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 2.55) tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(x * Float64(0.5 + Float64(x * -0.16666666666666666)))))) / 2.0); elseif (x <= 1.9e+154) tmp = 0.0; else tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(x * 0.5)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 2.55) tmp = (2.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) / 2.0; elseif (x <= 1.9e+154) tmp = 0.0; else tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 2.55], N[(N[(2.0 + N[(x * N[(-1.0 + N[(x * N[(0.5 + N[(x * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.9e+154], 0.0, N[(N[(2.0 + N[(x * N[(-1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.55:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + x \cdot \left(0.5 + x \cdot -0.16666666666666666\right)\right)}{2}\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{+154}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + x \cdot 0.5\right)}{2}\\
\end{array}
\end{array}
if x < 2.5499999999999998Initial program 61.0%
Simplified44.3%
Taylor expanded in eps around inf 96.5%
Taylor expanded in eps around inf 96.6%
*-commutative96.6%
Simplified96.6%
Taylor expanded in eps around 0 79.4%
mul-1-neg79.4%
Simplified79.4%
Taylor expanded in x around 0 72.6%
if 2.5499999999999998 < x < 1.8999999999999999e154Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 61.1%
mul-1-neg61.1%
mul-1-neg61.1%
rec-exp61.1%
sub-neg61.1%
div-sub61.1%
mul-1-neg61.1%
rec-exp61.1%
+-inverses61.1%
Simplified61.1%
if 1.8999999999999999e154 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 87.4%
*-commutative87.4%
Simplified87.4%
Taylor expanded in eps around 0 3.1%
mul-1-neg3.1%
Simplified3.1%
Taylor expanded in x around 0 64.7%
Final simplification69.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 1750.0) 1.0 (if (<= x 1.35e+233) 0.0 (* eps_m (* x 0.5)))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1750.0) {
tmp = 1.0;
} else if (x <= 1.35e+233) {
tmp = 0.0;
} else {
tmp = eps_m * (x * 0.5);
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 1750.0d0) then
tmp = 1.0d0
else if (x <= 1.35d+233) then
tmp = 0.0d0
else
tmp = eps_m * (x * 0.5d0)
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 1750.0) {
tmp = 1.0;
} else if (x <= 1.35e+233) {
tmp = 0.0;
} else {
tmp = eps_m * (x * 0.5);
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1750.0: tmp = 1.0 elif x <= 1.35e+233: tmp = 0.0 else: tmp = eps_m * (x * 0.5) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1750.0) tmp = 1.0; elseif (x <= 1.35e+233) tmp = 0.0; else tmp = Float64(eps_m * Float64(x * 0.5)); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 1750.0) tmp = 1.0; elseif (x <= 1.35e+233) tmp = 0.0; else tmp = eps_m * (x * 0.5); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 1750.0], 1.0, If[LessEqual[x, 1.35e+233], 0.0, N[(eps$95$m * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1750:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{+233}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;eps\_m \cdot \left(x \cdot 0.5\right)\\
\end{array}
\end{array}
if x < 1750Initial program 61.2%
Simplified61.2%
Taylor expanded in x around 0 41.7%
Taylor expanded in x around 0 43.7%
mul-1-neg43.7%
associate-*r*43.7%
distribute-rgt-neg-in43.7%
distribute-lft-in43.7%
*-rgt-identity43.7%
associate-*r/43.7%
*-rgt-identity43.7%
sub-neg43.7%
distribute-neg-in43.7%
metadata-eval43.7%
remove-double-neg43.7%
+-commutative43.7%
Simplified43.7%
Taylor expanded in x around 0 57.9%
if 1750 < x < 1.35000000000000004e233Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 57.3%
mul-1-neg57.3%
mul-1-neg57.3%
rec-exp57.3%
sub-neg57.3%
div-sub57.3%
mul-1-neg57.3%
rec-exp57.3%
+-inverses57.3%
Simplified57.3%
if 1.35000000000000004e233 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 40.9%
Taylor expanded in x around 0 31.9%
mul-1-neg31.9%
associate-*r*31.9%
distribute-rgt-neg-in31.9%
distribute-lft-in31.9%
*-rgt-identity31.9%
associate-*r/31.9%
*-rgt-identity31.9%
sub-neg31.9%
distribute-neg-in31.9%
metadata-eval31.9%
remove-double-neg31.9%
+-commutative31.9%
Simplified31.9%
Taylor expanded in eps around inf 32.1%
*-commutative32.1%
associate-*r*32.1%
Simplified32.1%
Final simplification55.4%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 2.0) (/ (- 2.0 x) 2.0) (if (<= x 1.15e+233) 0.0 (* eps_m (* x 0.5)))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 2.0) {
tmp = (2.0 - x) / 2.0;
} else if (x <= 1.15e+233) {
tmp = 0.0;
} else {
tmp = eps_m * (x * 0.5);
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 2.0d0) then
tmp = (2.0d0 - x) / 2.0d0
else if (x <= 1.15d+233) then
tmp = 0.0d0
else
tmp = eps_m * (x * 0.5d0)
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 2.0) {
tmp = (2.0 - x) / 2.0;
} else if (x <= 1.15e+233) {
tmp = 0.0;
} else {
tmp = eps_m * (x * 0.5);
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 2.0: tmp = (2.0 - x) / 2.0 elif x <= 1.15e+233: tmp = 0.0 else: tmp = eps_m * (x * 0.5) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 2.0) tmp = Float64(Float64(2.0 - x) / 2.0); elseif (x <= 1.15e+233) tmp = 0.0; else tmp = Float64(eps_m * Float64(x * 0.5)); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 2.0) tmp = (2.0 - x) / 2.0; elseif (x <= 1.15e+233) tmp = 0.0; else tmp = eps_m * (x * 0.5); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 2.0], N[(N[(2.0 - x), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.15e+233], 0.0, N[(eps$95$m * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2:\\
\;\;\;\;\frac{2 - x}{2}\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{+233}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;eps\_m \cdot \left(x \cdot 0.5\right)\\
\end{array}
\end{array}
if x < 2Initial program 61.0%
Simplified44.3%
Taylor expanded in eps around inf 96.5%
Taylor expanded in eps around inf 96.6%
*-commutative96.6%
Simplified96.6%
Taylor expanded in x around 0 58.3%
*-commutative58.3%
distribute-rgt1-in58.3%
metadata-eval58.3%
mul0-lft58.3%
metadata-eval58.3%
mul-1-neg58.3%
unsub-neg58.3%
Simplified58.3%
if 2 < x < 1.15e233Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 56.3%
mul-1-neg56.3%
mul-1-neg56.3%
rec-exp56.3%
sub-neg56.3%
div-sub56.3%
mul-1-neg56.3%
rec-exp56.3%
+-inverses56.3%
Simplified56.3%
if 1.15e233 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 40.9%
Taylor expanded in x around 0 31.9%
mul-1-neg31.9%
associate-*r*31.9%
distribute-rgt-neg-in31.9%
distribute-lft-in31.9%
*-rgt-identity31.9%
associate-*r/31.9%
*-rgt-identity31.9%
sub-neg31.9%
distribute-neg-in31.9%
metadata-eval31.9%
remove-double-neg31.9%
+-commutative31.9%
Simplified31.9%
Taylor expanded in eps around inf 32.1%
*-commutative32.1%
associate-*r*32.1%
Simplified32.1%
Final simplification55.5%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 2.0) (/ (+ 2.0 (* x (- -1.0 eps_m))) 2.0) (if (<= x 1.2e+233) 0.0 (* eps_m (* x 0.5)))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 2.0) {
tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0;
} else if (x <= 1.2e+233) {
tmp = 0.0;
} else {
tmp = eps_m * (x * 0.5);
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 2.0d0) then
tmp = (2.0d0 + (x * ((-1.0d0) - eps_m))) / 2.0d0
else if (x <= 1.2d+233) then
tmp = 0.0d0
else
tmp = eps_m * (x * 0.5d0)
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 2.0) {
tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0;
} else if (x <= 1.2e+233) {
tmp = 0.0;
} else {
tmp = eps_m * (x * 0.5);
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 2.0: tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0 elif x <= 1.2e+233: tmp = 0.0 else: tmp = eps_m * (x * 0.5) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 2.0) tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 - eps_m))) / 2.0); elseif (x <= 1.2e+233) tmp = 0.0; else tmp = Float64(eps_m * Float64(x * 0.5)); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 2.0) tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0; elseif (x <= 1.2e+233) tmp = 0.0; else tmp = eps_m * (x * 0.5); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 2.0], N[(N[(2.0 + N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.2e+233], 0.0, N[(eps$95$m * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 - eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{+233}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;eps\_m \cdot \left(x \cdot 0.5\right)\\
\end{array}
\end{array}
if x < 2Initial program 61.0%
Simplified61.0%
Taylor expanded in x around 0 41.9%
metadata-eval41.9%
distribute-neg-frac41.9%
metadata-eval41.9%
associate-*l/41.9%
*-commutative41.9%
distribute-lft-neg-in41.9%
cancel-sign-sub-inv41.9%
*-commutative41.9%
associate-*l/41.9%
metadata-eval41.9%
Simplified41.9%
Taylor expanded in eps around inf 77.0%
associate-*r*77.0%
*-lft-identity77.0%
metadata-eval77.0%
cancel-sign-sub-inv77.0%
associate-*r*77.0%
mul-1-neg77.0%
associate-*r*77.0%
neg-mul-177.0%
cancel-sign-sub-inv77.0%
metadata-eval77.0%
*-lft-identity77.0%
+-commutative77.0%
Simplified77.0%
Taylor expanded in x around 0 63.6%
if 2 < x < 1.20000000000000001e233Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 56.3%
mul-1-neg56.3%
mul-1-neg56.3%
rec-exp56.3%
sub-neg56.3%
div-sub56.3%
mul-1-neg56.3%
rec-exp56.3%
+-inverses56.3%
Simplified56.3%
if 1.20000000000000001e233 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 40.9%
Taylor expanded in x around 0 31.9%
mul-1-neg31.9%
associate-*r*31.9%
distribute-rgt-neg-in31.9%
distribute-lft-in31.9%
*-rgt-identity31.9%
associate-*r/31.9%
*-rgt-identity31.9%
sub-neg31.9%
distribute-neg-in31.9%
metadata-eval31.9%
remove-double-neg31.9%
+-commutative31.9%
Simplified31.9%
Taylor expanded in eps around inf 32.1%
*-commutative32.1%
associate-*r*32.1%
Simplified32.1%
Final simplification59.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 1750.0) 1.0 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1750.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 <= 1750.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 <= 1750.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1750.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1750.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 <= 1750.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, 1750.0], 1.0, 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1750:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1750Initial program 61.2%
Simplified61.2%
Taylor expanded in x around 0 41.7%
Taylor expanded in x around 0 43.7%
mul-1-neg43.7%
associate-*r*43.7%
distribute-rgt-neg-in43.7%
distribute-lft-in43.7%
*-rgt-identity43.7%
associate-*r/43.7%
*-rgt-identity43.7%
sub-neg43.7%
distribute-neg-in43.7%
metadata-eval43.7%
remove-double-neg43.7%
+-commutative43.7%
Simplified43.7%
Taylor expanded in x around 0 57.9%
if 1750 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 49.5%
mul-1-neg49.5%
mul-1-neg49.5%
rec-exp49.5%
sub-neg49.5%
div-sub49.5%
mul-1-neg49.5%
rec-exp49.5%
+-inverses49.5%
Simplified49.5%
Final simplification55.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 72.7%
Simplified72.7%
Taylor expanded in x around 0 37.7%
Taylor expanded in x around 0 34.9%
mul-1-neg34.9%
associate-*r*34.9%
distribute-rgt-neg-in34.9%
distribute-lft-in34.9%
*-rgt-identity34.9%
associate-*r/34.9%
*-rgt-identity34.9%
sub-neg34.9%
distribute-neg-in34.9%
metadata-eval34.9%
remove-double-neg34.9%
+-commutative34.9%
Simplified34.9%
Taylor expanded in x around 0 41.6%
Final simplification41.6%
herbie shell --seed 2024095
(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))