\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re
\mathsf{fma}\left(\left(x.re \cdot x.im\right) \cdot 3, x.re, -{x.im}^{3}\right)double f(double x_re, double x_im) {
double r363638 = x_re;
double r363639 = r363638 * r363638;
double r363640 = x_im;
double r363641 = r363640 * r363640;
double r363642 = r363639 - r363641;
double r363643 = r363642 * r363640;
double r363644 = r363638 * r363640;
double r363645 = r363640 * r363638;
double r363646 = r363644 + r363645;
double r363647 = r363646 * r363638;
double r363648 = r363643 + r363647;
return r363648;
}
double f(double x_re, double x_im) {
double r363649 = x_re;
double r363650 = x_im;
double r363651 = r363649 * r363650;
double r363652 = 3.0;
double r363653 = r363651 * r363652;
double r363654 = pow(r363650, r363652);
double r363655 = -r363654;
double r363656 = fma(r363653, r363649, r363655);
return r363656;
}




Bits error versus x.re




Bits error versus x.im
| Original | 7.5 |
|---|---|
| Target | 0.3 |
| Herbie | 0.2 |
Initial program 7.5
Simplified0.2
rmApplied associate-*r*0.2
rmApplied associate-*l*0.2
Simplified0.2
Final simplification0.2
herbie shell --seed 2019174 +o rules:numerics
(FPCore (x.re x.im)
:name "math.cube on complex, imaginary part"
:herbie-target
(+ (* (* x.re x.im) (* 2.0 x.re)) (* (* x.im (- x.re x.im)) (+ x.re x.im)))
(+ (* (- (* x.re x.re) (* x.im x.im)) x.im) (* (+ (* x.re x.im) (* x.im x.re)) x.re)))