\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(y, x\right)} \cdot \frac{x + y}{\mathsf{hypot}\left(y, x\right)}} \cdot \sqrt[3]{\frac{x - y}{\mathsf{hypot}\left(y, x\right)} \cdot \frac{x + y}{\mathsf{hypot}\left(y, x\right)}}\right) \cdot \sqrt[3]{\frac{x - y}{\mathsf{hypot}\left(y, x\right)} \cdot \frac{x + y}{\mathsf{hypot}\left(y, x\right)}}double f(double x, double y) {
double r79217 = x;
double r79218 = y;
double r79219 = r79217 - r79218;
double r79220 = r79217 + r79218;
double r79221 = r79219 * r79220;
double r79222 = r79217 * r79217;
double r79223 = r79218 * r79218;
double r79224 = r79222 + r79223;
double r79225 = r79221 / r79224;
return r79225;
}
double f(double x, double y) {
double r79226 = x;
double r79227 = y;
double r79228 = r79226 - r79227;
double r79229 = hypot(r79227, r79226);
double r79230 = r79228 / r79229;
double r79231 = r79226 + r79227;
double r79232 = r79231 / r79229;
double r79233 = r79230 * r79232;
double r79234 = cbrt(r79233);
double r79235 = r79234 * r79234;
double r79236 = r79235 * r79234;
return r79236;
}




Bits error versus x




Bits error versus y
Results
| Original | 19.9 |
|---|---|
| Target | 0.1 |
| Herbie | 0.1 |
Initial program 19.9
Simplified19.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))))