
(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 8 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 2e-29) (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 <= 2e-29) {
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 <= 2e-29) 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, 2e-29], 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 2 \cdot 10^{-29}:\\
\;\;\;\;\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 < 1.99999999999999989e-29Initial program 85.6%
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 rewrites98.3%
if 1.99999999999999989e-29 < y Initial program 96.5%
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 rewrites99.9%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (if (<= x -5e+75) (fabs (/ (+ z -1.0) (/ y_m x))) (fabs (/ (fma x z (- -4.0 x)) y_m))))
y_m = fabs(y);
double code(double x, double y_m, double z) {
double tmp;
if (x <= -5e+75) {
tmp = fabs(((z + -1.0) / (y_m / x)));
} else {
tmp = fabs((fma(x, z, (-4.0 - x)) / y_m));
}
return tmp;
}
y_m = abs(y) function code(x, y_m, z) tmp = 0.0 if (x <= -5e+75) tmp = abs(Float64(Float64(z + -1.0) / Float64(y_m / x))); 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_] := If[LessEqual[x, -5e+75], N[Abs[N[(N[(z + -1.0), $MachinePrecision] / N[(y$95$m / x), $MachinePrecision]), $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}
\mathbf{if}\;x \leq -5 \cdot 10^{+75}:\\
\;\;\;\;\left|\frac{z + -1}{\frac{y\_m}{x}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\mathsf{fma}\left(x, z, -4 - x\right)}{y\_m}\right|\\
\end{array}
\end{array}
if x < -5.0000000000000002e75Initial program 89.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 rewrites84.2%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f6484.2
Applied rewrites84.2%
lift-*.f64N/A
unsub-negN/A
div-subN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l/N/A
associate-/r/N/A
lift-/.f64N/A
clear-numN/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
lower--.f6499.8
Applied rewrites99.8%
if -5.0000000000000002e75 < x Initial 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 rewrites98.1%
Final simplification98.4%
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 -1.45e+25) t_0 (if (<= z 0.16) (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 <= -1.45e+25) {
tmp = t_0;
} else if (z <= 0.16) {
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 <= -1.45e+25) tmp = t_0; elseif (z <= 0.16) 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, -1.45e+25], t$95$0, If[LessEqual[z, 0.16], 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 -1.45 \cdot 10^{+25}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.16:\\
\;\;\;\;\left|\frac{x + 4}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.44999999999999995e25 or 0.160000000000000003 < z Initial program 92.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 rewrites91.2%
Taylor expanded in x around 0
Applied rewrites91.2%
if -1.44999999999999995e25 < z < 0.160000000000000003Initial program 85.7%
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.5
Applied rewrites99.5%
Final simplification95.3%
y_m = (fabs.f64 y) (FPCore (x y_m z) :precision binary64 (let* ((t_0 (/ (fabs (* x z)) y_m))) (if (<= z -1.1e+43) t_0 (if (<= z 3.7e+98) (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 <= -1.1e+43) {
tmp = t_0;
} else if (z <= 3.7e+98) {
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 <= (-1.1d+43)) then
tmp = t_0
else if (z <= 3.7d+98) 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 <= -1.1e+43) {
tmp = t_0;
} else if (z <= 3.7e+98) {
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 <= -1.1e+43: tmp = t_0 elif z <= 3.7e+98: 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 <= -1.1e+43) tmp = t_0; elseif (z <= 3.7e+98) 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 <= -1.1e+43) tmp = t_0; elseif (z <= 3.7e+98) 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, -1.1e+43], t$95$0, If[LessEqual[z, 3.7e+98], 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 -1.1 \cdot 10^{+43}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{+98}:\\
\;\;\;\;\left|\frac{x + 4}{y\_m}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.1e43 or 3.6999999999999999e98 < z Initial program 92.6%
Taylor expanded in z around inf
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower-*.f64N/A
lower-neg.f6470.1
Applied rewrites70.1%
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.f6436.6
Applied rewrites36.6%
if -1.1e43 < z < 3.6999999999999999e98Initial program 86.5%
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-+.f6496.7
Applied rewrites96.7%
Final simplification70.6%
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 = abs(Float64(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[Abs[N[(x / y$95$m), $MachinePrecision]], $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 := \left|\frac{x}{y\_m}\right|\\
\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 81.7%
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 rewrites90.6%
Taylor expanded in x around inf
mul-1-negN/A
lower-neg.f6490.4
Applied rewrites90.4%
Taylor expanded in z around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6463.5
Applied rewrites63.5%
lift-neg.f64N/A
lift-/.f64N/A
lift-fabs.f6463.5
Applied rewrites63.5%
if -10.5 < x < 4Initial program 95.8%
Taylor expanded in x around 0
lower-/.f6471.1
Applied rewrites71.1%
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-/.f6438.4
Applied rewrites38.4%
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 89.2%
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 rewrites95.5%
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 89.2%
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-+.f6468.5
Applied rewrites68.5%
Final simplification68.5%
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 89.2%
Taylor expanded in x around 0
lower-/.f6439.9
Applied rewrites39.9%
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.6
Applied rewrites21.6%
herbie shell --seed 2024219
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))