\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im
\left(-3 \cdot \left(x.re \cdot x.im\right)\right) \cdot x.im + {x.re}^{3}double f(double x_re, double x_im) {
double r226355 = x_re;
double r226356 = r226355 * r226355;
double r226357 = x_im;
double r226358 = r226357 * r226357;
double r226359 = r226356 - r226358;
double r226360 = r226359 * r226355;
double r226361 = r226355 * r226357;
double r226362 = r226357 * r226355;
double r226363 = r226361 + r226362;
double r226364 = r226363 * r226357;
double r226365 = r226360 - r226364;
return r226365;
}
double f(double x_re, double x_im) {
double r226366 = -3.0;
double r226367 = x_re;
double r226368 = x_im;
double r226369 = r226367 * r226368;
double r226370 = r226366 * r226369;
double r226371 = r226370 * r226368;
double r226372 = 3.0;
double r226373 = pow(r226367, r226372);
double r226374 = r226371 + r226373;
return r226374;
}




Bits error versus x.re




Bits error versus x.im
Results
| Original | 7.3 |
|---|---|
| Target | 0.3 |
| Herbie | 0.2 |
Initial program 7.3
Simplified7.3
rmApplied distribute-rgt-neg-in7.3
Applied associate-*r*0.2
rmApplied fma-udef0.2
Simplified0.2
rmApplied associate-*r*0.2
Final simplification0.2
herbie shell --seed 2020035 +o rules:numerics
(FPCore (x.re x.im)
:name "math.cube on complex, real part"
:precision binary64
:herbie-target
(+ (* (* x.re x.re) (- x.re x.im)) (* (* x.re x.im) (- x.re (* 3 x.im))))
(- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im)))