\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y
\mathsf{fma}\left(\sqrt{\left(x \cdot x + y \cdot y\right) + y \cdot y}, \sqrt{\left(x \cdot x + y \cdot y\right) + y \cdot y}, y \cdot y\right)double f(double x, double y) {
double r596475 = x;
double r596476 = r596475 * r596475;
double r596477 = y;
double r596478 = r596477 * r596477;
double r596479 = r596476 + r596478;
double r596480 = r596479 + r596478;
double r596481 = r596480 + r596478;
return r596481;
}
double f(double x, double y) {
double r596482 = x;
double r596483 = r596482 * r596482;
double r596484 = y;
double r596485 = r596484 * r596484;
double r596486 = r596483 + r596485;
double r596487 = r596486 + r596485;
double r596488 = sqrt(r596487);
double r596489 = fma(r596488, r596488, r596485);
return r596489;
}




Bits error versus x




Bits error versus y
| Original | 0.1 |
|---|---|
| Target | 0.1 |
| Herbie | 0.2 |
Initial program 0.1
rmApplied add-sqr-sqrt0.2
Applied fma-def0.2
Final simplification0.2
herbie shell --seed 2020057 +o rules:numerics
(FPCore (x y)
:name "Linear.Quaternion:$c/ from linear-1.19.1.3, E"
:precision binary64
:herbie-target
(+ (* x x) (* y (+ y (+ y y))))
(+ (+ (+ (* x x) (* y y)) (* y y)) (* y y)))