\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{\mathsf{hypot}\left(x, \sqrt{2} \cdot y\right) \cdot \mathsf{hypot}\left(x, \sqrt{2} \cdot y\right)}, y \cdot y\right)double f(double x, double y) {
double r439457 = x;
double r439458 = r439457 * r439457;
double r439459 = y;
double r439460 = r439459 * r439459;
double r439461 = r439458 + r439460;
double r439462 = r439461 + r439460;
double r439463 = r439462 + r439460;
return r439463;
}
double f(double x, double y) {
double r439464 = x;
double r439465 = r439464 * r439464;
double r439466 = y;
double r439467 = r439466 * r439466;
double r439468 = r439465 + r439467;
double r439469 = r439468 + r439467;
double r439470 = sqrt(r439469);
double r439471 = 2.0;
double r439472 = sqrt(r439471);
double r439473 = r439472 * r439466;
double r439474 = hypot(r439464, r439473);
double r439475 = r439474 * r439474;
double r439476 = sqrt(r439475);
double r439477 = fma(r439470, r439476, r439467);
return r439477;
}




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
rmApplied add-sqr-sqrt0.2
Simplified0.2
Simplified0.2
Final simplification0.2
herbie shell --seed 2020024 +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)))