\frac{x + y}{1 - \frac{y}{z}}\begin{array}{l}
\mathbf{if}\;\frac{x + y}{1 - \frac{y}{z}} \le -3.17862314575898722 \cdot 10^{-295} \lor \neg \left(\frac{x + y}{1 - \frac{y}{z}} \le -0.0\right):\\
\;\;\;\;\frac{x + y}{1 - \frac{y}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1}{x + y} - y \cdot \frac{\frac{1}{z}}{x + y}}\\
\end{array}double code(double x, double y, double z) {
return ((double) (((double) (x + y)) / ((double) (1.0 - ((double) (y / z))))));
}
double code(double x, double y, double z) {
double VAR;
if (((((double) (((double) (x + y)) / ((double) (1.0 - ((double) (y / z)))))) <= -3.1786231457589872e-295) || !(((double) (((double) (x + y)) / ((double) (1.0 - ((double) (y / z)))))) <= -0.0))) {
VAR = ((double) (((double) (x + y)) / ((double) (1.0 - ((double) (y / z))))));
} else {
VAR = ((double) (1.0 / ((double) (((double) (1.0 / ((double) (x + y)))) - ((double) (y * ((double) (((double) (1.0 / z)) / ((double) (x + y))))))))));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.3 |
|---|---|
| Target | 4.1 |
| Herbie | 0.2 |
if (/ (+ x y) (- 1.0 (/ y z))) < -3.17862314575898722e-295 or -0.0 < (/ (+ x y) (- 1.0 (/ y z))) Initial program 0.1
if -3.17862314575898722e-295 < (/ (+ x y) (- 1.0 (/ y z))) < -0.0Initial program 59.2
rmApplied clear-num59.2
rmApplied div-sub59.2
rmApplied *-un-lft-identity59.2
Applied div-inv59.2
Applied times-frac0.9
Simplified0.9
Final simplification0.2
herbie shell --seed 2020161
(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) (neg y)) z) (if (< y 3.5534662456086734e+168) (/ (+ x y) (- 1.0 (/ y z))) (* (/ (+ y x) (neg y)) z)))
(/ (+ x y) (- 1.0 (/ y z))))