\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
\mathsf{fma}\left(x.im, \left(-3 \cdot x.re\right) \cdot x.im, {x.re}^{3}\right)double f(double x_re, double x_im) {
double r248357 = x_re;
double r248358 = r248357 * r248357;
double r248359 = x_im;
double r248360 = r248359 * r248359;
double r248361 = r248358 - r248360;
double r248362 = r248361 * r248357;
double r248363 = r248357 * r248359;
double r248364 = r248359 * r248357;
double r248365 = r248363 + r248364;
double r248366 = r248365 * r248359;
double r248367 = r248362 - r248366;
return r248367;
}
double f(double x_re, double x_im) {
double r248368 = x_im;
double r248369 = -3.0;
double r248370 = x_re;
double r248371 = r248369 * r248370;
double r248372 = r248371 * r248368;
double r248373 = 3.0;
double r248374 = pow(r248370, r248373);
double r248375 = fma(r248368, r248372, r248374);
return r248375;
}




Bits error versus x.re




Bits error versus x.im
| Original | 7.9 |
|---|---|
| Target | 0.3 |
| Herbie | 0.2 |
Initial program 7.9
Simplified0.2
rmApplied associate-*r*0.2
Final simplification0.2
herbie shell --seed 2020046 +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)))