\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\sqrt[3]{\frac{1}{\mathsf{hypot}\left(y, x\right)} \cdot \left(\frac{y + x}{\mathsf{hypot}\left(y, x\right)} \cdot \left(x - y\right)\right)} \cdot \left(\sqrt[3]{\frac{1}{\mathsf{hypot}\left(y, x\right)} \cdot \left(\frac{y + x}{\mathsf{hypot}\left(y, x\right)} \cdot \left(x - y\right)\right)} \cdot \sqrt[3]{\frac{1}{\mathsf{hypot}\left(y, x\right)} \cdot \left(\frac{y + x}{\mathsf{hypot}\left(y, x\right)} \cdot \left(x - y\right)\right)}\right)double f(double x, double y) {
double r1425260 = x;
double r1425261 = y;
double r1425262 = r1425260 - r1425261;
double r1425263 = r1425260 + r1425261;
double r1425264 = r1425262 * r1425263;
double r1425265 = r1425260 * r1425260;
double r1425266 = r1425261 * r1425261;
double r1425267 = r1425265 + r1425266;
double r1425268 = r1425264 / r1425267;
return r1425268;
}
double f(double x, double y) {
double r1425269 = 1.0;
double r1425270 = y;
double r1425271 = x;
double r1425272 = hypot(r1425270, r1425271);
double r1425273 = r1425269 / r1425272;
double r1425274 = r1425270 + r1425271;
double r1425275 = r1425274 / r1425272;
double r1425276 = r1425271 - r1425270;
double r1425277 = r1425275 * r1425276;
double r1425278 = r1425273 * r1425277;
double r1425279 = cbrt(r1425278);
double r1425280 = r1425279 * r1425279;
double r1425281 = r1425279 * r1425280;
return r1425281;
}




Bits error versus x




Bits error versus y
Results
| Original | 19.8 |
|---|---|
| Target | 0.0 |
| Herbie | 0.1 |
Initial program 19.8
rmApplied clear-num19.8
Simplified19.8
rmApplied *-un-lft-identity19.8
Applied add-sqr-sqrt19.8
Applied times-frac20.0
Applied add-cube-cbrt20.0
Applied times-frac20.0
Simplified20.3
Simplified0.2
rmApplied add-cube-cbrt0.1
Final simplification0.1
herbie shell --seed 2019151 +o rules:numerics
(FPCore (x y)
:name "Kahan p9 Example"
:pre (and (< 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))))