\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(x.re, \left(x.im \cdot 3\right) \cdot x.re, -{x.im}^{3}\right)double f(double x_re, double x_im) {
double r174775 = x_re;
double r174776 = r174775 * r174775;
double r174777 = x_im;
double r174778 = r174777 * r174777;
double r174779 = r174776 - r174778;
double r174780 = r174779 * r174777;
double r174781 = r174775 * r174777;
double r174782 = r174777 * r174775;
double r174783 = r174781 + r174782;
double r174784 = r174783 * r174775;
double r174785 = r174780 + r174784;
return r174785;
}
double f(double x_re, double x_im) {
double r174786 = x_re;
double r174787 = x_im;
double r174788 = 3.0;
double r174789 = r174787 * r174788;
double r174790 = r174789 * r174786;
double r174791 = pow(r174787, r174788);
double r174792 = -r174791;
double r174793 = fma(r174786, r174790, r174792);
return r174793;
}




Bits error versus x.re




Bits error versus x.im
| Original | 7.6 |
|---|---|
| Target | 0.3 |
| Herbie | 0.2 |
Initial program 7.6
Simplified0.2
rmApplied *-un-lft-identity0.2
Applied associate-*l*0.2
Simplified0.2
Final simplification0.2
herbie shell --seed 2019212 +o rules:numerics
(FPCore (x.re x.im)
:name "math.cube on complex, imaginary part"
:precision binary64
:herbie-target
(+ (* (* x.re x.im) (* 2 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)))