
(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 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 1.0) (/ (+ x 1.0) (exp x)) (* 0.5 (+ (exp (* x (- -1.0 eps_m))) (exp (* x eps_m))))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 1.0) {
tmp = (x + 1.0) / exp(x);
} else {
tmp = 0.5 * (exp((x * (-1.0 - eps_m))) + exp((x * eps_m)));
}
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) / exp(x)
else
tmp = 0.5d0 * (exp((x * ((-1.0d0) - eps_m))) + exp((x * eps_m)))
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) / Math.exp(x);
} else {
tmp = 0.5 * (Math.exp((x * (-1.0 - eps_m))) + Math.exp((x * eps_m)));
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 1.0: tmp = (x + 1.0) / math.exp(x) else: tmp = 0.5 * (math.exp((x * (-1.0 - eps_m))) + math.exp((x * eps_m))) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 1.0) tmp = Float64(Float64(x + 1.0) / exp(x)); else tmp = Float64(0.5 * Float64(exp(Float64(x * Float64(-1.0 - eps_m))) + exp(Float64(x * eps_m)))); 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) / exp(x); else tmp = 0.5 * (exp((x * (-1.0 - eps_m))) + exp((x * eps_m))); 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 + 1.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 1:\\
\;\;\;\;\frac{x + 1}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(e^{x \cdot \left(-1 - eps\_m\right)} + e^{x \cdot eps\_m}\right)\\
\end{array}
\end{array}
if eps < 1Initial program 65.4%
Simplified65.4%
Taylor expanded in eps around 0
distribute-lft-outN/A
distribute-lft-outN/A
distribute-rgt-out--N/A
metadata-evalN/A
*-rgt-identityN/A
distribute-rgt1-inN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f6470.2%
Simplified70.2%
exp-diffN/A
1-expN/A
un-div-invN/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f6470.3%
Applied egg-rr70.3%
if 1 < eps Initial program 99.9%
Simplified99.9%
Taylor expanded in eps around inf
cancel-sign-sub-invN/A
metadata-evalN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
exp-lowering-exp.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f6499.8%
Simplified99.8%
Taylor expanded in eps around inf
*-commutativeN/A
*-lowering-*.f6499.8%
Simplified99.8%
Final simplification78.4%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (* 0.5 (+ (exp (* x (+ eps_m -1.0))) (exp (* x (- -1.0 eps_m))))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return 0.5 * (exp((x * (eps_m + -1.0))) + exp((x * (-1.0 - eps_m))));
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = 0.5d0 * (exp((x * (eps_m + (-1.0d0)))) + exp((x * ((-1.0d0) - eps_m))))
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return 0.5 * (Math.exp((x * (eps_m + -1.0))) + Math.exp((x * (-1.0 - eps_m))));
}
eps_m = math.fabs(eps) def code(x, eps_m): return 0.5 * (math.exp((x * (eps_m + -1.0))) + math.exp((x * (-1.0 - eps_m))))
eps_m = abs(eps) function code(x, eps_m) return Float64(0.5 * Float64(exp(Float64(x * Float64(eps_m + -1.0))) + exp(Float64(x * Float64(-1.0 - eps_m))))) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = 0.5 * (exp((x * (eps_m + -1.0))) + exp((x * (-1.0 - eps_m)))); end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(0.5 * 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]), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
0.5 \cdot \left(e^{x \cdot \left(eps\_m + -1\right)} + e^{x \cdot \left(-1 - eps\_m\right)}\right)
\end{array}
Initial program 75.0%
Simplified75.0%
Taylor expanded in eps around inf
cancel-sign-sub-invN/A
metadata-evalN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
exp-lowering-exp.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f6498.8%
Simplified98.8%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= eps_m 1.0)
(/ (+ x 1.0) (exp x))
(/
(+ (* x -0.5) (* eps_m (+ 1.0 (* 0.5 (* x (* x (* eps_m eps_m)))))))
eps_m)))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 1.0) {
tmp = (x + 1.0) / exp(x);
} else {
tmp = ((x * -0.5) + (eps_m * (1.0 + (0.5 * (x * (x * (eps_m * eps_m))))))) / eps_m;
}
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) / exp(x)
else
tmp = ((x * (-0.5d0)) + (eps_m * (1.0d0 + (0.5d0 * (x * (x * (eps_m * eps_m))))))) / eps_m
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) / Math.exp(x);
} else {
tmp = ((x * -0.5) + (eps_m * (1.0 + (0.5 * (x * (x * (eps_m * eps_m))))))) / eps_m;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 1.0: tmp = (x + 1.0) / math.exp(x) else: tmp = ((x * -0.5) + (eps_m * (1.0 + (0.5 * (x * (x * (eps_m * eps_m))))))) / eps_m return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 1.0) tmp = Float64(Float64(x + 1.0) / exp(x)); else tmp = Float64(Float64(Float64(x * -0.5) + Float64(eps_m * Float64(1.0 + Float64(0.5 * Float64(x * Float64(x * Float64(eps_m * eps_m))))))) / eps_m); 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) / exp(x); else tmp = ((x * -0.5) + (eps_m * (1.0 + (0.5 * (x * (x * (eps_m * eps_m))))))) / eps_m; 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 + 1.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * -0.5), $MachinePrecision] + N[(eps$95$m * N[(1.0 + N[(0.5 * N[(x * N[(x * N[(eps$95$m * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 1:\\
\;\;\;\;\frac{x + 1}{e^{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot -0.5 + eps\_m \cdot \left(1 + 0.5 \cdot \left(x \cdot \left(x \cdot \left(eps\_m \cdot eps\_m\right)\right)\right)\right)}{eps\_m}\\
\end{array}
\end{array}
if eps < 1Initial program 65.4%
Simplified65.4%
Taylor expanded in eps around 0
distribute-lft-outN/A
distribute-lft-outN/A
distribute-rgt-out--N/A
metadata-evalN/A
*-rgt-identityN/A
distribute-rgt1-inN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f6470.2%
Simplified70.2%
exp-diffN/A
1-expN/A
un-div-invN/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f6470.3%
Applied egg-rr70.3%
if 1 < eps Initial program 99.9%
Simplified99.9%
Taylor expanded in x around 0
Simplified80.3%
Taylor expanded in eps around inf
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f6476.3%
Simplified76.3%
Taylor expanded in eps around 0
/-lowering-/.f64N/A
Simplified81.6%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= eps_m 45.0)
(exp (- 0.0 x))
(/
(+ (* x -0.5) (* eps_m (+ 1.0 (* 0.5 (* x (* x (* eps_m eps_m)))))))
eps_m)))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 45.0) {
tmp = exp((0.0 - x));
} else {
tmp = ((x * -0.5) + (eps_m * (1.0 + (0.5 * (x * (x * (eps_m * eps_m))))))) / eps_m;
}
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 <= 45.0d0) then
tmp = exp((0.0d0 - x))
else
tmp = ((x * (-0.5d0)) + (eps_m * (1.0d0 + (0.5d0 * (x * (x * (eps_m * eps_m))))))) / eps_m
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 <= 45.0) {
tmp = Math.exp((0.0 - x));
} else {
tmp = ((x * -0.5) + (eps_m * (1.0 + (0.5 * (x * (x * (eps_m * eps_m))))))) / eps_m;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 45.0: tmp = math.exp((0.0 - x)) else: tmp = ((x * -0.5) + (eps_m * (1.0 + (0.5 * (x * (x * (eps_m * eps_m))))))) / eps_m return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 45.0) tmp = exp(Float64(0.0 - x)); else tmp = Float64(Float64(Float64(x * -0.5) + Float64(eps_m * Float64(1.0 + Float64(0.5 * Float64(x * Float64(x * Float64(eps_m * eps_m))))))) / eps_m); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 45.0) tmp = exp((0.0 - x)); else tmp = ((x * -0.5) + (eps_m * (1.0 + (0.5 * (x * (x * (eps_m * eps_m))))))) / eps_m; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 45.0], N[Exp[N[(0.0 - x), $MachinePrecision]], $MachinePrecision], N[(N[(N[(x * -0.5), $MachinePrecision] + N[(eps$95$m * N[(1.0 + N[(0.5 * N[(x * N[(x * N[(eps$95$m * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 45:\\
\;\;\;\;e^{0 - x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot -0.5 + eps\_m \cdot \left(1 + 0.5 \cdot \left(x \cdot \left(x \cdot \left(eps\_m \cdot eps\_m\right)\right)\right)\right)}{eps\_m}\\
\end{array}
\end{array}
if eps < 45Initial program 65.6%
Simplified65.6%
Taylor expanded in eps around inf
cancel-sign-sub-invN/A
metadata-evalN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
exp-lowering-exp.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f6498.5%
Simplified98.5%
Taylor expanded in eps around 0
exp-lowering-exp.f64N/A
neg-mul-1N/A
neg-sub0N/A
--lowering--.f6478.6%
Simplified78.6%
if 45 < eps Initial program 99.9%
Simplified99.9%
Taylor expanded in x around 0
Simplified81.4%
Taylor expanded in eps around inf
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f6477.3%
Simplified77.3%
Taylor expanded in eps around 0
/-lowering-/.f64N/A
Simplified82.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (* (+ eps_m 1.0) (+ -0.5 (/ 0.5 eps_m))))
(t_1 (+ 0.5 (/ 0.5 eps_m))))
(if (<= x 22000.0)
(+
1.0
(*
x
(+
(* (+ eps_m -1.0) t_1)
(/
(+
0.5
(* eps_m (+ (* x -0.5) (* eps_m (+ -0.5 (* 0.5 (* x eps_m)))))))
eps_m))))
(if (<= x 2.15e+159)
(+
(+ 1.0 (* (* x (+ eps_m -1.0)) t_1))
(*
x
(+
t_0
(*
0.5
(*
x
(+
(* t_1 (* (+ eps_m -1.0) (+ eps_m -1.0)))
(* (- -1.0 eps_m) t_0)))))))
(* 0.5 (* x (* x (* eps_m eps_m))))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = (eps_m + 1.0) * (-0.5 + (0.5 / eps_m));
double t_1 = 0.5 + (0.5 / eps_m);
double tmp;
if (x <= 22000.0) {
tmp = 1.0 + (x * (((eps_m + -1.0) * t_1) + ((0.5 + (eps_m * ((x * -0.5) + (eps_m * (-0.5 + (0.5 * (x * eps_m))))))) / eps_m)));
} else if (x <= 2.15e+159) {
tmp = (1.0 + ((x * (eps_m + -1.0)) * t_1)) + (x * (t_0 + (0.5 * (x * ((t_1 * ((eps_m + -1.0) * (eps_m + -1.0))) + ((-1.0 - eps_m) * t_0))))));
} else {
tmp = 0.5 * (x * (x * (eps_m * eps_m)));
}
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) :: t_1
real(8) :: tmp
t_0 = (eps_m + 1.0d0) * ((-0.5d0) + (0.5d0 / eps_m))
t_1 = 0.5d0 + (0.5d0 / eps_m)
if (x <= 22000.0d0) then
tmp = 1.0d0 + (x * (((eps_m + (-1.0d0)) * t_1) + ((0.5d0 + (eps_m * ((x * (-0.5d0)) + (eps_m * ((-0.5d0) + (0.5d0 * (x * eps_m))))))) / eps_m)))
else if (x <= 2.15d+159) then
tmp = (1.0d0 + ((x * (eps_m + (-1.0d0))) * t_1)) + (x * (t_0 + (0.5d0 * (x * ((t_1 * ((eps_m + (-1.0d0)) * (eps_m + (-1.0d0)))) + (((-1.0d0) - eps_m) * t_0))))))
else
tmp = 0.5d0 * (x * (x * (eps_m * eps_m)))
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = (eps_m + 1.0) * (-0.5 + (0.5 / eps_m));
double t_1 = 0.5 + (0.5 / eps_m);
double tmp;
if (x <= 22000.0) {
tmp = 1.0 + (x * (((eps_m + -1.0) * t_1) + ((0.5 + (eps_m * ((x * -0.5) + (eps_m * (-0.5 + (0.5 * (x * eps_m))))))) / eps_m)));
} else if (x <= 2.15e+159) {
tmp = (1.0 + ((x * (eps_m + -1.0)) * t_1)) + (x * (t_0 + (0.5 * (x * ((t_1 * ((eps_m + -1.0) * (eps_m + -1.0))) + ((-1.0 - eps_m) * t_0))))));
} else {
tmp = 0.5 * (x * (x * (eps_m * eps_m)));
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = (eps_m + 1.0) * (-0.5 + (0.5 / eps_m)) t_1 = 0.5 + (0.5 / eps_m) tmp = 0 if x <= 22000.0: tmp = 1.0 + (x * (((eps_m + -1.0) * t_1) + ((0.5 + (eps_m * ((x * -0.5) + (eps_m * (-0.5 + (0.5 * (x * eps_m))))))) / eps_m))) elif x <= 2.15e+159: tmp = (1.0 + ((x * (eps_m + -1.0)) * t_1)) + (x * (t_0 + (0.5 * (x * ((t_1 * ((eps_m + -1.0) * (eps_m + -1.0))) + ((-1.0 - eps_m) * t_0)))))) else: tmp = 0.5 * (x * (x * (eps_m * eps_m))) return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(Float64(eps_m + 1.0) * Float64(-0.5 + Float64(0.5 / eps_m))) t_1 = Float64(0.5 + Float64(0.5 / eps_m)) tmp = 0.0 if (x <= 22000.0) tmp = Float64(1.0 + Float64(x * Float64(Float64(Float64(eps_m + -1.0) * t_1) + Float64(Float64(0.5 + Float64(eps_m * Float64(Float64(x * -0.5) + Float64(eps_m * Float64(-0.5 + Float64(0.5 * Float64(x * eps_m))))))) / eps_m)))); elseif (x <= 2.15e+159) tmp = Float64(Float64(1.0 + Float64(Float64(x * Float64(eps_m + -1.0)) * t_1)) + Float64(x * Float64(t_0 + Float64(0.5 * Float64(x * Float64(Float64(t_1 * Float64(Float64(eps_m + -1.0) * Float64(eps_m + -1.0))) + Float64(Float64(-1.0 - eps_m) * t_0))))))); else tmp = Float64(0.5 * Float64(x * Float64(x * Float64(eps_m * eps_m)))); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = (eps_m + 1.0) * (-0.5 + (0.5 / eps_m)); t_1 = 0.5 + (0.5 / eps_m); tmp = 0.0; if (x <= 22000.0) tmp = 1.0 + (x * (((eps_m + -1.0) * t_1) + ((0.5 + (eps_m * ((x * -0.5) + (eps_m * (-0.5 + (0.5 * (x * eps_m))))))) / eps_m))); elseif (x <= 2.15e+159) tmp = (1.0 + ((x * (eps_m + -1.0)) * t_1)) + (x * (t_0 + (0.5 * (x * ((t_1 * ((eps_m + -1.0) * (eps_m + -1.0))) + ((-1.0 - eps_m) * t_0)))))); else tmp = 0.5 * (x * (x * (eps_m * eps_m))); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(N[(eps$95$m + 1.0), $MachinePrecision] * N[(-0.5 + N[(0.5 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 + N[(0.5 / eps$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 22000.0], N[(1.0 + N[(x * N[(N[(N[(eps$95$m + -1.0), $MachinePrecision] * t$95$1), $MachinePrecision] + N[(N[(0.5 + N[(eps$95$m * N[(N[(x * -0.5), $MachinePrecision] + N[(eps$95$m * N[(-0.5 + N[(0.5 * N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.15e+159], N[(N[(1.0 + N[(N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(x * N[(t$95$0 + N[(0.5 * N[(x * N[(N[(t$95$1 * N[(N[(eps$95$m + -1.0), $MachinePrecision] * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 - eps$95$m), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x * N[(x * N[(eps$95$m * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := \left(eps\_m + 1\right) \cdot \left(-0.5 + \frac{0.5}{eps\_m}\right)\\
t_1 := 0.5 + \frac{0.5}{eps\_m}\\
\mathbf{if}\;x \leq 22000:\\
\;\;\;\;1 + x \cdot \left(\left(eps\_m + -1\right) \cdot t\_1 + \frac{0.5 + eps\_m \cdot \left(x \cdot -0.5 + eps\_m \cdot \left(-0.5 + 0.5 \cdot \left(x \cdot eps\_m\right)\right)\right)}{eps\_m}\right)\\
\mathbf{elif}\;x \leq 2.15 \cdot 10^{+159}:\\
\;\;\;\;\left(1 + \left(x \cdot \left(eps\_m + -1\right)\right) \cdot t\_1\right) + x \cdot \left(t\_0 + 0.5 \cdot \left(x \cdot \left(t\_1 \cdot \left(\left(eps\_m + -1\right) \cdot \left(eps\_m + -1\right)\right) + \left(-1 - eps\_m\right) \cdot t\_0\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \left(x \cdot \left(eps\_m \cdot eps\_m\right)\right)\right)\\
\end{array}
\end{array}
if x < 22000Initial program 63.8%
Simplified63.8%
Taylor expanded in x around 0
Simplified86.0%
Taylor expanded in eps around 0
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6488.6%
Simplified88.6%
if 22000 < x < 2.1500000000000001e159Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0
Simplified37.3%
Applied egg-rr73.2%
if 2.1500000000000001e159 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0
Simplified40.3%
Taylor expanded in eps around inf
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f6439.4%
Simplified39.4%
Taylor expanded in x around inf
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6467.3%
Simplified67.3%
Final simplification83.0%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 350.0)
(+
1.0
(*
x
(+
(* (+ eps_m -1.0) (+ 0.5 (/ 0.5 eps_m)))
(/
(+ 0.5 (* eps_m (+ (* x -0.5) (* eps_m (+ -0.5 (* 0.5 (* x eps_m)))))))
eps_m))))
(* 0.5 (* x (* x (* eps_m eps_m))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 350.0) {
tmp = 1.0 + (x * (((eps_m + -1.0) * (0.5 + (0.5 / eps_m))) + ((0.5 + (eps_m * ((x * -0.5) + (eps_m * (-0.5 + (0.5 * (x * eps_m))))))) / eps_m)));
} else {
tmp = 0.5 * (x * (x * (eps_m * eps_m)));
}
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 <= 350.0d0) then
tmp = 1.0d0 + (x * (((eps_m + (-1.0d0)) * (0.5d0 + (0.5d0 / eps_m))) + ((0.5d0 + (eps_m * ((x * (-0.5d0)) + (eps_m * ((-0.5d0) + (0.5d0 * (x * eps_m))))))) / eps_m)))
else
tmp = 0.5d0 * (x * (x * (eps_m * eps_m)))
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 350.0) {
tmp = 1.0 + (x * (((eps_m + -1.0) * (0.5 + (0.5 / eps_m))) + ((0.5 + (eps_m * ((x * -0.5) + (eps_m * (-0.5 + (0.5 * (x * eps_m))))))) / eps_m)));
} else {
tmp = 0.5 * (x * (x * (eps_m * eps_m)));
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 350.0: tmp = 1.0 + (x * (((eps_m + -1.0) * (0.5 + (0.5 / eps_m))) + ((0.5 + (eps_m * ((x * -0.5) + (eps_m * (-0.5 + (0.5 * (x * eps_m))))))) / eps_m))) else: tmp = 0.5 * (x * (x * (eps_m * eps_m))) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 350.0) tmp = Float64(1.0 + Float64(x * Float64(Float64(Float64(eps_m + -1.0) * Float64(0.5 + Float64(0.5 / eps_m))) + Float64(Float64(0.5 + Float64(eps_m * Float64(Float64(x * -0.5) + Float64(eps_m * Float64(-0.5 + Float64(0.5 * Float64(x * eps_m))))))) / eps_m)))); else tmp = Float64(0.5 * Float64(x * Float64(x * Float64(eps_m * eps_m)))); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 350.0) tmp = 1.0 + (x * (((eps_m + -1.0) * (0.5 + (0.5 / eps_m))) + ((0.5 + (eps_m * ((x * -0.5) + (eps_m * (-0.5 + (0.5 * (x * eps_m))))))) / eps_m))); else tmp = 0.5 * (x * (x * (eps_m * eps_m))); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 350.0], N[(1.0 + N[(x * N[(N[(N[(eps$95$m + -1.0), $MachinePrecision] * N[(0.5 + N[(0.5 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 + N[(eps$95$m * N[(N[(x * -0.5), $MachinePrecision] + N[(eps$95$m * N[(-0.5 + N[(0.5 * N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x * N[(x * N[(eps$95$m * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 350:\\
\;\;\;\;1 + x \cdot \left(\left(eps\_m + -1\right) \cdot \left(0.5 + \frac{0.5}{eps\_m}\right) + \frac{0.5 + eps\_m \cdot \left(x \cdot -0.5 + eps\_m \cdot \left(-0.5 + 0.5 \cdot \left(x \cdot eps\_m\right)\right)\right)}{eps\_m}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \left(x \cdot \left(eps\_m \cdot eps\_m\right)\right)\right)\\
\end{array}
\end{array}
if x < 350Initial program 63.6%
Simplified63.6%
Taylor expanded in x around 0
Simplified86.5%
Taylor expanded in eps around 0
/-lowering-/.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6489.1%
Simplified89.1%
if 350 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0
Simplified38.3%
Taylor expanded in eps around inf
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f6437.6%
Simplified37.6%
Taylor expanded in x around inf
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6463.5%
Simplified63.5%
Final simplification81.1%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 0.0018)
(+
1.0
(*
x
(+
-1.0
(*
0.5
(*
x
(+
(* x -0.3333333333333333)
(+ 1.0 (* eps_m (* eps_m (- 1.0 x))))))))))
(* 0.5 (* x (* x (* eps_m eps_m))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 0.0018) {
tmp = 1.0 + (x * (-1.0 + (0.5 * (x * ((x * -0.3333333333333333) + (1.0 + (eps_m * (eps_m * (1.0 - x)))))))));
} else {
tmp = 0.5 * (x * (x * (eps_m * eps_m)));
}
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.0018d0) then
tmp = 1.0d0 + (x * ((-1.0d0) + (0.5d0 * (x * ((x * (-0.3333333333333333d0)) + (1.0d0 + (eps_m * (eps_m * (1.0d0 - x)))))))))
else
tmp = 0.5d0 * (x * (x * (eps_m * eps_m)))
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.0018) {
tmp = 1.0 + (x * (-1.0 + (0.5 * (x * ((x * -0.3333333333333333) + (1.0 + (eps_m * (eps_m * (1.0 - x)))))))));
} else {
tmp = 0.5 * (x * (x * (eps_m * eps_m)));
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 0.0018: tmp = 1.0 + (x * (-1.0 + (0.5 * (x * ((x * -0.3333333333333333) + (1.0 + (eps_m * (eps_m * (1.0 - x))))))))) else: tmp = 0.5 * (x * (x * (eps_m * eps_m))) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 0.0018) tmp = Float64(1.0 + Float64(x * Float64(-1.0 + Float64(0.5 * Float64(x * Float64(Float64(x * -0.3333333333333333) + Float64(1.0 + Float64(eps_m * Float64(eps_m * Float64(1.0 - x)))))))))); else tmp = Float64(0.5 * Float64(x * Float64(x * Float64(eps_m * eps_m)))); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 0.0018) tmp = 1.0 + (x * (-1.0 + (0.5 * (x * ((x * -0.3333333333333333) + (1.0 + (eps_m * (eps_m * (1.0 - x))))))))); else tmp = 0.5 * (x * (x * (eps_m * eps_m))); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 0.0018], N[(1.0 + N[(x * N[(-1.0 + N[(0.5 * N[(x * N[(N[(x * -0.3333333333333333), $MachinePrecision] + N[(1.0 + N[(eps$95$m * N[(eps$95$m * N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x * N[(x * N[(eps$95$m * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.0018:\\
\;\;\;\;1 + x \cdot \left(-1 + 0.5 \cdot \left(x \cdot \left(x \cdot -0.3333333333333333 + \left(1 + eps\_m \cdot \left(eps\_m \cdot \left(1 - x\right)\right)\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \left(x \cdot \left(eps\_m \cdot eps\_m\right)\right)\right)\\
\end{array}
\end{array}
if x < 0.0018Initial program 63.2%
Simplified63.2%
Taylor expanded in eps around inf
cancel-sign-sub-invN/A
metadata-evalN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
exp-lowering-exp.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f6498.3%
Simplified98.3%
Taylor expanded in x around 0
Simplified51.6%
Taylor expanded in eps around 0
distribute-lft-outN/A
sub-negN/A
associate-+r+N/A
+-commutativeN/A
+-commutativeN/A
distribute-lft-inN/A
metadata-evalN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
Simplified87.6%
if 0.0018 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0
Simplified38.7%
Taylor expanded in eps around inf
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f6438.0%
Simplified38.0%
Taylor expanded in x around inf
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6463.3%
Simplified63.3%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (let* ((t_0 (* 0.5 (* x (* x (* eps_m eps_m)))))) (if (<= x -6.6e-15) t_0 (if (<= x 2.8e-15) 1.0 t_0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = 0.5 * (x * (x * (eps_m * eps_m)));
double tmp;
if (x <= -6.6e-15) {
tmp = t_0;
} else if (x <= 2.8e-15) {
tmp = 1.0;
} else {
tmp = t_0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * (x * (x * (eps_m * eps_m)))
if (x <= (-6.6d-15)) then
tmp = t_0
else if (x <= 2.8d-15) then
tmp = 1.0d0
else
tmp = t_0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = 0.5 * (x * (x * (eps_m * eps_m)));
double tmp;
if (x <= -6.6e-15) {
tmp = t_0;
} else if (x <= 2.8e-15) {
tmp = 1.0;
} else {
tmp = t_0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = 0.5 * (x * (x * (eps_m * eps_m))) tmp = 0 if x <= -6.6e-15: tmp = t_0 elif x <= 2.8e-15: tmp = 1.0 else: tmp = t_0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(0.5 * Float64(x * Float64(x * Float64(eps_m * eps_m)))) tmp = 0.0 if (x <= -6.6e-15) tmp = t_0; elseif (x <= 2.8e-15) tmp = 1.0; else tmp = t_0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = 0.5 * (x * (x * (eps_m * eps_m))); tmp = 0.0; if (x <= -6.6e-15) tmp = t_0; elseif (x <= 2.8e-15) tmp = 1.0; else tmp = t_0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(0.5 * N[(x * N[(x * N[(eps$95$m * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.6e-15], t$95$0, If[LessEqual[x, 2.8e-15], 1.0, t$95$0]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(x \cdot \left(x \cdot \left(eps\_m \cdot eps\_m\right)\right)\right)\\
\mathbf{if}\;x \leq -6.6 \cdot 10^{-15}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-15}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -6.6e-15 or 2.80000000000000014e-15 < x Initial program 96.9%
Simplified96.9%
Taylor expanded in x around 0
Simplified52.7%
Taylor expanded in eps around inf
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f6451.0%
Simplified51.0%
Taylor expanded in x around inf
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6467.3%
Simplified67.3%
if -6.6e-15 < x < 2.80000000000000014e-15Initial program 53.3%
Simplified53.4%
Taylor expanded in x around 0
Simplified70.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (let* ((t_0 (* x (* eps_m eps_m)))) (if (<= x 220.0) (+ 1.0 (* x (* 0.5 t_0))) (* 0.5 (* x t_0)))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = x * (eps_m * eps_m);
double tmp;
if (x <= 220.0) {
tmp = 1.0 + (x * (0.5 * t_0));
} else {
tmp = 0.5 * (x * t_0);
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: tmp
t_0 = x * (eps_m * eps_m)
if (x <= 220.0d0) then
tmp = 1.0d0 + (x * (0.5d0 * t_0))
else
tmp = 0.5d0 * (x * t_0)
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = x * (eps_m * eps_m);
double tmp;
if (x <= 220.0) {
tmp = 1.0 + (x * (0.5 * t_0));
} else {
tmp = 0.5 * (x * t_0);
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = x * (eps_m * eps_m) tmp = 0 if x <= 220.0: tmp = 1.0 + (x * (0.5 * t_0)) else: tmp = 0.5 * (x * t_0) return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(x * Float64(eps_m * eps_m)) tmp = 0.0 if (x <= 220.0) tmp = Float64(1.0 + Float64(x * Float64(0.5 * t_0))); else tmp = Float64(0.5 * Float64(x * t_0)); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = x * (eps_m * eps_m); tmp = 0.0; if (x <= 220.0) tmp = 1.0 + (x * (0.5 * t_0)); else tmp = 0.5 * (x * t_0); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(x * N[(eps$95$m * eps$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 220.0], N[(1.0 + N[(x * N[(0.5 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x * t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := x \cdot \left(eps\_m \cdot eps\_m\right)\\
\mathbf{if}\;x \leq 220:\\
\;\;\;\;1 + x \cdot \left(0.5 \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot t\_0\right)\\
\end{array}
\end{array}
if x < 220Initial program 63.6%
Simplified63.6%
Taylor expanded in x around 0
Simplified86.5%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6486.5%
Simplified86.5%
if 220 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0
Simplified38.3%
Taylor expanded in eps around inf
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f6437.6%
Simplified37.6%
Taylor expanded in x around inf
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6463.5%
Simplified63.5%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 57000.0) (- 1.0 x) (* 0.5 (* x (* x x)))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 57000.0) {
tmp = 1.0 - x;
} else {
tmp = 0.5 * (x * (x * x));
}
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 <= 57000.0d0) then
tmp = 1.0d0 - x
else
tmp = 0.5d0 * (x * (x * x))
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 57000.0) {
tmp = 1.0 - x;
} else {
tmp = 0.5 * (x * (x * x));
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 57000.0: tmp = 1.0 - x else: tmp = 0.5 * (x * (x * x)) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 57000.0) tmp = Float64(1.0 - x); else tmp = Float64(0.5 * Float64(x * Float64(x * x))); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 57000.0) tmp = 1.0 - x; else tmp = 0.5 * (x * (x * x)); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 57000.0], N[(1.0 - x), $MachinePrecision], N[(0.5 * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 57000:\\
\;\;\;\;1 - x\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \left(x \cdot x\right)\right)\\
\end{array}
\end{array}
if x < 57000Initial program 64.0%
Simplified64.0%
Taylor expanded in eps around inf
cancel-sign-sub-invN/A
metadata-evalN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-commutativeN/A
associate-*r*N/A
exp-lowering-exp.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f6498.3%
Simplified98.3%
Taylor expanded in x around 0
Simplified50.5%
Taylor expanded in x around 0
mul-1-negN/A
unsub-negN/A
--lowering--.f6453.3%
Simplified53.3%
if 57000 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0
distribute-lft-outN/A
distribute-lft-outN/A
distribute-rgt-out--N/A
metadata-evalN/A
*-rgt-identityN/A
distribute-rgt1-inN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f6457.1%
Simplified57.1%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f6426.5%
Simplified26.5%
Taylor expanded in x around inf
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6426.5%
Simplified26.5%
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 75.0%
Simplified75.0%
Taylor expanded in x around 0
Simplified37.9%
herbie shell --seed 2024156
(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))