\frac{x + y}{1 - \frac{y}{z}}\begin{array}{l}
\mathbf{if}\;z \le -2.4417521594819806 \cdot 10^{43} \lor \neg \left(z \le 3.7392905468169088 \cdot 10^{57}\right):\\
\;\;\;\;\left(x + y\right) \cdot \frac{1}{1 - \frac{y}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1}{x + y} - \frac{y}{z \cdot \left(x + y\right)}}\\
\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 (((z <= -2.4417521594819806e+43) || !(z <= 3.739290546816909e+57))) {
VAR = ((double) (((double) (x + y)) * ((double) (1.0 / ((double) (1.0 - ((double) (y / z))))))));
} else {
VAR = ((double) (1.0 / ((double) (((double) (1.0 / ((double) (x + y)))) - ((double) (y / ((double) (z * ((double) (x + y))))))))));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.7 |
|---|---|
| Target | 4.2 |
| Herbie | 2.6 |
if z < -2.4417521594819806e43 or 3.7392905468169088e57 < z Initial program 0.0
rmApplied div-inv0.1
if -2.4417521594819806e43 < z < 3.7392905468169088e57Initial program 13.0
rmApplied clear-num13.2
rmApplied div-sub13.2
Simplified13.2
Simplified4.4
Final simplification2.6
herbie shell --seed 2020179
(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))))