
(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 17 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 (+ eps_m -1.0))))) (if (<= x 2.6e-6) (/ (+ t_0 (exp (- x (* x eps_m)))) 2.0) (* t_0 0.5))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * (eps_m + -1.0)));
double tmp;
if (x <= 2.6e-6) {
tmp = (t_0 + exp((x - (x * eps_m)))) / 2.0;
} else {
tmp = t_0 * 0.5;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: tmp
t_0 = exp((x * (eps_m + (-1.0d0))))
if (x <= 2.6d-6) then
tmp = (t_0 + exp((x - (x * eps_m)))) / 2.0d0
else
tmp = t_0 * 0.5d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = Math.exp((x * (eps_m + -1.0)));
double tmp;
if (x <= 2.6e-6) {
tmp = (t_0 + Math.exp((x - (x * eps_m)))) / 2.0;
} else {
tmp = t_0 * 0.5;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * (eps_m + -1.0))) tmp = 0 if x <= 2.6e-6: tmp = (t_0 + math.exp((x - (x * eps_m)))) / 2.0 else: tmp = t_0 * 0.5 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * Float64(eps_m + -1.0))) tmp = 0.0 if (x <= 2.6e-6) tmp = Float64(Float64(t_0 + exp(Float64(x - Float64(x * eps_m)))) / 2.0); else tmp = Float64(t_0 * 0.5); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp((x * (eps_m + -1.0))); tmp = 0.0; if (x <= 2.6e-6) tmp = (t_0 + exp((x - (x * eps_m)))) / 2.0; else tmp = t_0 * 0.5; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 2.6e-6], N[(N[(t$95$0 + N[Exp[N[(x - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(t$95$0 * 0.5), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(eps_m + -1\right)}\\
\mathbf{if}\;x \leq 2.6 \cdot 10^{-6}:\\
\;\;\;\;\frac{t_0 + e^{x - x \cdot eps_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot 0.5\\
\end{array}
\end{array}
if x < 2.60000000000000009e-6Initial program 57.9%
Simplified57.9%
Taylor expanded in eps around inf 99.2%
Simplified99.2%
neg-mul-199.2%
+-commutative99.2%
associate-*r*99.2%
distribute-rgt-in99.2%
*-un-lft-identity99.2%
distribute-lft-in99.2%
neg-mul-199.2%
add-sqr-sqrt57.2%
sqrt-unprod93.6%
sqr-neg93.6%
sqrt-unprod42.2%
add-sqr-sqrt99.7%
Applied egg-rr99.7%
mul-1-neg99.7%
*-commutative99.7%
sub-neg99.7%
Simplified99.7%
if 2.60000000000000009e-6 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 35.6%
Taylor expanded in x around inf 79.4%
Final simplification94.4%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (/ 1.0 (exp (fma eps_m x x))) (exp (* x (+ eps_m -1.0)))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return ((1.0 / exp(fma(eps_m, x, x))) + exp((x * (eps_m + -1.0)))) / 2.0;
}
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(Float64(1.0 / exp(fma(eps_m, x, x))) + exp(Float64(x * Float64(eps_m + -1.0)))) / 2.0) end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(N[(1.0 / N[Exp[N[(eps$95$m * x + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + 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|
\\
\frac{\frac{1}{e^{\mathsf{fma}\left(eps_m, x, x\right)}} + e^{x \cdot \left(eps_m + -1\right)}}{2}
\end{array}
Initial program 68.9%
Simplified63.6%
Taylor expanded in eps around inf 99.4%
Final simplification99.4%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (let* ((t_0 (exp (* x (+ eps_m -1.0))))) (if (<= x 2.6e-6) (/ (+ t_0 (exp (* eps_m (- x)))) 2.0) (* t_0 0.5))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * (eps_m + -1.0)));
double tmp;
if (x <= 2.6e-6) {
tmp = (t_0 + exp((eps_m * -x))) / 2.0;
} else {
tmp = t_0 * 0.5;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: tmp
t_0 = exp((x * (eps_m + (-1.0d0))))
if (x <= 2.6d-6) then
tmp = (t_0 + exp((eps_m * -x))) / 2.0d0
else
tmp = t_0 * 0.5d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = Math.exp((x * (eps_m + -1.0)));
double tmp;
if (x <= 2.6e-6) {
tmp = (t_0 + Math.exp((eps_m * -x))) / 2.0;
} else {
tmp = t_0 * 0.5;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * (eps_m + -1.0))) tmp = 0 if x <= 2.6e-6: tmp = (t_0 + math.exp((eps_m * -x))) / 2.0 else: tmp = t_0 * 0.5 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * Float64(eps_m + -1.0))) tmp = 0.0 if (x <= 2.6e-6) tmp = Float64(Float64(t_0 + exp(Float64(eps_m * Float64(-x)))) / 2.0); else tmp = Float64(t_0 * 0.5); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp((x * (eps_m + -1.0))); tmp = 0.0; if (x <= 2.6e-6) tmp = (t_0 + exp((eps_m * -x))) / 2.0; else tmp = t_0 * 0.5; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 2.6e-6], N[(N[(t$95$0 + N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(t$95$0 * 0.5), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(eps_m + -1\right)}\\
\mathbf{if}\;x \leq 2.6 \cdot 10^{-6}:\\
\;\;\;\;\frac{t_0 + e^{eps_m \cdot \left(-x\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot 0.5\\
\end{array}
\end{array}
if x < 2.60000000000000009e-6Initial program 57.9%
Simplified57.9%
Taylor expanded in eps around inf 99.2%
Simplified99.2%
neg-mul-199.2%
+-commutative99.2%
associate-*r*99.2%
distribute-rgt-in99.2%
*-un-lft-identity99.2%
distribute-lft-in99.2%
neg-mul-199.2%
add-sqr-sqrt57.2%
sqrt-unprod93.6%
sqr-neg93.6%
sqrt-unprod42.2%
add-sqr-sqrt99.7%
Applied egg-rr99.7%
mul-1-neg99.7%
*-commutative99.7%
sub-neg99.7%
Simplified99.7%
Taylor expanded in eps around inf 99.2%
associate-*r*99.2%
neg-mul-199.2%
*-commutative99.2%
Simplified99.2%
Taylor expanded in x around inf 99.2%
associate-*r*99.2%
mul-1-neg99.2%
associate-*r*99.2%
neg-mul-199.2%
Simplified99.2%
if 2.60000000000000009e-6 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 35.6%
Taylor expanded in x around inf 79.4%
Final simplification94.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (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) {
return (exp((x * (eps_m + -1.0))) + 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 * (eps_m + (-1.0d0)))) + 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 * (eps_m + -1.0))) + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.exp((x * (eps_m + -1.0))) + 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(eps_m + -1.0))) + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((x * (eps_m + -1.0))) + 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[(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|
\\
\frac{e^{x \cdot \left(eps_m + -1\right)} + e^{x \cdot \left(-1 - eps_m\right)}}{2}
\end{array}
Initial program 68.9%
Simplified68.9%
Taylor expanded in eps around inf 99.4%
Simplified99.4%
Final simplification99.4%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (* x (+ eps_m -1.0)))))
(if (<= x -5e-273)
(/ (+ 1.0 (/ 1.0 (exp (fma eps_m x x)))) 2.0)
(if (<= x 2.6e-6)
(/ (+ t_0 (/ 1.0 (+ 1.0 (* x (+ eps_m 1.0))))) 2.0)
(* t_0 0.5)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * (eps_m + -1.0)));
double tmp;
if (x <= -5e-273) {
tmp = (1.0 + (1.0 / exp(fma(eps_m, x, x)))) / 2.0;
} else if (x <= 2.6e-6) {
tmp = (t_0 + (1.0 / (1.0 + (x * (eps_m + 1.0))))) / 2.0;
} else {
tmp = t_0 * 0.5;
}
return tmp;
}
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * Float64(eps_m + -1.0))) tmp = 0.0 if (x <= -5e-273) tmp = Float64(Float64(1.0 + Float64(1.0 / exp(fma(eps_m, x, x)))) / 2.0); elseif (x <= 2.6e-6) tmp = Float64(Float64(t_0 + Float64(1.0 / Float64(1.0 + Float64(x * Float64(eps_m + 1.0))))) / 2.0); else tmp = Float64(t_0 * 0.5); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -5e-273], N[(N[(1.0 + N[(1.0 / N[Exp[N[(eps$95$m * x + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.6e-6], N[(N[(t$95$0 + N[(1.0 / N[(1.0 + N[(x * N[(eps$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(t$95$0 * 0.5), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(eps_m + -1\right)}\\
\mathbf{if}\;x \leq -5 \cdot 10^{-273}:\\
\;\;\;\;\frac{1 + \frac{1}{e^{\mathsf{fma}\left(eps_m, x, x\right)}}}{2}\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-6}:\\
\;\;\;\;\frac{t_0 + \frac{1}{1 + x \cdot \left(eps_m + 1\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot 0.5\\
\end{array}
\end{array}
if x < -4.99999999999999965e-273Initial program 69.5%
Simplified64.2%
Taylor expanded in eps around inf 99.0%
Taylor expanded in x around 0 69.1%
if -4.99999999999999965e-273 < x < 2.60000000000000009e-6Initial program 44.3%
Simplified34.9%
Taylor expanded in eps around inf 99.3%
Taylor expanded in x around 0 87.8%
if 2.60000000000000009e-6 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 35.6%
Taylor expanded in x around inf 79.4%
Final simplification78.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (* x (+ eps_m -1.0)))))
(if (<= x -55000000.0)
(/ (/ (expm1 (- x)) eps_m) 2.0)
(if (<= x -2e-267)
(/ (+ (- 1.0 (* x (- 1.0 eps_m))) (exp (* eps_m (- x)))) 2.0)
(if (<= x 2.6e-6)
(/ (+ t_0 (/ 1.0 (+ 1.0 (* x (+ eps_m 1.0))))) 2.0)
(* t_0 0.5))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * (eps_m + -1.0)));
double tmp;
if (x <= -55000000.0) {
tmp = (expm1(-x) / eps_m) / 2.0;
} else if (x <= -2e-267) {
tmp = ((1.0 - (x * (1.0 - eps_m))) + exp((eps_m * -x))) / 2.0;
} else if (x <= 2.6e-6) {
tmp = (t_0 + (1.0 / (1.0 + (x * (eps_m + 1.0))))) / 2.0;
} else {
tmp = t_0 * 0.5;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = Math.exp((x * (eps_m + -1.0)));
double tmp;
if (x <= -55000000.0) {
tmp = (Math.expm1(-x) / eps_m) / 2.0;
} else if (x <= -2e-267) {
tmp = ((1.0 - (x * (1.0 - eps_m))) + Math.exp((eps_m * -x))) / 2.0;
} else if (x <= 2.6e-6) {
tmp = (t_0 + (1.0 / (1.0 + (x * (eps_m + 1.0))))) / 2.0;
} else {
tmp = t_0 * 0.5;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * (eps_m + -1.0))) tmp = 0 if x <= -55000000.0: tmp = (math.expm1(-x) / eps_m) / 2.0 elif x <= -2e-267: tmp = ((1.0 - (x * (1.0 - eps_m))) + math.exp((eps_m * -x))) / 2.0 elif x <= 2.6e-6: tmp = (t_0 + (1.0 / (1.0 + (x * (eps_m + 1.0))))) / 2.0 else: tmp = t_0 * 0.5 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * Float64(eps_m + -1.0))) tmp = 0.0 if (x <= -55000000.0) tmp = Float64(Float64(expm1(Float64(-x)) / eps_m) / 2.0); elseif (x <= -2e-267) tmp = Float64(Float64(Float64(1.0 - Float64(x * Float64(1.0 - eps_m))) + exp(Float64(eps_m * Float64(-x)))) / 2.0); elseif (x <= 2.6e-6) tmp = Float64(Float64(t_0 + Float64(1.0 / Float64(1.0 + Float64(x * Float64(eps_m + 1.0))))) / 2.0); else tmp = Float64(t_0 * 0.5); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -55000000.0], N[(N[(N[(Exp[(-x)] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -2e-267], N[(N[(N[(1.0 - N[(x * N[(1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.6e-6], N[(N[(t$95$0 + N[(1.0 / N[(1.0 + N[(x * N[(eps$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(t$95$0 * 0.5), $MachinePrecision]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(eps_m + -1\right)}\\
\mathbf{if}\;x \leq -55000000:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(-x\right)}{eps_m}}{2}\\
\mathbf{elif}\;x \leq -2 \cdot 10^{-267}:\\
\;\;\;\;\frac{\left(1 - x \cdot \left(1 - eps_m\right)\right) + e^{eps_m \cdot \left(-x\right)}}{2}\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-6}:\\
\;\;\;\;\frac{t_0 + \frac{1}{1 + x \cdot \left(eps_m + 1\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot 0.5\\
\end{array}
\end{array}
if x < -5.5e7Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 59.8%
Taylor expanded in eps around 0 41.5%
expm1-def41.5%
mul-1-neg41.5%
Simplified41.5%
if -5.5e7 < x < -2e-267Initial program 49.0%
Simplified49.0%
Taylor expanded in eps around inf 98.4%
Simplified98.4%
neg-mul-198.4%
+-commutative98.4%
associate-*r*98.4%
distribute-rgt-in98.4%
*-un-lft-identity98.4%
distribute-lft-in98.4%
neg-mul-198.4%
add-sqr-sqrt98.4%
sqrt-unprod98.4%
sqr-neg98.4%
sqrt-unprod0.0%
add-sqr-sqrt99.4%
Applied egg-rr99.4%
mul-1-neg99.4%
*-commutative99.4%
sub-neg99.4%
Simplified99.4%
Taylor expanded in eps around inf 98.5%
associate-*r*98.5%
neg-mul-198.5%
*-commutative98.5%
Simplified98.5%
Taylor expanded in x around 0 86.7%
mul-1-neg86.7%
distribute-lft-neg-out86.7%
*-commutative86.7%
Simplified86.7%
if -2e-267 < x < 2.60000000000000009e-6Initial program 44.3%
Simplified34.9%
Taylor expanded in eps around inf 99.3%
Taylor expanded in x around 0 87.8%
if 2.60000000000000009e-6 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 35.6%
Taylor expanded in x around inf 79.4%
Final simplification77.9%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (* x (+ eps_m -1.0)))))
(if (<= x -4e+16)
(/ (/ (expm1 (- x)) eps_m) 2.0)
(if (<= x -5e-271)
(/ (+ (exp (- x (* x eps_m))) (- 1.0 (* x (- 1.0 eps_m)))) 2.0)
(if (<= x 2.6e-6)
(/ (+ t_0 (/ 1.0 (+ 1.0 (* x (+ eps_m 1.0))))) 2.0)
(* t_0 0.5))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * (eps_m + -1.0)));
double tmp;
if (x <= -4e+16) {
tmp = (expm1(-x) / eps_m) / 2.0;
} else if (x <= -5e-271) {
tmp = (exp((x - (x * eps_m))) + (1.0 - (x * (1.0 - eps_m)))) / 2.0;
} else if (x <= 2.6e-6) {
tmp = (t_0 + (1.0 / (1.0 + (x * (eps_m + 1.0))))) / 2.0;
} else {
tmp = t_0 * 0.5;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = Math.exp((x * (eps_m + -1.0)));
double tmp;
if (x <= -4e+16) {
tmp = (Math.expm1(-x) / eps_m) / 2.0;
} else if (x <= -5e-271) {
tmp = (Math.exp((x - (x * eps_m))) + (1.0 - (x * (1.0 - eps_m)))) / 2.0;
} else if (x <= 2.6e-6) {
tmp = (t_0 + (1.0 / (1.0 + (x * (eps_m + 1.0))))) / 2.0;
} else {
tmp = t_0 * 0.5;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * (eps_m + -1.0))) tmp = 0 if x <= -4e+16: tmp = (math.expm1(-x) / eps_m) / 2.0 elif x <= -5e-271: tmp = (math.exp((x - (x * eps_m))) + (1.0 - (x * (1.0 - eps_m)))) / 2.0 elif x <= 2.6e-6: tmp = (t_0 + (1.0 / (1.0 + (x * (eps_m + 1.0))))) / 2.0 else: tmp = t_0 * 0.5 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * Float64(eps_m + -1.0))) tmp = 0.0 if (x <= -4e+16) tmp = Float64(Float64(expm1(Float64(-x)) / eps_m) / 2.0); elseif (x <= -5e-271) tmp = Float64(Float64(exp(Float64(x - Float64(x * eps_m))) + Float64(1.0 - Float64(x * Float64(1.0 - eps_m)))) / 2.0); elseif (x <= 2.6e-6) tmp = Float64(Float64(t_0 + Float64(1.0 / Float64(1.0 + Float64(x * Float64(eps_m + 1.0))))) / 2.0); else tmp = Float64(t_0 * 0.5); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -4e+16], N[(N[(N[(Exp[(-x)] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -5e-271], N[(N[(N[Exp[N[(x - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 - N[(x * N[(1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.6e-6], N[(N[(t$95$0 + N[(1.0 / N[(1.0 + N[(x * N[(eps$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(t$95$0 * 0.5), $MachinePrecision]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(eps_m + -1\right)}\\
\mathbf{if}\;x \leq -4 \cdot 10^{+16}:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(-x\right)}{eps_m}}{2}\\
\mathbf{elif}\;x \leq -5 \cdot 10^{-271}:\\
\;\;\;\;\frac{e^{x - x \cdot eps_m} + \left(1 - x \cdot \left(1 - eps_m\right)\right)}{2}\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-6}:\\
\;\;\;\;\frac{t_0 + \frac{1}{1 + x \cdot \left(eps_m + 1\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot 0.5\\
\end{array}
\end{array}
if x < -4e16Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 59.8%
Taylor expanded in eps around 0 41.5%
expm1-def41.5%
mul-1-neg41.5%
Simplified41.5%
if -4e16 < x < -5.0000000000000002e-271Initial program 49.0%
Simplified49.0%
Taylor expanded in eps around inf 98.4%
Simplified98.4%
neg-mul-198.4%
+-commutative98.4%
associate-*r*98.4%
distribute-rgt-in98.4%
*-un-lft-identity98.4%
distribute-lft-in98.4%
neg-mul-198.4%
add-sqr-sqrt98.4%
sqrt-unprod98.4%
sqr-neg98.4%
sqrt-unprod0.0%
add-sqr-sqrt99.4%
Applied egg-rr99.4%
mul-1-neg99.4%
*-commutative99.4%
sub-neg99.4%
Simplified99.4%
Taylor expanded in x around 0 87.6%
mul-1-neg86.7%
distribute-lft-neg-out86.7%
*-commutative86.7%
Simplified87.6%
if -5.0000000000000002e-271 < x < 2.60000000000000009e-6Initial program 44.3%
Simplified34.9%
Taylor expanded in eps around inf 99.3%
Taylor expanded in x around 0 87.8%
if 2.60000000000000009e-6 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 35.6%
Taylor expanded in x around inf 79.4%
Final simplification78.1%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (* x (+ eps_m -1.0)))))
(if (<= x -4e+16)
(/ (/ (expm1 (- x)) eps_m) 2.0)
(if (<= x -5e-271)
(/ (+ (- 1.0 (* x (- 1.0 eps_m))) (exp (* eps_m (- x)))) 2.0)
(if (<= x 2.6e-6) (/ (+ 1.0 t_0) 2.0) (* t_0 0.5))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * (eps_m + -1.0)));
double tmp;
if (x <= -4e+16) {
tmp = (expm1(-x) / eps_m) / 2.0;
} else if (x <= -5e-271) {
tmp = ((1.0 - (x * (1.0 - eps_m))) + exp((eps_m * -x))) / 2.0;
} else if (x <= 2.6e-6) {
tmp = (1.0 + t_0) / 2.0;
} else {
tmp = t_0 * 0.5;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = Math.exp((x * (eps_m + -1.0)));
double tmp;
if (x <= -4e+16) {
tmp = (Math.expm1(-x) / eps_m) / 2.0;
} else if (x <= -5e-271) {
tmp = ((1.0 - (x * (1.0 - eps_m))) + Math.exp((eps_m * -x))) / 2.0;
} else if (x <= 2.6e-6) {
tmp = (1.0 + t_0) / 2.0;
} else {
tmp = t_0 * 0.5;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * (eps_m + -1.0))) tmp = 0 if x <= -4e+16: tmp = (math.expm1(-x) / eps_m) / 2.0 elif x <= -5e-271: tmp = ((1.0 - (x * (1.0 - eps_m))) + math.exp((eps_m * -x))) / 2.0 elif x <= 2.6e-6: tmp = (1.0 + t_0) / 2.0 else: tmp = t_0 * 0.5 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * Float64(eps_m + -1.0))) tmp = 0.0 if (x <= -4e+16) tmp = Float64(Float64(expm1(Float64(-x)) / eps_m) / 2.0); elseif (x <= -5e-271) tmp = Float64(Float64(Float64(1.0 - Float64(x * Float64(1.0 - eps_m))) + exp(Float64(eps_m * Float64(-x)))) / 2.0); elseif (x <= 2.6e-6) tmp = Float64(Float64(1.0 + t_0) / 2.0); else tmp = Float64(t_0 * 0.5); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -4e+16], N[(N[(N[(Exp[(-x)] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -5e-271], N[(N[(N[(1.0 - N[(x * N[(1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.6e-6], N[(N[(1.0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], N[(t$95$0 * 0.5), $MachinePrecision]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(eps_m + -1\right)}\\
\mathbf{if}\;x \leq -4 \cdot 10^{+16}:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(-x\right)}{eps_m}}{2}\\
\mathbf{elif}\;x \leq -5 \cdot 10^{-271}:\\
\;\;\;\;\frac{\left(1 - x \cdot \left(1 - eps_m\right)\right) + e^{eps_m \cdot \left(-x\right)}}{2}\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-6}:\\
\;\;\;\;\frac{1 + t_0}{2}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot 0.5\\
\end{array}
\end{array}
if x < -4e16Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 59.8%
Taylor expanded in eps around 0 41.5%
expm1-def41.5%
mul-1-neg41.5%
Simplified41.5%
if -4e16 < x < -5.0000000000000002e-271Initial program 49.0%
Simplified49.0%
Taylor expanded in eps around inf 98.4%
Simplified98.4%
neg-mul-198.4%
+-commutative98.4%
associate-*r*98.4%
distribute-rgt-in98.4%
*-un-lft-identity98.4%
distribute-lft-in98.4%
neg-mul-198.4%
add-sqr-sqrt98.4%
sqrt-unprod98.4%
sqr-neg98.4%
sqrt-unprod0.0%
add-sqr-sqrt99.4%
Applied egg-rr99.4%
mul-1-neg99.4%
*-commutative99.4%
sub-neg99.4%
Simplified99.4%
Taylor expanded in eps around inf 98.5%
associate-*r*98.5%
neg-mul-198.5%
*-commutative98.5%
Simplified98.5%
Taylor expanded in x around 0 86.7%
mul-1-neg86.7%
distribute-lft-neg-out86.7%
*-commutative86.7%
Simplified86.7%
if -5.0000000000000002e-271 < x < 2.60000000000000009e-6Initial program 44.3%
Simplified44.3%
Taylor expanded in x around 0 32.8%
Taylor expanded in eps around inf 87.7%
sub-neg87.7%
neg-mul-187.7%
associate-*r*87.7%
mul-1-neg87.7%
neg-mul-187.7%
sub-neg87.7%
Simplified87.7%
if 2.60000000000000009e-6 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 35.6%
Taylor expanded in x around inf 79.4%
Final simplification77.9%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -320.0)
(/ (/ (expm1 (- x)) eps_m) 2.0)
(if (<= x 1.35e-97)
1.0
(if (or (<= x 1.7e-38) (not (<= x 6.6e-15)))
(* (exp (* x (+ eps_m -1.0))) 0.5)
1.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -320.0) {
tmp = (expm1(-x) / eps_m) / 2.0;
} else if (x <= 1.35e-97) {
tmp = 1.0;
} else if ((x <= 1.7e-38) || !(x <= 6.6e-15)) {
tmp = exp((x * (eps_m + -1.0))) * 0.5;
} else {
tmp = 1.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -320.0) {
tmp = (Math.expm1(-x) / eps_m) / 2.0;
} else if (x <= 1.35e-97) {
tmp = 1.0;
} else if ((x <= 1.7e-38) || !(x <= 6.6e-15)) {
tmp = Math.exp((x * (eps_m + -1.0))) * 0.5;
} else {
tmp = 1.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -320.0: tmp = (math.expm1(-x) / eps_m) / 2.0 elif x <= 1.35e-97: tmp = 1.0 elif (x <= 1.7e-38) or not (x <= 6.6e-15): tmp = math.exp((x * (eps_m + -1.0))) * 0.5 else: tmp = 1.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -320.0) tmp = Float64(Float64(expm1(Float64(-x)) / eps_m) / 2.0); elseif (x <= 1.35e-97) tmp = 1.0; elseif ((x <= 1.7e-38) || !(x <= 6.6e-15)) tmp = Float64(exp(Float64(x * Float64(eps_m + -1.0))) * 0.5); else tmp = 1.0; end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -320.0], N[(N[(N[(Exp[(-x)] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.35e-97], 1.0, If[Or[LessEqual[x, 1.7e-38], N[Not[LessEqual[x, 6.6e-15]], $MachinePrecision]], N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision], 1.0]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -320:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(-x\right)}{eps_m}}{2}\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{-97}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{-38} \lor \neg \left(x \leq 6.6 \cdot 10^{-15}\right):\\
\;\;\;\;e^{x \cdot \left(eps_m + -1\right)} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -320Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 59.8%
Taylor expanded in eps around 0 41.5%
expm1-def41.5%
mul-1-neg41.5%
Simplified41.5%
if -320 < x < 1.34999999999999993e-97 or 1.7000000000000001e-38 < x < 6.6e-15Initial program 43.0%
Simplified43.0%
Taylor expanded in x around 0 85.2%
if 1.34999999999999993e-97 < x < 1.7000000000000001e-38 or 6.6e-15 < x Initial program 91.3%
Simplified84.8%
Taylor expanded in eps around inf 99.4%
Taylor expanded in x around 0 43.2%
Taylor expanded in x around inf 69.5%
Final simplification72.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (* x (+ eps_m -1.0)))))
(if (<= x -380.0)
(/ (/ (expm1 (- x)) eps_m) 2.0)
(if (<= x 2.6e-6) (/ (+ 1.0 t_0) 2.0) (* t_0 0.5)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * (eps_m + -1.0)));
double tmp;
if (x <= -380.0) {
tmp = (expm1(-x) / eps_m) / 2.0;
} else if (x <= 2.6e-6) {
tmp = (1.0 + t_0) / 2.0;
} else {
tmp = t_0 * 0.5;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = Math.exp((x * (eps_m + -1.0)));
double tmp;
if (x <= -380.0) {
tmp = (Math.expm1(-x) / eps_m) / 2.0;
} else if (x <= 2.6e-6) {
tmp = (1.0 + t_0) / 2.0;
} else {
tmp = t_0 * 0.5;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * (eps_m + -1.0))) tmp = 0 if x <= -380.0: tmp = (math.expm1(-x) / eps_m) / 2.0 elif x <= 2.6e-6: tmp = (1.0 + t_0) / 2.0 else: tmp = t_0 * 0.5 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * Float64(eps_m + -1.0))) tmp = 0.0 if (x <= -380.0) tmp = Float64(Float64(expm1(Float64(-x)) / eps_m) / 2.0); elseif (x <= 2.6e-6) tmp = Float64(Float64(1.0 + t_0) / 2.0); else tmp = Float64(t_0 * 0.5); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -380.0], N[(N[(N[(Exp[(-x)] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.6e-6], N[(N[(1.0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], N[(t$95$0 * 0.5), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(eps_m + -1\right)}\\
\mathbf{if}\;x \leq -380:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(-x\right)}{eps_m}}{2}\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-6}:\\
\;\;\;\;\frac{1 + t_0}{2}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot 0.5\\
\end{array}
\end{array}
if x < -380Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 59.8%
Taylor expanded in eps around 0 41.5%
expm1-def41.5%
mul-1-neg41.5%
Simplified41.5%
if -380 < x < 2.60000000000000009e-6Initial program 46.2%
Simplified46.2%
Taylor expanded in x around 0 34.9%
Taylor expanded in eps around inf 87.6%
sub-neg87.6%
neg-mul-187.6%
associate-*r*87.6%
mul-1-neg87.6%
neg-mul-187.6%
sub-neg87.6%
Simplified87.6%
if 2.60000000000000009e-6 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 35.6%
Taylor expanded in x around inf 79.4%
Final simplification78.1%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -550.0)
(/ (/ (expm1 (- x)) eps_m) 2.0)
(if (<= x 2.6e-6)
1.0
(/
(+
(* (- 1.0 (* x (- 1.0 eps_m))) (+ 1.0 (/ 1.0 eps_m)))
(/ (+ x -1.0) eps_m))
2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -550.0) {
tmp = (expm1(-x) / eps_m) / 2.0;
} else if (x <= 2.6e-6) {
tmp = 1.0;
} else {
tmp = (((1.0 - (x * (1.0 - eps_m))) * (1.0 + (1.0 / eps_m))) + ((x + -1.0) / eps_m)) / 2.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -550.0) {
tmp = (Math.expm1(-x) / eps_m) / 2.0;
} else if (x <= 2.6e-6) {
tmp = 1.0;
} else {
tmp = (((1.0 - (x * (1.0 - eps_m))) * (1.0 + (1.0 / eps_m))) + ((x + -1.0) / eps_m)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -550.0: tmp = (math.expm1(-x) / eps_m) / 2.0 elif x <= 2.6e-6: tmp = 1.0 else: tmp = (((1.0 - (x * (1.0 - eps_m))) * (1.0 + (1.0 / eps_m))) + ((x + -1.0) / eps_m)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -550.0) tmp = Float64(Float64(expm1(Float64(-x)) / eps_m) / 2.0); elseif (x <= 2.6e-6) tmp = 1.0; else tmp = Float64(Float64(Float64(Float64(1.0 - Float64(x * Float64(1.0 - eps_m))) * Float64(1.0 + Float64(1.0 / eps_m))) + Float64(Float64(x + -1.0) / eps_m)) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -550.0], N[(N[(N[(Exp[(-x)] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.6e-6], 1.0, N[(N[(N[(N[(1.0 - N[(x * N[(1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x + -1.0), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -550:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(-x\right)}{eps_m}}{2}\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-6}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - x \cdot \left(1 - eps_m\right)\right) \cdot \left(1 + \frac{1}{eps_m}\right) + \frac{x + -1}{eps_m}}{2}\\
\end{array}
\end{array}
if x < -550Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 59.8%
Taylor expanded in eps around 0 41.5%
expm1-def41.5%
mul-1-neg41.5%
Simplified41.5%
if -550 < x < 2.60000000000000009e-6Initial program 46.2%
Simplified46.2%
Taylor expanded in x around 0 78.1%
if 2.60000000000000009e-6 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 19.4%
Taylor expanded in x around 0 25.7%
mul-1-neg25.7%
unsub-neg25.7%
Simplified25.7%
Taylor expanded in eps around 0 39.5%
mul-1-neg39.5%
unsub-neg39.5%
Simplified39.5%
Final simplification62.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -0.0016)
(* (* x eps_m) -0.5)
(if (<= x 2.6e-6)
1.0
(/
(+
(* (- 1.0 (* x (- 1.0 eps_m))) (+ 1.0 (/ 1.0 eps_m)))
(/ (+ x -1.0) eps_m))
2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -0.0016) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 2.6e-6) {
tmp = 1.0;
} else {
tmp = (((1.0 - (x * (1.0 - eps_m))) * (1.0 + (1.0 / eps_m))) + ((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 (x <= (-0.0016d0)) then
tmp = (x * eps_m) * (-0.5d0)
else if (x <= 2.6d-6) then
tmp = 1.0d0
else
tmp = (((1.0d0 - (x * (1.0d0 - eps_m))) * (1.0d0 + (1.0d0 / eps_m))) + ((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 (x <= -0.0016) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 2.6e-6) {
tmp = 1.0;
} else {
tmp = (((1.0 - (x * (1.0 - eps_m))) * (1.0 + (1.0 / eps_m))) + ((x + -1.0) / eps_m)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -0.0016: tmp = (x * eps_m) * -0.5 elif x <= 2.6e-6: tmp = 1.0 else: tmp = (((1.0 - (x * (1.0 - eps_m))) * (1.0 + (1.0 / eps_m))) + ((x + -1.0) / eps_m)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -0.0016) tmp = Float64(Float64(x * eps_m) * -0.5); elseif (x <= 2.6e-6) tmp = 1.0; else tmp = Float64(Float64(Float64(Float64(1.0 - Float64(x * Float64(1.0 - eps_m))) * Float64(1.0 + Float64(1.0 / eps_m))) + Float64(Float64(x + -1.0) / eps_m)) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -0.0016) tmp = (x * eps_m) * -0.5; elseif (x <= 2.6e-6) tmp = 1.0; else tmp = (((1.0 - (x * (1.0 - eps_m))) * (1.0 + (1.0 / eps_m))) + ((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[x, -0.0016], N[(N[(x * eps$95$m), $MachinePrecision] * -0.5), $MachinePrecision], If[LessEqual[x, 2.6e-6], 1.0, N[(N[(N[(N[(1.0 - N[(x * N[(1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x + -1.0), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0016:\\
\;\;\;\;\left(x \cdot eps_m\right) \cdot -0.5\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-6}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - x \cdot \left(1 - eps_m\right)\right) \cdot \left(1 + \frac{1}{eps_m}\right) + \frac{x + -1}{eps_m}}{2}\\
\end{array}
\end{array}
if x < -0.00160000000000000008Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 52.3%
Taylor expanded in eps around inf 22.1%
mul-1-neg22.1%
*-commutative22.1%
distribute-rgt-neg-in22.1%
Simplified22.1%
Taylor expanded in x around 0 22.1%
*-commutative22.1%
Simplified22.1%
if -0.00160000000000000008 < x < 2.60000000000000009e-6Initial program 45.5%
Simplified45.5%
Taylor expanded in x around 0 79.2%
if 2.60000000000000009e-6 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 19.4%
Taylor expanded in x around 0 25.7%
mul-1-neg25.7%
unsub-neg25.7%
Simplified25.7%
Taylor expanded in eps around 0 39.5%
mul-1-neg39.5%
unsub-neg39.5%
Simplified39.5%
Final simplification59.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -0.0016)
(* (* x eps_m) -0.5)
(if (<= x 480.0)
1.0
(if (<= x 2.2e+253) 0.0 (/ (+ (* x eps_m) (+ 1.0 (/ 1.0 eps_m))) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -0.0016) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 480.0) {
tmp = 1.0;
} else if (x <= 2.2e+253) {
tmp = 0.0;
} else {
tmp = ((x * eps_m) + (1.0 + (1.0 / eps_m))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-0.0016d0)) then
tmp = (x * eps_m) * (-0.5d0)
else if (x <= 480.0d0) then
tmp = 1.0d0
else if (x <= 2.2d+253) then
tmp = 0.0d0
else
tmp = ((x * eps_m) + (1.0d0 + (1.0d0 / eps_m))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -0.0016) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 480.0) {
tmp = 1.0;
} else if (x <= 2.2e+253) {
tmp = 0.0;
} else {
tmp = ((x * eps_m) + (1.0 + (1.0 / eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -0.0016: tmp = (x * eps_m) * -0.5 elif x <= 480.0: tmp = 1.0 elif x <= 2.2e+253: tmp = 0.0 else: tmp = ((x * eps_m) + (1.0 + (1.0 / eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -0.0016) tmp = Float64(Float64(x * eps_m) * -0.5); elseif (x <= 480.0) tmp = 1.0; elseif (x <= 2.2e+253) tmp = 0.0; else tmp = Float64(Float64(Float64(x * eps_m) + Float64(1.0 + Float64(1.0 / eps_m))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -0.0016) tmp = (x * eps_m) * -0.5; elseif (x <= 480.0) tmp = 1.0; elseif (x <= 2.2e+253) tmp = 0.0; else tmp = ((x * eps_m) + (1.0 + (1.0 / eps_m))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -0.0016], N[(N[(x * eps$95$m), $MachinePrecision] * -0.5), $MachinePrecision], If[LessEqual[x, 480.0], 1.0, If[LessEqual[x, 2.2e+253], 0.0, N[(N[(N[(x * eps$95$m), $MachinePrecision] + N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0016:\\
\;\;\;\;\left(x \cdot eps_m\right) \cdot -0.5\\
\mathbf{elif}\;x \leq 480:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{+253}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps_m + \left(1 + \frac{1}{eps_m}\right)}{2}\\
\end{array}
\end{array}
if x < -0.00160000000000000008Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 52.3%
Taylor expanded in eps around inf 22.1%
mul-1-neg22.1%
*-commutative22.1%
distribute-rgt-neg-in22.1%
Simplified22.1%
Taylor expanded in x around 0 22.1%
*-commutative22.1%
Simplified22.1%
if -0.00160000000000000008 < x < 480Initial program 45.9%
Simplified45.9%
Taylor expanded in x around 0 78.7%
if 480 < x < 2.20000000000000006e253Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 17.7%
Taylor expanded in x around 0 34.4%
mul-1-neg34.4%
unsub-neg34.4%
Simplified34.4%
Taylor expanded in eps around 0 52.8%
associate-*r/52.8%
distribute-rgt1-in52.8%
metadata-eval52.8%
mul0-lft52.8%
metadata-eval52.8%
+-inverses52.8%
div-sub34.8%
+-inverses52.8%
Simplified52.8%
if 2.20000000000000006e253 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 19.7%
Taylor expanded in x around 0 19.7%
Taylor expanded in eps around inf 19.9%
*-commutative19.9%
Simplified19.9%
add-log-exp25.5%
sub-neg25.5%
distribute-rgt-neg-out25.5%
exp-sum25.0%
exp-prod25.0%
add-sqr-sqrt25.0%
sqrt-unprod69.2%
sqr-neg69.2%
sqrt-unprod44.1%
add-sqr-sqrt44.2%
exp-prod44.2%
sum-log44.2%
add-log-exp44.2%
add-log-exp44.4%
Applied egg-rr44.4%
Final simplification62.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -0.0016) (* (* x eps_m) -0.5) (if (<= x 550.0) 1.0 0.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -0.0016) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 550.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 <= (-0.0016d0)) then
tmp = (x * eps_m) * (-0.5d0)
else if (x <= 550.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 <= -0.0016) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 550.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -0.0016: tmp = (x * eps_m) * -0.5 elif x <= 550.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -0.0016) tmp = Float64(Float64(x * eps_m) * -0.5); elseif (x <= 550.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 <= -0.0016) tmp = (x * eps_m) * -0.5; elseif (x <= 550.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, -0.0016], N[(N[(x * eps$95$m), $MachinePrecision] * -0.5), $MachinePrecision], If[LessEqual[x, 550.0], 1.0, 0.0]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0016:\\
\;\;\;\;\left(x \cdot eps_m\right) \cdot -0.5\\
\mathbf{elif}\;x \leq 550:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -0.00160000000000000008Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 52.3%
Taylor expanded in eps around inf 22.1%
mul-1-neg22.1%
*-commutative22.1%
distribute-rgt-neg-in22.1%
Simplified22.1%
Taylor expanded in x around 0 22.1%
*-commutative22.1%
Simplified22.1%
if -0.00160000000000000008 < x < 550Initial program 45.9%
Simplified45.9%
Taylor expanded in x around 0 78.7%
if 550 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 18.2%
Taylor expanded in x around 0 26.1%
mul-1-neg26.1%
unsub-neg26.1%
Simplified26.1%
Taylor expanded in eps around 0 47.8%
associate-*r/47.8%
distribute-rgt1-in47.8%
metadata-eval47.8%
mul0-lft47.8%
metadata-eval47.8%
+-inverses47.8%
div-sub26.6%
+-inverses47.8%
Simplified47.8%
Final simplification61.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 1.0) (- 1.0 x) 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1.0) {
tmp = 1.0 - x;
} 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.0d0) then
tmp = 1.0d0 - x
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.0) {
tmp = 1.0 - x;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1.0: tmp = 1.0 - x else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1.0) tmp = Float64(1.0 - x); 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.0) tmp = 1.0 - x; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 1.0], N[(1.0 - x), $MachinePrecision], 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;1 - x\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1Initial program 58.1%
Simplified51.0%
Taylor expanded in eps around inf 99.2%
Taylor expanded in x around 0 81.4%
Taylor expanded in x around 0 61.5%
neg-mul-161.5%
unsub-neg61.5%
Simplified61.5%
if 1 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 18.2%
Taylor expanded in x around 0 26.1%
mul-1-neg26.1%
unsub-neg26.1%
Simplified26.1%
Taylor expanded in eps around 0 47.8%
associate-*r/47.8%
distribute-rgt1-in47.8%
metadata-eval47.8%
mul0-lft47.8%
metadata-eval47.8%
+-inverses47.8%
div-sub26.6%
+-inverses47.8%
Simplified47.8%
Final simplification57.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 470.0) 1.0 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 470.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 <= 470.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 <= 470.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 470.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 470.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 <= 470.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, 470.0], 1.0, 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 470:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 470Initial program 58.1%
Simplified58.1%
Taylor expanded in x around 0 61.6%
if 470 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 18.2%
Taylor expanded in x around 0 26.1%
mul-1-neg26.1%
unsub-neg26.1%
Simplified26.1%
Taylor expanded in eps around 0 47.8%
associate-*r/47.8%
distribute-rgt1-in47.8%
metadata-eval47.8%
mul0-lft47.8%
metadata-eval47.8%
+-inverses47.8%
div-sub26.6%
+-inverses47.8%
Simplified47.8%
Final simplification58.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (- 1.0 x))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return 1.0 - x;
}
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 - x
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return 1.0 - x;
}
eps_m = math.fabs(eps) def code(x, eps_m): return 1.0 - x
eps_m = abs(eps) function code(x, eps_m) return Float64(1.0 - x) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = 1.0 - x; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(1.0 - x), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
1 - x
\end{array}
Initial program 68.9%
Simplified63.6%
Taylor expanded in eps around inf 99.4%
Taylor expanded in x around 0 69.4%
Taylor expanded in x around 0 45.9%
neg-mul-145.9%
unsub-neg45.9%
Simplified45.9%
Final simplification45.9%
herbie shell --seed 2023334
(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))