\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\left(\sqrt[3]{\frac{x - y}{\mathsf{hypot}\left(x, y\right)} \cdot \frac{x + y}{\mathsf{hypot}\left(x, y\right)}} \cdot \sqrt[3]{\frac{x - y}{\mathsf{hypot}\left(x, y\right)} \cdot \frac{x + y}{\mathsf{hypot}\left(x, y\right)}}\right) \cdot \sqrt[3]{\frac{x - y}{\mathsf{hypot}\left(x, y\right)} \cdot \frac{x + y}{\mathsf{hypot}\left(x, y\right)}}double f(double x, double y) {
double r71444 = x;
double r71445 = y;
double r71446 = r71444 - r71445;
double r71447 = r71444 + r71445;
double r71448 = r71446 * r71447;
double r71449 = r71444 * r71444;
double r71450 = r71445 * r71445;
double r71451 = r71449 + r71450;
double r71452 = r71448 / r71451;
return r71452;
}
double f(double x, double y) {
double r71453 = x;
double r71454 = y;
double r71455 = r71453 - r71454;
double r71456 = hypot(r71453, r71454);
double r71457 = r71455 / r71456;
double r71458 = r71453 + r71454;
double r71459 = r71458 / r71456;
double r71460 = r71457 * r71459;
double r71461 = cbrt(r71460);
double r71462 = r71461 * r71461;
double r71463 = r71462 * r71461;
return r71463;
}




Bits error versus x




Bits error versus y
Results
| Original | 19.9 |
|---|---|
| Target | 0.1 |
| Herbie | 0.1 |
Initial program 19.9
rmApplied add-sqr-sqrt19.9
Applied times-frac20.0
Simplified20.0
Simplified0.0
rmApplied add-cube-cbrt0.1
Final simplification0.1
herbie shell --seed 2019323 +o rules:numerics
(FPCore (x y)
:name "Kahan p9 Example"
:precision binary64
:pre (and (< 0.0 x 1) (< y 1))
:herbie-target
(if (< 0.5 (fabs (/ x y)) 2) (/ (* (- x y) (+ x y)) (+ (* x x) (* y y))) (- 1 (/ 2 (+ 1 (* (/ x y) (/ x y))))))
(/ (* (- x y) (+ x y)) (+ (* x x) (* y y))))