\frac{x + y}{1 - \frac{y}{z}}\begin{array}{l}
\mathbf{if}\;z \le -2.15796120366031069 \cdot 10^{-268} \lor \neg \left(z \le 2.55693185217176228 \cdot 10^{-243}\right):\\
\;\;\;\;\frac{1}{\frac{1}{x + y} - \frac{\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{x + y}}}{\sqrt[3]{x + y}} \cdot \frac{\frac{\sqrt[3]{y}}{z}}{\sqrt[3]{x + y}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1}{x + y} - \frac{y}{\left(x + y\right) \cdot 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 VAR;
if (((z <= -2.1579612036603107e-268) || !(z <= 2.5569318521717623e-243))) {
VAR = (1.0 / ((1.0 / (x + y)) - ((((cbrt(y) * cbrt(y)) / cbrt((x + y))) / cbrt((x + y))) * ((cbrt(y) / z) / cbrt((x + y))))));
} else {
VAR = (1.0 / ((1.0 / (x + y)) - (y / ((x + y) * z))));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.8 |
|---|---|
| Target | 4.1 |
| Herbie | 2.2 |
if z < -2.1579612036603107e-268 or 2.5569318521717623e-243 < z Initial program 5.9
rmApplied clear-num6.1
rmApplied div-sub6.1
rmApplied add-cube-cbrt6.5
Applied *-un-lft-identity6.5
Applied add-cube-cbrt6.3
Applied times-frac6.3
Applied times-frac1.2
Simplified1.2
if -2.1579612036603107e-268 < z < 2.5569318521717623e-243Initial program 27.1
rmApplied clear-num27.2
rmApplied div-sub27.3
rmApplied div-inv27.3
Applied associate-/l*12.6
Simplified12.6
Final simplification2.2
herbie shell --seed 2020106
(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))))