\frac{x + y}{1 - \frac{y}{z}}\frac{1}{\frac{1}{x + y} - \frac{\frac{y}{x + y}}{z}}double f(double x, double y, double z) {
double r366944 = x;
double r366945 = y;
double r366946 = r366944 + r366945;
double r366947 = 1.0;
double r366948 = z;
double r366949 = r366945 / r366948;
double r366950 = r366947 - r366949;
double r366951 = r366946 / r366950;
return r366951;
}
double f(double x, double y, double z) {
double r366952 = 1.0;
double r366953 = 1.0;
double r366954 = x;
double r366955 = y;
double r366956 = r366954 + r366955;
double r366957 = r366953 / r366956;
double r366958 = r366955 / r366956;
double r366959 = z;
double r366960 = r366958 / r366959;
double r366961 = r366957 - r366960;
double r366962 = r366952 / r366961;
return r366962;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 7.6 |
|---|---|
| Target | 4.1 |
| Herbie | 1.5 |
Initial program 7.6
rmApplied clear-num7.8
rmApplied div-sub7.8
Simplified6.7
rmApplied associate-/r*1.5
Final simplification1.5
herbie shell --seed 2019322
(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))))