
(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 7 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}
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= y 5e+67) (fabs (/ (- (+ x 4.0) (* x z)) y)) (fabs (- (/ (+ x 4.0) y) (/ x (/ y z))))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (y <= 5e+67) {
tmp = fabs((((x + 4.0) - (x * z)) / y));
} else {
tmp = fabs((((x + 4.0) / y) - (x / (y / z))));
}
return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 5d+67) then
tmp = abs((((x + 4.0d0) - (x * z)) / y))
else
tmp = abs((((x + 4.0d0) / y) - (x / (y / z))))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if (y <= 5e+67) {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
} else {
tmp = Math.abs((((x + 4.0) / y) - (x / (y / z))));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if y <= 5e+67: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) else: tmp = math.fabs((((x + 4.0) / y) - (x / (y / z)))) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if (y <= 5e+67) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); else tmp = abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(x / Float64(y / z)))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 5e+67) tmp = abs((((x + 4.0) - (x * z)) / y)); else tmp = abs((((x + 4.0) / y) - (x / (y / z)))); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[y, 5e+67], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5 \cdot 10^{+67}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x + 4}{y} - \frac{x}{\frac{y}{z}}\right|\\
\end{array}
\end{array}
if y < 4.99999999999999976e67Initial program 87.4%
associate-*l/89.3%
associate-*r/87.2%
Simplified87.2%
associate-*r/89.3%
sub-div96.9%
Applied egg-rr96.9%
if 4.99999999999999976e67 < y Initial program 95.1%
associate-*l/86.8%
associate-*r/99.9%
Simplified99.9%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Final simplification97.4%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= y 3.4e-106) (fabs (/ (- (+ x 4.0) (* x z)) y)) (fabs (- (/ (+ x 4.0) y) (* x (/ z y))))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (y <= 3.4e-106) {
tmp = fabs((((x + 4.0) - (x * z)) / y));
} else {
tmp = fabs((((x + 4.0) / y) - (x * (z / y))));
}
return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 3.4d-106) then
tmp = abs((((x + 4.0d0) - (x * z)) / y))
else
tmp = abs((((x + 4.0d0) / y) - (x * (z / y))))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if (y <= 3.4e-106) {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
} else {
tmp = Math.abs((((x + 4.0) / y) - (x * (z / y))));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if y <= 3.4e-106: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) else: tmp = math.fabs((((x + 4.0) / y) - (x * (z / y)))) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if (y <= 3.4e-106) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); else tmp = abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(x * Float64(z / y)))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 3.4e-106) tmp = abs((((x + 4.0) - (x * z)) / y)); else tmp = abs((((x + 4.0) / y) - (x * (z / y)))); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[y, 3.4e-106], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.4 \cdot 10^{-106}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x + 4}{y} - x \cdot \frac{z}{y}\right|\\
\end{array}
\end{array}
if y < 3.39999999999999982e-106Initial program 84.2%
associate-*l/86.6%
associate-*r/83.8%
Simplified83.8%
associate-*r/86.6%
sub-div96.0%
Applied egg-rr96.0%
if 3.39999999999999982e-106 < y Initial program 97.6%
associate-*l/93.4%
associate-*r/99.9%
Simplified99.9%
Final simplification97.4%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= x 1.15e+14) (fabs (/ (- (+ x 4.0) (* x z)) y)) (fabs (/ x (/ y (- 1.0 z))))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (x <= 1.15e+14) {
tmp = fabs((((x + 4.0) - (x * z)) / y));
} else {
tmp = fabs((x / (y / (1.0 - z))));
}
return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 1.15d+14) then
tmp = abs((((x + 4.0d0) - (x * z)) / y))
else
tmp = abs((x / (y / (1.0d0 - z))))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if (x <= 1.15e+14) {
tmp = Math.abs((((x + 4.0) - (x * z)) / y));
} else {
tmp = Math.abs((x / (y / (1.0 - z))));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if x <= 1.15e+14: tmp = math.fabs((((x + 4.0) - (x * z)) / y)) else: tmp = math.fabs((x / (y / (1.0 - z)))) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if (x <= 1.15e+14) tmp = abs(Float64(Float64(Float64(x + 4.0) - Float64(x * z)) / y)); else tmp = abs(Float64(x / Float64(y / Float64(1.0 - z)))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 1.15e+14) tmp = abs((((x + 4.0) - (x * z)) / y)); else tmp = abs((x / (y / (1.0 - z)))); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[x, 1.15e+14], N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x / N[(y / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.15 \cdot 10^{+14}:\\
\;\;\;\;\left|\frac{\left(x + 4\right) - x \cdot z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{\frac{y}{1 - z}}\right|\\
\end{array}
\end{array}
if x < 1.15e14Initial program 91.6%
associate-*l/95.3%
associate-*r/91.3%
Simplified91.3%
associate-*r/95.3%
sub-div97.9%
Applied egg-rr97.9%
if 1.15e14 < x Initial program 81.1%
associate-*l/71.7%
associate-*r/83.9%
Simplified83.9%
associate-*r/71.7%
sub-div87.7%
Applied egg-rr87.7%
Taylor expanded in x around inf 87.7%
associate-/l*99.9%
Simplified99.9%
Final simplification98.4%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= x -1.55) (fabs (/ x y)) (if (<= x 23.5) (fabs (/ 4.0 y)) (fabs (* z (/ x y))))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (x <= -1.55) {
tmp = fabs((x / y));
} else if (x <= 23.5) {
tmp = fabs((4.0 / y));
} else {
tmp = fabs((z * (x / y)));
}
return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-1.55d0)) then
tmp = abs((x / y))
else if (x <= 23.5d0) then
tmp = abs((4.0d0 / y))
else
tmp = abs((z * (x / y)))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.55) {
tmp = Math.abs((x / y));
} else if (x <= 23.5) {
tmp = Math.abs((4.0 / y));
} else {
tmp = Math.abs((z * (x / y)));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if x <= -1.55: tmp = math.fabs((x / y)) elif x <= 23.5: tmp = math.fabs((4.0 / y)) else: tmp = math.fabs((z * (x / y))) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if (x <= -1.55) tmp = abs(Float64(x / y)); elseif (x <= 23.5) tmp = abs(Float64(4.0 / y)); else tmp = abs(Float64(z * Float64(x / y))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.55) tmp = abs((x / y)); elseif (x <= 23.5) tmp = abs((4.0 / y)); else tmp = abs((z * (x / y))); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[x, -1.55], N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 23.5], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55:\\
\;\;\;\;\left|\frac{x}{y}\right|\\
\mathbf{elif}\;x \leq 23.5:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|z \cdot \frac{x}{y}\right|\\
\end{array}
\end{array}
if x < -1.55000000000000004Initial program 87.8%
associate-*l/86.7%
associate-*r/92.4%
Simplified92.4%
associate-*r/86.7%
sub-div94.3%
Applied egg-rr94.3%
Taylor expanded in x around inf 91.8%
associate-/l*97.4%
Simplified97.4%
Taylor expanded in z around 0 71.6%
if -1.55000000000000004 < x < 23.5Initial program 93.3%
associate-*l/99.9%
associate-*r/90.3%
Simplified90.3%
Taylor expanded in x around 0 72.4%
if 23.5 < x Initial program 82.4%
associate-*l/73.6%
associate-*r/85.0%
Simplified85.0%
Taylor expanded in z around inf 47.0%
mul-1-neg47.0%
associate-*r/58.3%
distribute-rgt-neg-out58.3%
Simplified58.3%
add-sqr-sqrt28.2%
sqrt-unprod53.2%
sqr-neg53.2%
sqrt-unprod30.2%
add-sqr-sqrt58.3%
associate-*r/47.0%
*-commutative47.0%
associate-/l*66.0%
Applied egg-rr66.0%
clear-num66.0%
associate-/r/67.2%
clear-num67.3%
Applied egg-rr67.3%
Final simplification70.7%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (<= z -8e+139) (fabs (/ x (/ y z))) (if (<= z 9.4e+30) (fabs (/ (- -4.0 x) y)) (fabs (* x (/ z y))))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if (z <= -8e+139) {
tmp = fabs((x / (y / z)));
} else if (z <= 9.4e+30) {
tmp = fabs(((-4.0 - x) / y));
} else {
tmp = fabs((x * (z / y)));
}
return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-8d+139)) then
tmp = abs((x / (y / z)))
else if (z <= 9.4d+30) then
tmp = abs((((-4.0d0) - x) / y))
else
tmp = abs((x * (z / y)))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if (z <= -8e+139) {
tmp = Math.abs((x / (y / z)));
} else if (z <= 9.4e+30) {
tmp = Math.abs(((-4.0 - x) / y));
} else {
tmp = Math.abs((x * (z / y)));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if z <= -8e+139: tmp = math.fabs((x / (y / z))) elif z <= 9.4e+30: tmp = math.fabs(((-4.0 - x) / y)) else: tmp = math.fabs((x * (z / y))) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if (z <= -8e+139) tmp = abs(Float64(x / Float64(y / z))); elseif (z <= 9.4e+30) tmp = abs(Float64(Float64(-4.0 - x) / y)); else tmp = abs(Float64(x * Float64(z / y))); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -8e+139) tmp = abs((x / (y / z))); elseif (z <= 9.4e+30) tmp = abs(((-4.0 - x) / y)); else tmp = abs((x * (z / y))); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[LessEqual[z, -8e+139], N[Abs[N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 9.4e+30], N[Abs[N[(N[(-4.0 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8 \cdot 10^{+139}:\\
\;\;\;\;\left|\frac{x}{\frac{y}{z}}\right|\\
\mathbf{elif}\;z \leq 9.4 \cdot 10^{+30}:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|x \cdot \frac{z}{y}\right|\\
\end{array}
\end{array}
if z < -8.00000000000000026e139Initial program 88.5%
associate-*l/84.2%
associate-*r/89.3%
Simplified89.3%
Taylor expanded in z around inf 71.8%
mul-1-neg71.8%
associate-*r/82.0%
distribute-rgt-neg-out82.0%
Simplified82.0%
add-sqr-sqrt34.7%
sqrt-unprod71.7%
sqr-neg71.7%
sqrt-unprod47.3%
add-sqr-sqrt82.0%
associate-*r/71.8%
*-commutative71.8%
associate-/l*73.7%
Applied egg-rr73.7%
clear-num73.8%
associate-/r/73.8%
clear-num76.3%
Applied egg-rr76.3%
associate-*l/71.8%
associate-/l*82.1%
Applied egg-rr82.1%
if -8.00000000000000026e139 < z < 9.39999999999999979e30Initial program 95.0%
Simplified98.8%
Taylor expanded in z around 0 91.9%
associate-*r/91.9%
distribute-lft-in91.9%
metadata-eval91.9%
neg-mul-191.9%
sub-neg91.9%
Simplified91.9%
if 9.39999999999999979e30 < z Initial program 71.8%
associate-*l/66.7%
associate-*r/68.4%
Simplified68.4%
Taylor expanded in z around inf 77.0%
mul-1-neg77.0%
associate-*r/82.3%
distribute-rgt-neg-out82.3%
Simplified82.3%
add-sqr-sqrt43.4%
sqrt-unprod69.0%
sqr-neg69.0%
sqrt-unprod38.6%
add-sqr-sqrt82.3%
associate-*r/77.0%
*-commutative77.0%
associate-/l*81.7%
Applied egg-rr81.7%
associate-/r/82.3%
Applied egg-rr82.3%
Final simplification88.3%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (if (or (<= x -1.55) (not (<= x 4.0))) (fabs (/ x y)) (fabs (/ 4.0 y))))
y = abs(y);
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.55) || !(x <= 4.0)) {
tmp = fabs((x / y));
} else {
tmp = fabs((4.0 / y));
}
return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= (-1.55d0)) .or. (.not. (x <= 4.0d0))) then
tmp = abs((x / y))
else
tmp = abs((4.0d0 / y))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.55) || !(x <= 4.0)) {
tmp = Math.abs((x / y));
} else {
tmp = Math.abs((4.0 / y));
}
return tmp;
}
y = abs(y) def code(x, y, z): tmp = 0 if (x <= -1.55) or not (x <= 4.0): tmp = math.fabs((x / y)) else: tmp = math.fabs((4.0 / y)) return tmp
y = abs(y) function code(x, y, z) tmp = 0.0 if ((x <= -1.55) || !(x <= 4.0)) tmp = abs(Float64(x / y)); else tmp = abs(Float64(4.0 / y)); end return tmp end
y = abs(y) function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.55) || ~((x <= 4.0))) tmp = abs((x / y)); else tmp = abs((4.0 / y)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_, z_] := If[Or[LessEqual[x, -1.55], N[Not[LessEqual[x, 4.0]], $MachinePrecision]], N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \lor \neg \left(x \leq 4\right):\\
\;\;\;\;\left|\frac{x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\end{array}
\end{array}
if x < -1.55000000000000004 or 4 < x Initial program 85.2%
associate-*l/80.1%
associate-*r/88.6%
Simplified88.6%
associate-*r/80.1%
sub-div91.4%
Applied egg-rr91.4%
Taylor expanded in x around inf 88.3%
associate-/l*96.8%
Simplified96.8%
Taylor expanded in z around 0 65.4%
if -1.55000000000000004 < x < 4Initial program 93.2%
associate-*l/99.9%
associate-*r/90.1%
Simplified90.1%
Taylor expanded in x around 0 73.4%
Final simplification69.0%
NOTE: y should be positive before calling this function (FPCore (x y z) :precision binary64 (fabs (/ 4.0 y)))
y = abs(y);
double code(double x, double y, double z) {
return fabs((4.0 / y));
}
NOTE: y should be positive before calling this function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((4.0d0 / y))
end function
y = Math.abs(y);
public static double code(double x, double y, double z) {
return Math.abs((4.0 / y));
}
y = abs(y) def code(x, y, z): return math.fabs((4.0 / y))
y = abs(y) function code(x, y, z) return abs(Float64(4.0 / y)) end
y = abs(y) function tmp = code(x, y, z) tmp = abs((4.0 / y)); end
NOTE: y should be positive before calling this function code[x_, y_, z_] := N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
y = |y|\\
\\
\left|\frac{4}{y}\right|
\end{array}
Initial program 88.7%
associate-*l/88.9%
associate-*r/89.3%
Simplified89.3%
Taylor expanded in x around 0 35.8%
Final simplification35.8%
herbie shell --seed 2023279
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))