\frac{x + y}{1 - \frac{y}{z}}\begin{array}{l}
\mathbf{if}\;\frac{x + y}{1 - \frac{y}{z}} \le -3.3763009443507461 \cdot 10^{-298} \lor \neg \left(\frac{x + y}{1 - \frac{y}{z}} \le -0.0\right):\\
\;\;\;\;\frac{x + y}{1 - \frac{y}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}}{\sqrt{1} + \frac{\sqrt{y}}{\sqrt{z}}} \cdot \frac{\sqrt[3]{x + y}}{\sqrt{1} - \frac{\sqrt{y}}{\sqrt{z}}}\\
\end{array}double code(double x, double y, double z) {
return ((x + y) / (1.0 - (y / z)));
}
double code(double x, double y, double z) {
double temp;
if (((((x + y) / (1.0 - (y / z))) <= -3.376300944350746e-298) || !(((x + y) / (1.0 - (y / z))) <= -0.0))) {
temp = ((x + y) / (1.0 - (y / z)));
} else {
temp = (((cbrt((x + y)) * cbrt((x + y))) / (sqrt(1.0) + (sqrt(y) / sqrt(z)))) * (cbrt((x + y)) / (sqrt(1.0) - (sqrt(y) / sqrt(z)))));
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.4 |
|---|---|
| Target | 3.9 |
| Herbie | 6.2 |
if (/ (+ x y) (- 1.0 (/ y z))) < -3.376300944350746e-298 or -0.0 < (/ (+ x y) (- 1.0 (/ y z))) Initial program 0.1
if -3.376300944350746e-298 < (/ (+ x y) (- 1.0 (/ y z))) < -0.0Initial program 59.3
rmApplied add-sqr-sqrt61.3
Applied add-sqr-sqrt62.6
Applied times-frac62.6
Applied add-sqr-sqrt62.6
Applied difference-of-squares62.6
Applied add-cube-cbrt62.6
Applied times-frac49.5
Final simplification6.2
herbie shell --seed 2020056 +o rules:numerics
(FPCore (x y z)
:name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, A"
:precision binary64
:herbie-target
(if (< y -3.7429310762689856e+171) (* (/ (+ y x) (- y)) z) (if (< y 3.5534662456086734e+168) (/ (+ x y) (- 1 (/ y z))) (* (/ (+ y x) (- y)) z)))
(/ (+ x y) (- 1 (/ y z))))