\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(3 \cdot \left(x.im \cdot x.re\right)\right) \cdot x.re - {x.im}^{3}double f(double x_re, double x_im) {
double r158875 = x_re;
double r158876 = r158875 * r158875;
double r158877 = x_im;
double r158878 = r158877 * r158877;
double r158879 = r158876 - r158878;
double r158880 = r158879 * r158877;
double r158881 = r158875 * r158877;
double r158882 = r158877 * r158875;
double r158883 = r158881 + r158882;
double r158884 = r158883 * r158875;
double r158885 = r158880 + r158884;
return r158885;
}
double f(double x_re, double x_im) {
double r158886 = 3.0;
double r158887 = x_im;
double r158888 = x_re;
double r158889 = r158887 * r158888;
double r158890 = r158886 * r158889;
double r158891 = r158890 * r158888;
double r158892 = pow(r158887, r158886);
double r158893 = r158891 - r158892;
return r158893;
}




Bits error versus x.re




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