
(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%
Taylor expanded in y around 0 96.9%
+-commutative96.9%
Simplified96.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%
Taylor expanded in y around 0 96.0%
+-commutative96.0%
Simplified96.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 (/ (- 1.0 z) (/ y x)))))
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(((1.0 - z) / (y / x)));
}
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(((1.0d0 - z) / (y / x)))
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(((1.0 - z) / (y / x)));
}
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(((1.0 - z) / (y / x))) 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(Float64(1.0 - z) / Float64(y / x))); 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(((1.0 - z) / (y / x))); 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[(N[(1.0 - z), $MachinePrecision] / N[(y / x), $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{1 - z}{\frac{y}{x}}\right|\\
\end{array}
\end{array}
if x < 1.15e14Initial program 91.6%
associate-*l/95.3%
associate-*r/91.3%
Simplified91.3%
Taylor expanded in y around 0 97.9%
+-commutative97.9%
Simplified97.9%
if 1.15e14 < x Initial program 81.1%
associate-*l/71.7%
associate-*r/83.9%
Simplified83.9%
Taylor expanded in y around 0 87.7%
+-commutative87.7%
Simplified87.7%
Taylor expanded in x around inf 87.7%
associate-/l*99.7%
Simplified99.7%
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 (/ y x))))))
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 / (y / x)));
}
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 / (y / x)))
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 / (y / x)));
}
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 / (y / x))) 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(y / x))); 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 / (y / x))); 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[(y / x), $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|\frac{z}{\frac{y}{x}}\right|\\
\end{array}
\end{array}
if x < -1.55000000000000004Initial program 87.8%
associate-*l/86.7%
associate-*r/92.4%
Simplified92.4%
Taylor expanded in y around 0 94.3%
+-commutative94.3%
Simplified94.3%
Taylor expanded in x around inf 91.8%
associate-/l*97.2%
Simplified97.2%
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%
associate-*r/47.0%
mul-1-neg47.0%
distribute-lft-neg-out47.0%
*-commutative47.0%
associate-*r/58.3%
Simplified58.3%
*-commutative58.3%
distribute-frac-neg58.3%
distribute-lft-neg-in58.3%
associate-/r/66.0%
distribute-neg-frac66.0%
add-sqr-sqrt31.6%
sqrt-unprod47.8%
sqr-neg47.8%
sqrt-unprod34.3%
add-sqr-sqrt66.0%
Applied egg-rr66.0%
Final simplification70.4%
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%
associate-*r/71.8%
mul-1-neg71.8%
distribute-lft-neg-out71.8%
*-commutative71.8%
associate-*r/82.0%
Simplified82.0%
clear-num81.9%
un-div-inv82.1%
add-sqr-sqrt81.9%
sqrt-unprod42.1%
sqr-neg42.1%
sqrt-unprod0.0%
add-sqr-sqrt82.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%
associate-*r/77.0%
mul-1-neg77.0%
distribute-lft-neg-out77.0%
*-commutative77.0%
associate-*r/82.3%
Simplified82.3%
clear-num82.2%
un-div-inv82.2%
add-sqr-sqrt0.0%
sqrt-unprod56.3%
sqr-neg56.3%
sqrt-unprod81.9%
add-sqr-sqrt82.2%
Applied egg-rr82.2%
clear-num82.2%
associate-/r/82.2%
clear-num82.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%
Taylor expanded in y around 0 91.4%
+-commutative91.4%
Simplified91.4%
Taylor expanded in x around inf 88.3%
associate-/l*96.6%
Simplified96.6%
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))))