\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 r240709 = x_re;
double r240710 = r240709 * r240709;
double r240711 = x_im;
double r240712 = r240711 * r240711;
double r240713 = r240710 - r240712;
double r240714 = r240713 * r240711;
double r240715 = r240709 * r240711;
double r240716 = r240711 * r240709;
double r240717 = r240715 + r240716;
double r240718 = r240717 * r240709;
double r240719 = r240714 + r240718;
return r240719;
}
double f(double x_re, double x_im) {
double r240720 = 3.0;
double r240721 = x_im;
double r240722 = r240720 * r240721;
double r240723 = x_re;
double r240724 = r240722 * r240723;
double r240725 = r240724 * r240723;
double r240726 = pow(r240721, r240720);
double r240727 = r240725 - r240726;
return r240727;
}




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