
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / y) * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z): return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) / y) - ((x / y) * z))); end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / y) * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z): return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) / y) - ((x / y) * z))); end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\end{array}
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= y_m 4.8e+64) (fabs (/ (fma x z (- -4.0 x)) y_m)) (fabs (fma (- x) (/ z y_m) (/ (+ x 4.0) y_m)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (y_m <= 4.8e+64) {
tmp = fabs((fma(x, z, (-4.0 - x)) / y_m));
} else {
tmp = fabs(fma(-x, (z / y_m), ((x + 4.0) / y_m)));
}
return tmp;
}
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (y_m <= 4.8e+64) tmp = abs(Float64(fma(x, z, Float64(-4.0 - x)) / y_m)); else tmp = abs(fma(Float64(-x), Float64(z / y_m), Float64(Float64(x + 4.0) / y_m))); end return tmp end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := If[LessEqual[y$95$m, 4.8e+64], N[Abs[N[(N[(x * z + N[(-4.0 - x), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], N[Abs[N[((-x) * N[(z / y$95$m), $MachinePrecision] + N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 4.8 \cdot 10^{+64}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(x, z, -4 - x\right)}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\mathsf{fma}\left(-x, \frac{z}{y\_m}, \frac{x + 4}{y\_m}\right)\right|\\
\end{array}
\end{array}
if y < 4.79999999999999999e64Initial program 89.1%
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
neg-fabsN/A
lower-fabs.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
Applied egg-rr97.5%
if 4.79999999999999999e64 < y Initial program 96.8%
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-/.f6499.9
Applied egg-rr99.9%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (let* ((t_0 (- (/ (+ x 4.0) y_m) (* z (/ x y_m))))) (if (<= t_0 -1e+66) (fabs t_0) (fabs (/ (fma x z (- -4.0 x)) y_m)))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = ((x + 4.0) / y_m) - (z * (x / y_m));
double tmp;
if (t_0 <= -1e+66) {
tmp = fabs(t_0);
} else {
tmp = fabs((fma(x, z, (-4.0 - x)) / y_m));
}
return tmp;
}
y_m = abs(y) function code(x, y_m, z) t_0 = Float64(Float64(Float64(x + 4.0) / y_m) - Float64(z * Float64(x / y_m))) tmp = 0.0 if (t_0 <= -1e+66) tmp = abs(t_0); else tmp = abs(Float64(fma(x, z, Float64(-4.0 - x)) / y_m)); end return tmp end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := Block[{t$95$0 = N[(N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision] - N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+66], N[Abs[t$95$0], $MachinePrecision], N[Abs[N[(N[(x * z + N[(-4.0 - x), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \frac{x + 4}{y\_m} - z \cdot \frac{x}{y\_m}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+66}:\\
\;\;\;\;\left|t\_0\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(x, z, -4 - x\right)}{y\_m}\right|\\
\end{array}
\end{array}
if (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z)) < -9.99999999999999945e65Initial program 99.9%
if -9.99999999999999945e65 < (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z)) Initial program 88.3%
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
neg-fabsN/A
lower-fabs.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
Applied egg-rr97.5%
Final simplification98.1%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (* z (/ x y_m))))
(if (<= (- (/ (+ x 4.0) y_m) t_0) -1e+66)
(fabs (- (/ x y_m) t_0))
(fabs (/ (fma x z (- -4.0 x)) y_m)))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = z * (x / y_m);
double tmp;
if ((((x + 4.0) / y_m) - t_0) <= -1e+66) {
tmp = fabs(((x / y_m) - t_0));
} else {
tmp = fabs((fma(x, z, (-4.0 - x)) / y_m));
}
return tmp;
}
y_m = abs(y) function code(x, y_m, z) t_0 = Float64(z * Float64(x / y_m)) tmp = 0.0 if (Float64(Float64(Float64(x + 4.0) / y_m) - t_0) <= -1e+66) tmp = abs(Float64(Float64(x / y_m) - t_0)); else tmp = abs(Float64(fma(x, z, Float64(-4.0 - x)) / y_m)); end return tmp end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := Block[{t$95$0 = N[(z * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision] - t$95$0), $MachinePrecision], -1e+66], N[Abs[N[(N[(x / y$95$m), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(x * z + N[(-4.0 - x), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := z \cdot \frac{x}{y\_m}\\
\mathbf{if}\;\frac{x + 4}{y\_m} - t\_0 \leq -1 \cdot 10^{+66}:\\
\;\;\;\;\left|\frac{x}{y\_m} - t\_0\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(x, z, -4 - x\right)}{y\_m}\right|\\
\end{array}
\end{array}
if (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z)) < -9.99999999999999945e65Initial program 99.9%
Taylor expanded in x around inf
lower-/.f6473.5
Simplified73.5%
if -9.99999999999999945e65 < (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z)) Initial program 88.3%
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
neg-fabsN/A
lower-fabs.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
Applied egg-rr97.5%
Final simplification92.2%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (let* ((t_0 (fabs (/ (fma x z -4.0) y_m)))) (if (<= z -4.8e+14) t_0 (if (<= z 3.6e-11) (fabs (/ (+ x 4.0) y_m)) t_0))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = fabs((fma(x, z, -4.0) / y_m));
double tmp;
if (z <= -4.8e+14) {
tmp = t_0;
} else if (z <= 3.6e-11) {
tmp = fabs(((x + 4.0) / y_m));
} else {
tmp = t_0;
}
return tmp;
}
y_m = abs(y) function code(x, y_m, z) t_0 = abs(Float64(fma(x, z, -4.0) / y_m)) tmp = 0.0 if (z <= -4.8e+14) tmp = t_0; elseif (z <= 3.6e-11) tmp = abs(Float64(Float64(x + 4.0) / y_m)); else tmp = t_0; end return tmp end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := Block[{t$95$0 = N[Abs[N[(N[(x * z + -4.0), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, -4.8e+14], t$95$0, If[LessEqual[z, 3.6e-11], N[Abs[N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \left|\frac{\mathsf{fma}\left(x, z, -4\right)}{y\_m}\right|\\
\mathbf{if}\;z \leq -4.8 \cdot 10^{+14}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{-11}:\\
\;\;\;\;\left|\frac{x + 4}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -4.8e14 or 3.59999999999999985e-11 < z Initial program 86.5%
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
neg-fabsN/A
lower-fabs.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
Applied egg-rr92.1%
Taylor expanded in x around 0
Simplified92.1%
if -4.8e14 < z < 3.59999999999999985e-11Initial program 95.8%
Taylor expanded in z around 0
*-rgt-identityN/A
associate-*r/N/A
distribute-rgt-outN/A
associate-*l/N/A
metadata-evalN/A
associate-*r*N/A
associate-*r/N/A
neg-mul-1N/A
mul-1-negN/A
distribute-frac-negN/A
remove-double-negN/A
lower-/.f64N/A
lower-+.f6499.3
Simplified99.3%
Final simplification95.5%
y_m = (fabs.f64 y)
(FPCore (x y_m z)
:precision binary64
(let* ((t_0 (/ (fabs (* x z)) y_m)))
(if (<= z -3.4e+124)
t_0
(if (<= z 1.22e+70) (fabs (/ (+ x 4.0) y_m)) t_0))))y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = fabs((x * z)) / y_m;
double tmp;
if (z <= -3.4e+124) {
tmp = t_0;
} else if (z <= 1.22e+70) {
tmp = fabs(((x + 4.0) / y_m));
} else {
tmp = t_0;
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = abs((x * z)) / y_m
if (z <= (-3.4d+124)) then
tmp = t_0
else if (z <= 1.22d+70) then
tmp = abs(((x + 4.0d0) / y_m))
else
tmp = t_0
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double t_0 = Math.abs((x * z)) / y_m;
double tmp;
if (z <= -3.4e+124) {
tmp = t_0;
} else if (z <= 1.22e+70) {
tmp = Math.abs(((x + 4.0) / y_m));
} else {
tmp = t_0;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = math.fabs((x * z)) / y_m tmp = 0 if z <= -3.4e+124: tmp = t_0 elif z <= 1.22e+70: tmp = math.fabs(((x + 4.0) / y_m)) else: tmp = t_0 return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = Float64(abs(Float64(x * z)) / y_m) tmp = 0.0 if (z <= -3.4e+124) tmp = t_0; elseif (z <= 1.22e+70) tmp = abs(Float64(Float64(x + 4.0) / y_m)); else tmp = t_0; end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) t_0 = abs((x * z)) / y_m; tmp = 0.0; if (z <= -3.4e+124) tmp = t_0; elseif (z <= 1.22e+70) tmp = abs(((x + 4.0) / y_m)); else tmp = t_0; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := Block[{t$95$0 = N[(N[Abs[N[(x * z), $MachinePrecision]], $MachinePrecision] / y$95$m), $MachinePrecision]}, If[LessEqual[z, -3.4e+124], t$95$0, If[LessEqual[z, 1.22e+70], N[Abs[N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \frac{\left|x \cdot z\right|}{y\_m}\\
\mathbf{if}\;z \leq -3.4 \cdot 10^{+124}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.22 \cdot 10^{+70}:\\
\;\;\;\;\left|\frac{x + 4}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -3.4e124 or 1.22e70 < z Initial program 85.1%
Taylor expanded in z around inf
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower-*.f64N/A
lower-neg.f6475.3
Simplified75.3%
lift-*.f64N/A
lift-neg.f64N/A
div-fabsN/A
lift-neg.f64N/A
neg-fabsN/A
/-rgt-identityN/A
clear-numN/A
lift-/.f64N/A
fabs-divN/A
metadata-evalN/A
lift-/.f64N/A
inv-powN/A
sqr-powN/A
fabs-sqrN/A
sqr-powN/A
inv-powN/A
clear-numN/A
/-rgt-identityN/A
lower-/.f64N/A
lower-fabs.f6445.8
Applied egg-rr45.8%
if -3.4e124 < z < 1.22e70Initial program 94.3%
Taylor expanded in z around 0
*-rgt-identityN/A
associate-*r/N/A
distribute-rgt-outN/A
associate-*l/N/A
metadata-evalN/A
associate-*r*N/A
associate-*r/N/A
neg-mul-1N/A
mul-1-negN/A
distribute-frac-negN/A
remove-double-negN/A
lower-/.f64N/A
lower-+.f6492.1
Simplified92.1%
Final simplification74.9%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (let* ((t_0 (/ (fabs x) y_m))) (if (<= x -10.5) t_0 (if (<= x 4.0) (/ 4.0 y_m) t_0))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double t_0 = fabs(x) / y_m;
double tmp;
if (x <= -10.5) {
tmp = t_0;
} else if (x <= 4.0) {
tmp = 4.0 / y_m;
} else {
tmp = t_0;
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = abs(x) / y_m
if (x <= (-10.5d0)) then
tmp = t_0
else if (x <= 4.0d0) then
tmp = 4.0d0 / y_m
else
tmp = t_0
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
double t_0 = Math.abs(x) / y_m;
double tmp;
if (x <= -10.5) {
tmp = t_0;
} else if (x <= 4.0) {
tmp = 4.0 / y_m;
} else {
tmp = t_0;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z): t_0 = math.fabs(x) / y_m tmp = 0 if x <= -10.5: tmp = t_0 elif x <= 4.0: tmp = 4.0 / y_m else: tmp = t_0 return tmp
y_m = abs(y) function code(x, y_m, z) t_0 = Float64(abs(x) / y_m) tmp = 0.0 if (x <= -10.5) tmp = t_0; elseif (x <= 4.0) tmp = Float64(4.0 / y_m); else tmp = t_0; end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z) t_0 = abs(x) / y_m; tmp = 0.0; if (x <= -10.5) tmp = t_0; elseif (x <= 4.0) tmp = 4.0 / y_m; else tmp = t_0; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_] := Block[{t$95$0 = N[(N[Abs[x], $MachinePrecision] / y$95$m), $MachinePrecision]}, If[LessEqual[x, -10.5], t$95$0, If[LessEqual[x, 4.0], N[(4.0 / y$95$m), $MachinePrecision], t$95$0]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \frac{\left|x\right|}{y\_m}\\
\mathbf{if}\;x \leq -10.5:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4:\\
\;\;\;\;\frac{4}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -10.5 or 4 < x Initial program 85.8%
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
neg-fabsN/A
lower-fabs.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
Applied egg-rr91.7%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f6490.6
Simplified90.6%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f6463.6
Simplified63.6%
distribute-frac-negN/A
fabs-negN/A
div-invN/A
lift-/.f64N/A
mul-fabsN/A
lift-fabs.f64N/A
lift-/.f64N/A
inv-powN/A
sqr-powN/A
fabs-sqrN/A
sqr-powN/A
inv-powN/A
div-invN/A
lower-/.f6432.1
Applied egg-rr32.1%
if -10.5 < x < 4Initial program 96.0%
Taylor expanded in x around 0
lower-/.f6474.6
Simplified74.6%
div-invN/A
lift-/.f64N/A
fabs-mulN/A
metadata-evalN/A
lift-/.f64N/A
inv-powN/A
sqr-powN/A
fabs-sqrN/A
sqr-powN/A
inv-powN/A
div-invN/A
lift-/.f6440.2
Applied egg-rr40.2%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (fabs (/ (fma x z (- -4.0 x)) y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
return fabs((fma(x, z, (-4.0 - x)) / y_m));
}
y_m = abs(y) function code(x, y_m, z) return abs(Float64(fma(x, z, Float64(-4.0 - x)) / y_m)) end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := N[Abs[N[(N[(x * z + N[(-4.0 - x), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\left|\frac{\mathsf{fma}\left(x, z, -4 - x\right)}{y\_m}\right|
\end{array}
Initial program 90.9%
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
neg-fabsN/A
lower-fabs.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
Applied egg-rr95.8%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (fabs (/ (+ x 4.0) y_m)))
y_m = fabs(y);
double code(double x, double y_m, double z) {
return fabs(((x + 4.0) / y_m));
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = abs(((x + 4.0d0) / y_m))
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
return Math.abs(((x + 4.0) / y_m));
}
y_m = math.fabs(y) def code(x, y_m, z): return math.fabs(((x + 4.0) / y_m))
y_m = abs(y) function code(x, y_m, z) return abs(Float64(Float64(x + 4.0) / y_m)) end
y_m = abs(y); function tmp = code(x, y_m, z) tmp = abs(((x + 4.0) / y_m)); end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := N[Abs[N[(N[(x + 4.0), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\left|\frac{x + 4}{y\_m}\right|
\end{array}
Initial program 90.9%
Taylor expanded in z around 0
*-rgt-identityN/A
associate-*r/N/A
distribute-rgt-outN/A
associate-*l/N/A
metadata-evalN/A
associate-*r*N/A
associate-*r/N/A
neg-mul-1N/A
mul-1-negN/A
distribute-frac-negN/A
remove-double-negN/A
lower-/.f64N/A
lower-+.f6470.2
Simplified70.2%
Final simplification70.2%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (/ 4.0 y_m))
y_m = fabs(y);
double code(double x, double y_m, double z) {
return 4.0 / y_m;
}
y_m = abs(y)
real(8) function code(x, y_m, z)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = 4.0d0 / y_m
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z) {
return 4.0 / y_m;
}
y_m = math.fabs(y) def code(x, y_m, z): return 4.0 / y_m
y_m = abs(y) function code(x, y_m, z) return Float64(4.0 / y_m) end
y_m = abs(y); function tmp = code(x, y_m, z) tmp = 4.0 / y_m; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_] := N[(4.0 / y$95$m), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\frac{4}{y\_m}
\end{array}
Initial program 90.9%
Taylor expanded in x around 0
lower-/.f6440.0
Simplified40.0%
div-invN/A
lift-/.f64N/A
fabs-mulN/A
metadata-evalN/A
lift-/.f64N/A
inv-powN/A
sqr-powN/A
fabs-sqrN/A
sqr-powN/A
inv-powN/A
div-invN/A
lift-/.f6421.9
Applied egg-rr21.9%
herbie shell --seed 2024212
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))