
(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 0.0068)
(/ (+ (* t_0 (+ 1.0 (+ x 1.0))) (* x t_0)) 2.0)
(/ (+ (exp (* x eps_m)) (exp (* x (- 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 <= 0.0068) {
tmp = ((t_0 * (1.0 + (x + 1.0))) + (x * t_0)) / 2.0;
} else {
tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: tmp
t_0 = exp(-x)
if (eps_m <= 0.0068d0) then
tmp = ((t_0 * (1.0d0 + (x + 1.0d0))) + (x * t_0)) / 2.0d0
else
tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = Math.exp(-x);
double tmp;
if (eps_m <= 0.0068) {
tmp = ((t_0 * (1.0 + (x + 1.0))) + (x * t_0)) / 2.0;
} else {
tmp = (Math.exp((x * eps_m)) + Math.exp((x * -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 <= 0.0068: tmp = ((t_0 * (1.0 + (x + 1.0))) + (x * t_0)) / 2.0 else: tmp = (math.exp((x * eps_m)) + math.exp((x * -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 <= 0.0068) tmp = Float64(Float64(Float64(t_0 * Float64(1.0 + Float64(x + 1.0))) + Float64(x * t_0)) / 2.0); else tmp = Float64(Float64(exp(Float64(x * eps_m)) + exp(Float64(x * Float64(-eps_m)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp(-x); tmp = 0.0; if (eps_m <= 0.0068) tmp = ((t_0 * (1.0 + (x + 1.0))) + (x * t_0)) / 2.0; else tmp = (exp((x * eps_m)) + exp((x * -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, 0.0068], N[(N[(N[(t$95$0 * N[(1.0 + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * t$95$0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{-x}\\
\mathbf{if}\;eps\_m \leq 0.0068:\\
\;\;\;\;\frac{t\_0 \cdot \left(1 + \left(x + 1\right)\right) + x \cdot t\_0}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot eps\_m} + e^{x \cdot \left(-eps\_m\right)}}{2}\\
\end{array}
\end{array}
if eps < 0.00679999999999999962Initial program 62.5%
Simplified62.5%
Taylor expanded in eps around 0 73.7%
associate--r+73.7%
associate-*r*73.7%
mul-1-neg73.7%
cancel-sign-sub73.7%
distribute-rgt1-in73.7%
distribute-rgt-out--74.2%
mul-1-neg74.2%
mul-1-neg74.2%
Simplified74.2%
if 0.00679999999999999962 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
associate-*r*100.0%
neg-mul-1100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
neg-mul-1100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Final simplification81.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 0.0068) (/ (+ x (+ 1.0 (- 1.0 x))) 2.0) (/ (+ (exp (* x eps_m)) (exp (* x (- eps_m)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 0.0068) {
tmp = (x + (1.0 + (1.0 - x))) / 2.0;
} else {
tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (eps_m <= 0.0068d0) then
tmp = (x + (1.0d0 + (1.0d0 - x))) / 2.0d0
else
tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (eps_m <= 0.0068) {
tmp = (x + (1.0 + (1.0 - x))) / 2.0;
} else {
tmp = (Math.exp((x * eps_m)) + Math.exp((x * -eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 0.0068: tmp = (x + (1.0 + (1.0 - x))) / 2.0 else: tmp = (math.exp((x * eps_m)) + math.exp((x * -eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 0.0068) tmp = Float64(Float64(x + Float64(1.0 + Float64(1.0 - x))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * eps_m)) + exp(Float64(x * Float64(-eps_m)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 0.0068) tmp = (x + (1.0 + (1.0 - x))) / 2.0; else tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 0.0068], N[(N[(x + N[(1.0 + N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 0.0068:\\
\;\;\;\;\frac{x + \left(1 + \left(1 - x\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot eps\_m} + e^{x \cdot \left(-eps\_m\right)}}{2}\\
\end{array}
\end{array}
if eps < 0.00679999999999999962Initial program 62.5%
Simplified62.5%
Taylor expanded in x around 0 27.1%
mul-1-neg27.1%
distribute-lft-neg-in27.1%
Simplified27.1%
Taylor expanded in x around 0 21.6%
Taylor expanded in eps around 0 73.4%
+-commutative73.4%
associate--l+73.4%
neg-mul-173.4%
distribute-lft-in73.4%
metadata-eval73.4%
neg-mul-173.4%
associate-*r*73.4%
metadata-eval73.4%
*-lft-identity73.4%
+-commutative73.4%
Simplified73.4%
if 0.00679999999999999962 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
associate-*r*100.0%
neg-mul-1100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
neg-mul-1100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Final simplification80.6%
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 72.7%
Simplified72.7%
Taylor expanded in eps around inf 99.6%
Final simplification99.6%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1e+26)
(/ (/ (+ x (expm1 (- x))) eps_m) 2.0)
(if (<= x -2.3e-251)
(/ (+ (+ 1.0 (* x eps_m)) (exp (* x (- eps_m)))) 2.0)
(if (<= x 1.9e+22)
(/ (+ (exp (* x eps_m)) (- 1.0 (* x eps_m))) 2.0)
0.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1e+26) {
tmp = ((x + expm1(-x)) / eps_m) / 2.0;
} else if (x <= -2.3e-251) {
tmp = ((1.0 + (x * eps_m)) + exp((x * -eps_m))) / 2.0;
} else if (x <= 1.9e+22) {
tmp = (exp((x * eps_m)) + (1.0 - (x * eps_m))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1e+26) {
tmp = ((x + Math.expm1(-x)) / eps_m) / 2.0;
} else if (x <= -2.3e-251) {
tmp = ((1.0 + (x * eps_m)) + Math.exp((x * -eps_m))) / 2.0;
} else if (x <= 1.9e+22) {
tmp = (Math.exp((x * eps_m)) + (1.0 - (x * eps_m))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1e+26: tmp = ((x + math.expm1(-x)) / eps_m) / 2.0 elif x <= -2.3e-251: tmp = ((1.0 + (x * eps_m)) + math.exp((x * -eps_m))) / 2.0 elif x <= 1.9e+22: tmp = (math.exp((x * eps_m)) + (1.0 - (x * eps_m))) / 2.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1e+26) tmp = Float64(Float64(Float64(x + expm1(Float64(-x))) / eps_m) / 2.0); elseif (x <= -2.3e-251) tmp = Float64(Float64(Float64(1.0 + Float64(x * eps_m)) + exp(Float64(x * Float64(-eps_m)))) / 2.0); elseif (x <= 1.9e+22) tmp = Float64(Float64(exp(Float64(x * eps_m)) + Float64(1.0 - Float64(x * eps_m))) / 2.0); else tmp = 0.0; end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1e+26], N[(N[(N[(x + N[(Exp[(-x)] - 1), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -2.3e-251], N[(N[(N[(1.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.9e+22], N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] + N[(1.0 - N[(x * eps$95$m), $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^{+26}:\\
\;\;\;\;\frac{\frac{x + \mathsf{expm1}\left(-x\right)}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq -2.3 \cdot 10^{-251}:\\
\;\;\;\;\frac{\left(1 + x \cdot eps\_m\right) + e^{x \cdot \left(-eps\_m\right)}}{2}\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{+22}:\\
\;\;\;\;\frac{e^{x \cdot eps\_m} + \left(1 - x \cdot eps\_m\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -1.00000000000000005e26Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 48.4%
Taylor expanded in eps around 0 44.7%
neg-mul-144.7%
associate--r+44.7%
neg-mul-144.7%
expm1-undefine44.7%
sub-neg44.7%
remove-double-neg44.7%
Simplified44.7%
if -1.00000000000000005e26 < x < -2.30000000000000017e-251Initial program 48.9%
Simplified48.9%
Taylor expanded in eps around inf 98.2%
Taylor expanded in eps around inf 98.2%
*-commutative98.2%
Simplified98.2%
Taylor expanded in eps around inf 98.2%
associate-*r*98.2%
neg-mul-198.2%
Simplified98.2%
Taylor expanded in x around 0 84.9%
if -2.30000000000000017e-251 < x < 1.9000000000000002e22Initial program 54.7%
Simplified54.7%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in eps around inf 98.9%
associate-*r*98.9%
neg-mul-198.9%
Simplified98.9%
Taylor expanded in eps around 0 89.9%
if 1.9000000000000002e22 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 14.7%
mul-1-neg14.7%
distribute-lft-neg-in14.7%
Simplified14.7%
Taylor expanded in x around 0 22.9%
Taylor expanded in eps around 0 18.6%
Simplified18.6%
Taylor expanded in eps around 0 62.6%
distribute-rgt1-in62.6%
metadata-eval62.6%
associate-*r/24.5%
mul0-lft62.6%
Simplified62.6%
Final simplification74.5%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= eps_m 0.115)
(/ (+ x (+ 1.0 (- 1.0 x))) 2.0)
(/
(* eps_m (- (/ (+ (exp (* x (+ -1.0 eps_m))) (+ x (- 1.0 x))) eps_m) x))
2.0)))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 0.115) {
tmp = (x + (1.0 + (1.0 - x))) / 2.0;
} else {
tmp = (eps_m * (((exp((x * (-1.0 + eps_m))) + (x + (1.0 - x))) / 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 <= 0.115d0) then
tmp = (x + (1.0d0 + (1.0d0 - x))) / 2.0d0
else
tmp = (eps_m * (((exp((x * ((-1.0d0) + eps_m))) + (x + (1.0d0 - x))) / 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 <= 0.115) {
tmp = (x + (1.0 + (1.0 - x))) / 2.0;
} else {
tmp = (eps_m * (((Math.exp((x * (-1.0 + eps_m))) + (x + (1.0 - x))) / eps_m) - x)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 0.115: tmp = (x + (1.0 + (1.0 - x))) / 2.0 else: tmp = (eps_m * (((math.exp((x * (-1.0 + eps_m))) + (x + (1.0 - x))) / eps_m) - x)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 0.115) tmp = Float64(Float64(x + Float64(1.0 + Float64(1.0 - x))) / 2.0); else tmp = Float64(Float64(eps_m * Float64(Float64(Float64(exp(Float64(x * Float64(-1.0 + eps_m))) + Float64(x + Float64(1.0 - x))) / eps_m) - x)) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 0.115) tmp = (x + (1.0 + (1.0 - x))) / 2.0; else tmp = (eps_m * (((exp((x * (-1.0 + eps_m))) + (x + (1.0 - x))) / 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, 0.115], N[(N[(x + N[(1.0 + N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(eps$95$m * N[(N[(N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(x + N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 0.115:\\
\;\;\;\;\frac{x + \left(1 + \left(1 - x\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{eps\_m \cdot \left(\frac{e^{x \cdot \left(-1 + eps\_m\right)} + \left(x + \left(1 - x\right)\right)}{eps\_m} - x\right)}{2}\\
\end{array}
\end{array}
if eps < 0.115000000000000005Initial program 62.5%
Simplified62.5%
Taylor expanded in x around 0 27.1%
mul-1-neg27.1%
distribute-lft-neg-in27.1%
Simplified27.1%
Taylor expanded in x around 0 21.6%
Taylor expanded in eps around 0 73.4%
+-commutative73.4%
associate--l+73.4%
neg-mul-173.4%
distribute-lft-in73.4%
metadata-eval73.4%
neg-mul-173.4%
associate-*r*73.4%
metadata-eval73.4%
*-lft-identity73.4%
+-commutative73.4%
Simplified73.4%
if 0.115000000000000005 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 72.8%
Taylor expanded in eps around -inf 79.9%
associate-*r*79.9%
neg-mul-179.9%
sub-neg79.9%
Simplified79.9%
Final simplification75.1%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -2.3e-251) (/ (* eps_m (+ x (/ (+ (exp (* x (- -1.0 eps_m))) (- 1.0 x)) eps_m))) 2.0) (if (<= x 1.42e+20) (/ (+ (exp (* x eps_m)) (- 1.0 (* x eps_m))) 2.0) 0.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -2.3e-251) {
tmp = (eps_m * (x + ((exp((x * (-1.0 - eps_m))) + (1.0 - x)) / eps_m))) / 2.0;
} else if (x <= 1.42e+20) {
tmp = (exp((x * eps_m)) + (1.0 - (x * eps_m))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-2.3d-251)) then
tmp = (eps_m * (x + ((exp((x * ((-1.0d0) - eps_m))) + (1.0d0 - x)) / eps_m))) / 2.0d0
else if (x <= 1.42d+20) then
tmp = (exp((x * eps_m)) + (1.0d0 - (x * eps_m))) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -2.3e-251) {
tmp = (eps_m * (x + ((Math.exp((x * (-1.0 - eps_m))) + (1.0 - x)) / eps_m))) / 2.0;
} else if (x <= 1.42e+20) {
tmp = (Math.exp((x * eps_m)) + (1.0 - (x * eps_m))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -2.3e-251: tmp = (eps_m * (x + ((math.exp((x * (-1.0 - eps_m))) + (1.0 - x)) / eps_m))) / 2.0 elif x <= 1.42e+20: tmp = (math.exp((x * eps_m)) + (1.0 - (x * eps_m))) / 2.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -2.3e-251) tmp = Float64(Float64(eps_m * Float64(x + Float64(Float64(exp(Float64(x * Float64(-1.0 - eps_m))) + Float64(1.0 - x)) / eps_m))) / 2.0); elseif (x <= 1.42e+20) tmp = Float64(Float64(exp(Float64(x * eps_m)) + Float64(1.0 - Float64(x * eps_m))) / 2.0); else tmp = 0.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -2.3e-251) tmp = (eps_m * (x + ((exp((x * (-1.0 - eps_m))) + (1.0 - x)) / eps_m))) / 2.0; elseif (x <= 1.42e+20) tmp = (exp((x * eps_m)) + (1.0 - (x * eps_m))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -2.3e-251], N[(N[(eps$95$m * N[(x + N[(N[(N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 - x), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.42e+20], N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] + N[(1.0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{-251}:\\
\;\;\;\;\frac{eps\_m \cdot \left(x + \frac{e^{x \cdot \left(-1 - eps\_m\right)} + \left(1 - x\right)}{eps\_m}\right)}{2}\\
\mathbf{elif}\;x \leq 1.42 \cdot 10^{+20}:\\
\;\;\;\;\frac{e^{x \cdot eps\_m} + \left(1 - x \cdot eps\_m\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -2.30000000000000017e-251Initial program 69.8%
Simplified69.8%
Taylor expanded in eps around inf 98.9%
Taylor expanded in x around 0 72.2%
neg-mul-172.2%
distribute-rgt-neg-in72.2%
sub-neg72.2%
neg-mul-172.2%
distribute-neg-in72.2%
metadata-eval72.2%
neg-mul-172.2%
remove-double-neg72.2%
Simplified72.2%
Taylor expanded in eps around -inf 84.0%
Simplified84.0%
if -2.30000000000000017e-251 < x < 1.42e20Initial program 54.7%
Simplified54.7%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in eps around inf 98.9%
associate-*r*98.9%
neg-mul-198.9%
Simplified98.9%
Taylor expanded in eps around 0 89.9%
if 1.42e20 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 14.7%
mul-1-neg14.7%
distribute-lft-neg-in14.7%
Simplified14.7%
Taylor expanded in x around 0 22.9%
Taylor expanded in eps around 0 18.6%
Simplified18.6%
Taylor expanded in eps around 0 62.6%
distribute-rgt1-in62.6%
metadata-eval62.6%
associate-*r/24.5%
mul0-lft62.6%
Simplified62.6%
Final simplification80.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -370.0) (/ (/ (+ x (expm1 (- x))) eps_m) 2.0) (if (<= x 3.45e+22) (/ (+ 1.0 (exp (* x (+ -1.0 eps_m)))) 2.0) 0.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -370.0) {
tmp = ((x + expm1(-x)) / eps_m) / 2.0;
} else if (x <= 3.45e+22) {
tmp = (1.0 + exp((x * (-1.0 + eps_m)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -370.0) {
tmp = ((x + Math.expm1(-x)) / eps_m) / 2.0;
} else if (x <= 3.45e+22) {
tmp = (1.0 + Math.exp((x * (-1.0 + eps_m)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -370.0: tmp = ((x + math.expm1(-x)) / eps_m) / 2.0 elif x <= 3.45e+22: tmp = (1.0 + math.exp((x * (-1.0 + eps_m)))) / 2.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -370.0) tmp = Float64(Float64(Float64(x + expm1(Float64(-x))) / eps_m) / 2.0); elseif (x <= 3.45e+22) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 + eps_m)))) / 2.0); else tmp = 0.0; end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -370.0], N[(N[(N[(x + N[(Exp[(-x)] - 1), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 3.45e+22], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -370:\\
\;\;\;\;\frac{\frac{x + \mathsf{expm1}\left(-x\right)}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq 3.45 \cdot 10^{+22}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 + eps\_m\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -370Initial program 97.6%
Simplified97.6%
Taylor expanded in x around 0 46.4%
Taylor expanded in eps around 0 45.2%
neg-mul-145.2%
associate--r+45.2%
neg-mul-145.2%
expm1-undefine45.2%
sub-neg45.2%
remove-double-neg45.2%
Simplified45.2%
if -370 < x < 3.4499999999999999e22Initial program 51.9%
Simplified51.9%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 88.1%
if 3.4499999999999999e22 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 14.7%
mul-1-neg14.7%
distribute-lft-neg-in14.7%
Simplified14.7%
Taylor expanded in x around 0 22.9%
Taylor expanded in eps around 0 18.6%
Simplified18.6%
Taylor expanded in eps around 0 62.6%
distribute-rgt1-in62.6%
metadata-eval62.6%
associate-*r/24.5%
mul0-lft62.6%
Simplified62.6%
Final simplification74.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 0.0068) (/ (+ x (+ 1.0 (- 1.0 x))) 2.0) (/ (- (exp (* x eps_m)) (+ -1.0 (* x (+ 1.0 eps_m)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 0.0068) {
tmp = (x + (1.0 + (1.0 - x))) / 2.0;
} else {
tmp = (exp((x * eps_m)) - (-1.0 + (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) :: tmp
if (eps_m <= 0.0068d0) then
tmp = (x + (1.0d0 + (1.0d0 - x))) / 2.0d0
else
tmp = (exp((x * eps_m)) - ((-1.0d0) + (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 tmp;
if (eps_m <= 0.0068) {
tmp = (x + (1.0 + (1.0 - x))) / 2.0;
} else {
tmp = (Math.exp((x * eps_m)) - (-1.0 + (x * (1.0 + eps_m)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 0.0068: tmp = (x + (1.0 + (1.0 - x))) / 2.0 else: tmp = (math.exp((x * eps_m)) - (-1.0 + (x * (1.0 + eps_m)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 0.0068) tmp = Float64(Float64(x + Float64(1.0 + Float64(1.0 - x))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * eps_m)) - Float64(-1.0 + Float64(x * 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 (eps_m <= 0.0068) tmp = (x + (1.0 + (1.0 - x))) / 2.0; else tmp = (exp((x * eps_m)) - (-1.0 + (x * (1.0 + 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, 0.0068], N[(N[(x + N[(1.0 + N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] - N[(-1.0 + 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}
\mathbf{if}\;eps\_m \leq 0.0068:\\
\;\;\;\;\frac{x + \left(1 + \left(1 - x\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot eps\_m} - \left(-1 + x \cdot \left(1 + eps\_m\right)\right)}{2}\\
\end{array}
\end{array}
if eps < 0.00679999999999999962Initial program 62.5%
Simplified62.5%
Taylor expanded in x around 0 27.1%
mul-1-neg27.1%
distribute-lft-neg-in27.1%
Simplified27.1%
Taylor expanded in x around 0 21.6%
Taylor expanded in eps around 0 73.4%
+-commutative73.4%
associate--l+73.4%
neg-mul-173.4%
distribute-lft-in73.4%
metadata-eval73.4%
neg-mul-173.4%
associate-*r*73.4%
metadata-eval73.4%
*-lft-identity73.4%
+-commutative73.4%
Simplified73.4%
if 0.00679999999999999962 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 72.8%
Final simplification73.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -460.0) (/ (/ (+ x (expm1 (- x))) eps_m) 2.0) (if (<= x 5e+22) (/ (+ 1.0 (exp (* x eps_m))) 2.0) 0.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -460.0) {
tmp = ((x + expm1(-x)) / eps_m) / 2.0;
} else if (x <= 5e+22) {
tmp = (1.0 + exp((x * eps_m))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -460.0) {
tmp = ((x + Math.expm1(-x)) / eps_m) / 2.0;
} else if (x <= 5e+22) {
tmp = (1.0 + Math.exp((x * eps_m))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -460.0: tmp = ((x + math.expm1(-x)) / eps_m) / 2.0 elif x <= 5e+22: tmp = (1.0 + math.exp((x * eps_m))) / 2.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -460.0) tmp = Float64(Float64(Float64(x + expm1(Float64(-x))) / eps_m) / 2.0); elseif (x <= 5e+22) tmp = Float64(Float64(1.0 + exp(Float64(x * eps_m))) / 2.0); else tmp = 0.0; end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -460.0], N[(N[(N[(x + N[(Exp[(-x)] - 1), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5e+22], N[(N[(1.0 + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -460:\\
\;\;\;\;\frac{\frac{x + \mathsf{expm1}\left(-x\right)}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+22}:\\
\;\;\;\;\frac{1 + e^{x \cdot eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -460Initial program 97.6%
Simplified97.6%
Taylor expanded in x around 0 46.4%
Taylor expanded in eps around 0 45.2%
neg-mul-145.2%
associate--r+45.2%
neg-mul-145.2%
expm1-undefine45.2%
sub-neg45.2%
remove-double-neg45.2%
Simplified45.2%
if -460 < x < 4.9999999999999996e22Initial program 51.9%
Simplified51.9%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 99.3%
*-commutative99.3%
Simplified99.3%
Taylor expanded in x around 0 88.1%
if 4.9999999999999996e22 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 14.7%
mul-1-neg14.7%
distribute-lft-neg-in14.7%
Simplified14.7%
Taylor expanded in x around 0 22.9%
Taylor expanded in eps around 0 18.6%
Simplified18.6%
Taylor expanded in eps around 0 62.6%
distribute-rgt1-in62.6%
metadata-eval62.6%
associate-*r/24.5%
mul0-lft62.6%
Simplified62.6%
Final simplification74.0%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1.3e-11)
(/
(-
(+ 1.0 (/ 1.0 eps_m))
(/ (+ (- 1.0 x) (* eps_m (+ -1.0 (* x eps_m)))) eps_m))
2.0)
(if (<= x 5e+22) (/ (+ 1.0 (exp (* x eps_m))) 2.0) 0.0)))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.3e-11) {
tmp = ((1.0 + (1.0 / eps_m)) - (((1.0 - x) + (eps_m * (-1.0 + (x * eps_m)))) / eps_m)) / 2.0;
} else if (x <= 5e+22) {
tmp = (1.0 + exp((x * eps_m))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-1.3d-11)) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) - (((1.0d0 - x) + (eps_m * ((-1.0d0) + (x * eps_m)))) / eps_m)) / 2.0d0
else if (x <= 5d+22) then
tmp = (1.0d0 + exp((x * eps_m))) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1.3e-11) {
tmp = ((1.0 + (1.0 / eps_m)) - (((1.0 - x) + (eps_m * (-1.0 + (x * eps_m)))) / eps_m)) / 2.0;
} else if (x <= 5e+22) {
tmp = (1.0 + Math.exp((x * eps_m))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.3e-11: tmp = ((1.0 + (1.0 / eps_m)) - (((1.0 - x) + (eps_m * (-1.0 + (x * eps_m)))) / eps_m)) / 2.0 elif x <= 5e+22: tmp = (1.0 + math.exp((x * eps_m))) / 2.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.3e-11) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) - Float64(Float64(Float64(1.0 - x) + Float64(eps_m * Float64(-1.0 + Float64(x * eps_m)))) / eps_m)) / 2.0); elseif (x <= 5e+22) tmp = Float64(Float64(1.0 + exp(Float64(x * eps_m))) / 2.0); else tmp = 0.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.3e-11) tmp = ((1.0 + (1.0 / eps_m)) - (((1.0 - x) + (eps_m * (-1.0 + (x * eps_m)))) / eps_m)) / 2.0; elseif (x <= 5e+22) tmp = (1.0 + exp((x * eps_m))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.3e-11], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 - x), $MachinePrecision] + N[(eps$95$m * N[(-1.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5e+22], N[(N[(1.0 + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{-11}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) - \frac{\left(1 - x\right) + eps\_m \cdot \left(-1 + x \cdot eps\_m\right)}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+22}:\\
\;\;\;\;\frac{1 + e^{x \cdot eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -1.3e-11Initial program 97.7%
Simplified97.7%
Taylor expanded in x around 0 56.0%
mul-1-neg56.0%
distribute-lft-neg-in56.0%
Simplified56.0%
Taylor expanded in x around 0 0.8%
Taylor expanded in eps around 0 7.3%
Simplified7.3%
Taylor expanded in x around 0 32.6%
if -1.3e-11 < x < 4.9999999999999996e22Initial program 51.2%
Simplified51.2%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 99.3%
*-commutative99.3%
Simplified99.3%
Taylor expanded in x around 0 88.6%
if 4.9999999999999996e22 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 14.7%
mul-1-neg14.7%
distribute-lft-neg-in14.7%
Simplified14.7%
Taylor expanded in x around 0 22.9%
Taylor expanded in eps around 0 18.6%
Simplified18.6%
Taylor expanded in eps around 0 62.6%
distribute-rgt1-in62.6%
metadata-eval62.6%
associate-*r/24.5%
mul0-lft62.6%
Simplified62.6%
Final simplification71.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 0.0068) (/ (+ x (- 1.0 (+ -1.0 x))) 2.0) (/ (+ (exp (* x eps_m)) (- 1.0 (* x eps_m))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 0.0068) {
tmp = (x + (1.0 - (-1.0 + x))) / 2.0;
} else {
tmp = (exp((x * eps_m)) + (1.0 - (x * eps_m))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (eps_m <= 0.0068d0) then
tmp = (x + (1.0d0 - ((-1.0d0) + x))) / 2.0d0
else
tmp = (exp((x * eps_m)) + (1.0d0 - (x * eps_m))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (eps_m <= 0.0068) {
tmp = (x + (1.0 - (-1.0 + x))) / 2.0;
} else {
tmp = (Math.exp((x * eps_m)) + (1.0 - (x * eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 0.0068: tmp = (x + (1.0 - (-1.0 + x))) / 2.0 else: tmp = (math.exp((x * eps_m)) + (1.0 - (x * eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 0.0068) tmp = Float64(Float64(x + Float64(1.0 - Float64(-1.0 + x))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * eps_m)) + Float64(1.0 - Float64(x * eps_m))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 0.0068) tmp = (x + (1.0 - (-1.0 + x))) / 2.0; else tmp = (exp((x * eps_m)) + (1.0 - (x * eps_m))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 0.0068], N[(N[(x + N[(1.0 - N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] + N[(1.0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 0.0068:\\
\;\;\;\;\frac{x + \left(1 - \left(-1 + x\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot eps\_m} + \left(1 - x \cdot eps\_m\right)}{2}\\
\end{array}
\end{array}
if eps < 0.00679999999999999962Initial program 62.5%
Simplified62.5%
Taylor expanded in x around 0 27.1%
mul-1-neg27.1%
distribute-lft-neg-in27.1%
Simplified27.1%
Taylor expanded in x around 0 21.6%
Taylor expanded in eps around 0 73.4%
+-commutative73.4%
associate--l+73.4%
neg-mul-173.4%
distribute-lft-in73.4%
metadata-eval73.4%
neg-mul-173.4%
associate-*r*73.4%
metadata-eval73.4%
*-lft-identity73.4%
+-commutative73.4%
Simplified73.4%
if 0.00679999999999999962 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
associate-*r*100.0%
neg-mul-1100.0%
Simplified100.0%
Taylor expanded in eps around 0 72.8%
Final simplification73.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= eps_m 1.2)
(/ (+ x (+ 1.0 (- 1.0 x))) 2.0)
(/
(-
(/ (+ 1.0 (- eps_m x)) eps_m)
(/ (+ (- 1.0 x) (* eps_m (+ -1.0 (* x eps_m)))) eps_m))
2.0)))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 1.2) {
tmp = (x + (1.0 + (1.0 - x))) / 2.0;
} else {
tmp = (((1.0 + (eps_m - x)) / eps_m) - (((1.0 - x) + (eps_m * (-1.0 + (x * eps_m)))) / 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.2d0) then
tmp = (x + (1.0d0 + (1.0d0 - x))) / 2.0d0
else
tmp = (((1.0d0 + (eps_m - x)) / eps_m) - (((1.0d0 - x) + (eps_m * ((-1.0d0) + (x * eps_m)))) / 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.2) {
tmp = (x + (1.0 + (1.0 - x))) / 2.0;
} else {
tmp = (((1.0 + (eps_m - x)) / eps_m) - (((1.0 - x) + (eps_m * (-1.0 + (x * eps_m)))) / eps_m)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 1.2: tmp = (x + (1.0 + (1.0 - x))) / 2.0 else: tmp = (((1.0 + (eps_m - x)) / eps_m) - (((1.0 - x) + (eps_m * (-1.0 + (x * eps_m)))) / eps_m)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 1.2) tmp = Float64(Float64(x + Float64(1.0 + Float64(1.0 - x))) / 2.0); else tmp = Float64(Float64(Float64(Float64(1.0 + Float64(eps_m - x)) / eps_m) - Float64(Float64(Float64(1.0 - x) + Float64(eps_m * Float64(-1.0 + Float64(x * eps_m)))) / 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.2) tmp = (x + (1.0 + (1.0 - x))) / 2.0; else tmp = (((1.0 + (eps_m - x)) / eps_m) - (((1.0 - x) + (eps_m * (-1.0 + (x * eps_m)))) / 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.2], N[(N[(x + N[(1.0 + N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(N[(1.0 + N[(eps$95$m - x), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] - N[(N[(N[(1.0 - x), $MachinePrecision] + N[(eps$95$m * N[(-1.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 1.2:\\
\;\;\;\;\frac{x + \left(1 + \left(1 - x\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 + \left(eps\_m - x\right)}{eps\_m} - \frac{\left(1 - x\right) + eps\_m \cdot \left(-1 + x \cdot eps\_m\right)}{eps\_m}}{2}\\
\end{array}
\end{array}
if eps < 1.19999999999999996Initial program 62.7%
Simplified62.7%
Taylor expanded in x around 0 27.5%
mul-1-neg27.5%
distribute-lft-neg-in27.5%
Simplified27.5%
Taylor expanded in x around 0 22.0%
Taylor expanded in eps around 0 73.5%
+-commutative73.5%
associate--l+73.5%
neg-mul-173.5%
distribute-lft-in73.5%
metadata-eval73.5%
neg-mul-173.5%
associate-*r*73.5%
metadata-eval73.5%
*-lft-identity73.5%
+-commutative73.5%
Simplified73.5%
if 1.19999999999999996 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 48.7%
mul-1-neg48.7%
distribute-lft-neg-in48.7%
Simplified48.7%
Taylor expanded in x around 0 20.0%
Taylor expanded in eps around 0 26.8%
Simplified26.8%
Taylor expanded in eps around 0 42.3%
neg-mul-142.3%
+-commutative42.3%
unsub-neg42.3%
distribute-lft-in42.3%
distribute-rgt1-in42.3%
metadata-eval42.3%
mul0-lft42.3%
distribute-lft-in42.3%
metadata-eval42.3%
*-rgt-identity42.3%
Simplified42.3%
Final simplification65.1%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= eps_m 1.0)
(/ (+ x (+ 1.0 (- 1.0 x))) 2.0)
(/
(-
(+ 1.0 (/ 1.0 eps_m))
(/ (+ (- 1.0 x) (* eps_m (+ -1.0 (* x eps_m)))) eps_m))
2.0)))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 1.0) {
tmp = (x + (1.0 + (1.0 - x))) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) - (((1.0 - x) + (eps_m * (-1.0 + (x * eps_m)))) / 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.0d0) then
tmp = (x + (1.0d0 + (1.0d0 - x))) / 2.0d0
else
tmp = ((1.0d0 + (1.0d0 / eps_m)) - (((1.0d0 - x) + (eps_m * ((-1.0d0) + (x * eps_m)))) / 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.0) {
tmp = (x + (1.0 + (1.0 - x))) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) - (((1.0 - x) + (eps_m * (-1.0 + (x * eps_m)))) / eps_m)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 1.0: tmp = (x + (1.0 + (1.0 - x))) / 2.0 else: tmp = ((1.0 + (1.0 / eps_m)) - (((1.0 - x) + (eps_m * (-1.0 + (x * eps_m)))) / eps_m)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 1.0) tmp = Float64(Float64(x + Float64(1.0 + Float64(1.0 - x))) / 2.0); else tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) - Float64(Float64(Float64(1.0 - x) + Float64(eps_m * Float64(-1.0 + Float64(x * eps_m)))) / 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.0) tmp = (x + (1.0 + (1.0 - x))) / 2.0; else tmp = ((1.0 + (1.0 / eps_m)) - (((1.0 - x) + (eps_m * (-1.0 + (x * eps_m)))) / 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.0], N[(N[(x + N[(1.0 + N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 - x), $MachinePrecision] + N[(eps$95$m * N[(-1.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 1:\\
\;\;\;\;\frac{x + \left(1 + \left(1 - x\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) - \frac{\left(1 - x\right) + eps\_m \cdot \left(-1 + x \cdot eps\_m\right)}{eps\_m}}{2}\\
\end{array}
\end{array}
if eps < 1Initial program 62.7%
Simplified62.7%
Taylor expanded in x around 0 27.5%
mul-1-neg27.5%
distribute-lft-neg-in27.5%
Simplified27.5%
Taylor expanded in x around 0 22.0%
Taylor expanded in eps around 0 73.5%
+-commutative73.5%
associate--l+73.5%
neg-mul-173.5%
distribute-lft-in73.5%
metadata-eval73.5%
neg-mul-173.5%
associate-*r*73.5%
metadata-eval73.5%
*-lft-identity73.5%
+-commutative73.5%
Simplified73.5%
if 1 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 48.7%
mul-1-neg48.7%
distribute-lft-neg-in48.7%
Simplified48.7%
Taylor expanded in x around 0 20.0%
Taylor expanded in eps around 0 26.8%
Simplified26.8%
Taylor expanded in x around 0 42.3%
Final simplification65.1%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.3e-11) (/ (* x (* (+ 1.0 eps_m) (+ -1.0 (/ 1.0 eps_m)))) 2.0) (/ (+ x (+ 1.0 (- 1.0 x))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.3e-11) {
tmp = (x * ((1.0 + eps_m) * (-1.0 + (1.0 / eps_m)))) / 2.0;
} else {
tmp = (x + (1.0 + (1.0 - 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.3d-11)) then
tmp = (x * ((1.0d0 + eps_m) * ((-1.0d0) + (1.0d0 / eps_m)))) / 2.0d0
else
tmp = (x + (1.0d0 + (1.0d0 - 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.3e-11) {
tmp = (x * ((1.0 + eps_m) * (-1.0 + (1.0 / eps_m)))) / 2.0;
} else {
tmp = (x + (1.0 + (1.0 - x))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.3e-11: tmp = (x * ((1.0 + eps_m) * (-1.0 + (1.0 / eps_m)))) / 2.0 else: tmp = (x + (1.0 + (1.0 - x))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.3e-11) tmp = Float64(Float64(x * Float64(Float64(1.0 + eps_m) * Float64(-1.0 + Float64(1.0 / eps_m)))) / 2.0); else tmp = Float64(Float64(x + Float64(1.0 + Float64(1.0 - x))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.3e-11) tmp = (x * ((1.0 + eps_m) * (-1.0 + (1.0 / eps_m)))) / 2.0; else tmp = (x + (1.0 + (1.0 - x))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.3e-11], N[(N[(x * N[(N[(1.0 + eps$95$m), $MachinePrecision] * N[(-1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x + N[(1.0 + N[(1.0 - x), $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^{-11}:\\
\;\;\;\;\frac{x \cdot \left(\left(1 + eps\_m\right) \cdot \left(-1 + \frac{1}{eps\_m}\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \left(1 + \left(1 - x\right)\right)}{2}\\
\end{array}
\end{array}
if x < -1.3e-11Initial program 97.7%
Simplified97.7%
Taylor expanded in x around 0 46.7%
Taylor expanded in x around inf 26.3%
+-commutative26.3%
sub-neg26.3%
metadata-eval26.3%
+-commutative26.3%
Simplified26.3%
if -1.3e-11 < x Initial program 67.6%
Simplified67.6%
Taylor expanded in x around 0 28.4%
mul-1-neg28.4%
distribute-lft-neg-in28.4%
Simplified28.4%
Taylor expanded in x around 0 25.8%
Taylor expanded in eps around 0 71.2%
+-commutative71.2%
associate--l+71.2%
neg-mul-171.2%
distribute-lft-in71.2%
metadata-eval71.2%
neg-mul-171.2%
associate-*r*71.2%
metadata-eval71.2%
*-lft-identity71.2%
+-commutative71.2%
Simplified71.2%
Final simplification63.5%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.3e-11) (* eps_m (* x -0.5)) (/ (+ x (+ 1.0 (- 1.0 x))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.3e-11) {
tmp = eps_m * (x * -0.5);
} else {
tmp = (x + (1.0 + (1.0 - 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.3d-11)) then
tmp = eps_m * (x * (-0.5d0))
else
tmp = (x + (1.0d0 + (1.0d0 - 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.3e-11) {
tmp = eps_m * (x * -0.5);
} else {
tmp = (x + (1.0 + (1.0 - x))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.3e-11: tmp = eps_m * (x * -0.5) else: tmp = (x + (1.0 + (1.0 - x))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.3e-11) tmp = Float64(eps_m * Float64(x * -0.5)); else tmp = Float64(Float64(x + Float64(1.0 + Float64(1.0 - x))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.3e-11) tmp = eps_m * (x * -0.5); else tmp = (x + (1.0 + (1.0 - x))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.3e-11], N[(eps$95$m * N[(x * -0.5), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(1.0 + N[(1.0 - x), $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^{-11}:\\
\;\;\;\;eps\_m \cdot \left(x \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \left(1 + \left(1 - x\right)\right)}{2}\\
\end{array}
\end{array}
if x < -1.3e-11Initial program 97.7%
Simplified97.7%
Taylor expanded in x around 0 46.7%
Taylor expanded in x around inf 26.3%
+-commutative26.3%
sub-neg26.3%
metadata-eval26.3%
+-commutative26.3%
Simplified26.3%
Taylor expanded in eps around inf 26.3%
*-commutative26.3%
*-commutative26.3%
*-commutative26.3%
associate-*r*26.3%
Simplified26.3%
if -1.3e-11 < x Initial program 67.6%
Simplified67.6%
Taylor expanded in x around 0 28.4%
mul-1-neg28.4%
distribute-lft-neg-in28.4%
Simplified28.4%
Taylor expanded in x around 0 25.8%
Taylor expanded in eps around 0 71.2%
+-commutative71.2%
associate--l+71.2%
neg-mul-171.2%
distribute-lft-in71.2%
metadata-eval71.2%
neg-mul-171.2%
associate-*r*71.2%
metadata-eval71.2%
*-lft-identity71.2%
+-commutative71.2%
Simplified71.2%
Final simplification63.5%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.3e-11) (* eps_m (* x -0.5)) (if (<= x 480.0) 1.0 0.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.3e-11) {
tmp = eps_m * (x * -0.5);
} else if (x <= 480.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 <= (-1.3d-11)) then
tmp = eps_m * (x * (-0.5d0))
else if (x <= 480.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 <= -1.3e-11) {
tmp = eps_m * (x * -0.5);
} else if (x <= 480.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.3e-11: tmp = eps_m * (x * -0.5) elif x <= 480.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.3e-11) tmp = Float64(eps_m * Float64(x * -0.5)); elseif (x <= 480.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 <= -1.3e-11) tmp = eps_m * (x * -0.5); elseif (x <= 480.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, -1.3e-11], N[(eps$95$m * N[(x * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 480.0], 1.0, 0.0]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{-11}:\\
\;\;\;\;eps\_m \cdot \left(x \cdot -0.5\right)\\
\mathbf{elif}\;x \leq 480:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -1.3e-11Initial program 97.7%
Simplified97.7%
Taylor expanded in x around 0 46.7%
Taylor expanded in x around inf 26.3%
+-commutative26.3%
sub-neg26.3%
metadata-eval26.3%
+-commutative26.3%
Simplified26.3%
Taylor expanded in eps around inf 26.3%
*-commutative26.3%
*-commutative26.3%
*-commutative26.3%
associate-*r*26.3%
Simplified26.3%
if -1.3e-11 < x < 480Initial program 49.8%
Simplified49.8%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 85.7%
neg-mul-185.7%
distribute-rgt-neg-in85.7%
sub-neg85.7%
neg-mul-185.7%
distribute-neg-in85.7%
metadata-eval85.7%
neg-mul-185.7%
remove-double-neg85.7%
Simplified85.7%
Taylor expanded in x around 0 76.9%
Taylor expanded in x around 0 77.7%
if 480 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 15.5%
mul-1-neg15.5%
distribute-lft-neg-in15.5%
Simplified15.5%
Taylor expanded in x around 0 23.1%
Taylor expanded in eps around 0 19.0%
Simplified19.0%
Taylor expanded in eps around 0 60.6%
distribute-rgt1-in60.6%
metadata-eval60.6%
associate-*r/24.6%
mul0-lft60.6%
Simplified60.6%
Final simplification63.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 620.0) 1.0 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 620.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 620.0d0) then
tmp = 1.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 620.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 620.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 620.0) tmp = 1.0; else tmp = 0.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 620.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 620.0], 1.0, 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 620:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 620Initial program 61.4%
Simplified61.4%
Taylor expanded in eps around inf 99.4%
Taylor expanded in x around 0 78.0%
neg-mul-178.0%
distribute-rgt-neg-in78.0%
sub-neg78.0%
neg-mul-178.0%
distribute-neg-in78.0%
metadata-eval78.0%
neg-mul-178.0%
remove-double-neg78.0%
Simplified78.0%
Taylor expanded in x around 0 66.3%
Taylor expanded in x around 0 59.6%
if 620 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 15.5%
mul-1-neg15.5%
distribute-lft-neg-in15.5%
Simplified15.5%
Taylor expanded in x around 0 23.1%
Taylor expanded in eps around 0 19.0%
Simplified19.0%
Taylor expanded in eps around 0 60.6%
distribute-rgt1-in60.6%
metadata-eval60.6%
associate-*r/24.6%
mul0-lft60.6%
Simplified60.6%
Final simplification59.9%
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 eps around inf 99.6%
Taylor expanded in x around 0 59.8%
neg-mul-159.8%
distribute-rgt-neg-in59.8%
sub-neg59.8%
neg-mul-159.8%
distribute-neg-in59.8%
metadata-eval59.8%
neg-mul-159.8%
remove-double-neg59.8%
Simplified59.8%
Taylor expanded in x around 0 49.6%
Taylor expanded in x around 0 43.0%
herbie shell --seed 2024130
(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))