\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 r68317 = x;
double r68318 = y;
double r68319 = r68317 - r68318;
double r68320 = r68317 + r68318;
double r68321 = r68319 * r68320;
double r68322 = r68317 * r68317;
double r68323 = r68318 * r68318;
double r68324 = r68322 + r68323;
double r68325 = r68321 / r68324;
return r68325;
}
double f(double x, double y) {
double r68326 = x;
double r68327 = y;
double r68328 = r68326 - r68327;
double r68329 = hypot(r68326, r68327);
double r68330 = r68328 / r68329;
double r68331 = r68326 + r68327;
double r68332 = r68331 / r68329;
double r68333 = r68330 * r68332;
double r68334 = cbrt(r68333);
double r68335 = r68334 * r68334;
double r68336 = r68335 * r68334;
return r68336;
}




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))))