\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
\left(\left(3 \cdot x.im\right) \cdot x.re\right) \cdot x.re - {x.im}^{3}double f(double x_re, double x_im) {
double r361844 = x_re;
double r361845 = r361844 * r361844;
double r361846 = x_im;
double r361847 = r361846 * r361846;
double r361848 = r361845 - r361847;
double r361849 = r361848 * r361846;
double r361850 = r361844 * r361846;
double r361851 = r361846 * r361844;
double r361852 = r361850 + r361851;
double r361853 = r361852 * r361844;
double r361854 = r361849 + r361853;
return r361854;
}
double f(double x_re, double x_im) {
double r361855 = 3.0;
double r361856 = x_im;
double r361857 = r361855 * r361856;
double r361858 = x_re;
double r361859 = r361857 * r361858;
double r361860 = r361859 * r361858;
double r361861 = pow(r361856, r361855);
double r361862 = r361860 - r361861;
return r361862;
}




Bits error versus x.re




Bits error versus x.im
Results
| Original | 7.4 |
|---|---|
| Target | 0.2 |
| Herbie | 0.2 |
Initial program 7.4
Simplified7.3
rmApplied associate-*r*0.2
rmApplied associate-*r*0.2
rmApplied associate-*r*0.2
Final simplification0.2
herbie shell --seed 2020056
(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)))