\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 r609196 = x;
double r609197 = r609196 * r609196;
double r609198 = y;
double r609199 = r609198 * r609198;
double r609200 = r609197 + r609199;
double r609201 = r609200 + r609199;
double r609202 = r609201 + r609199;
return r609202;
}
double f(double x, double y) {
double r609203 = x;
double r609204 = r609203 * r609203;
double r609205 = y;
double r609206 = r609205 * r609205;
double r609207 = r609204 + r609206;
double r609208 = r609207 + r609206;
double r609209 = sqrt(r609208);
double r609210 = 2.0;
double r609211 = sqrt(r609210);
double r609212 = r609211 * r609205;
double r609213 = hypot(r609203, r609212);
double r609214 = r609213 * r609213;
double r609215 = sqrt(r609214);
double r609216 = fma(r609209, r609215, r609206);
return r609216;
}




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