\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 r301881 = x_re;
double r301882 = r301881 * r301881;
double r301883 = x_im;
double r301884 = r301883 * r301883;
double r301885 = r301882 - r301884;
double r301886 = r301885 * r301883;
double r301887 = r301881 * r301883;
double r301888 = r301883 * r301881;
double r301889 = r301887 + r301888;
double r301890 = r301889 * r301881;
double r301891 = r301886 + r301890;
return r301891;
}
double f(double x_re, double x_im) {
double r301892 = 3.0;
double r301893 = x_im;
double r301894 = x_re;
double r301895 = r301893 * r301894;
double r301896 = r301892 * r301895;
double r301897 = r301896 * r301894;
double r301898 = pow(r301893, r301892);
double r301899 = r301897 - r301898;
return r301899;
}




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)))