\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(-3, \left(x.im \cdot x.re\right) \cdot x.im, {x.re}^{3}\right)double f(double x_re, double x_im) {
double r96631 = x_re;
double r96632 = r96631 * r96631;
double r96633 = x_im;
double r96634 = r96633 * r96633;
double r96635 = r96632 - r96634;
double r96636 = r96635 * r96631;
double r96637 = r96631 * r96633;
double r96638 = r96633 * r96631;
double r96639 = r96637 + r96638;
double r96640 = r96639 * r96633;
double r96641 = r96636 - r96640;
return r96641;
}
double f(double x_re, double x_im) {
double r96642 = -3.0;
double r96643 = x_im;
double r96644 = x_re;
double r96645 = r96643 * r96644;
double r96646 = r96645 * r96643;
double r96647 = 3.0;
double r96648 = pow(r96644, r96647);
double r96649 = fma(r96642, r96646, r96648);
return r96649;
}




Bits error versus x.re




Bits error versus x.im
| Original | 7.2 |
|---|---|
| Target | 0.2 |
| Herbie | 0.2 |
Initial program 7.2
Simplified0.2
rmApplied add-cube-cbrt0.2
Applied associate-*l*0.2
Taylor expanded around 0 7.1
Simplified0.2
Final simplification0.2
herbie shell --seed 2019303 +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)))