\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im
{x.re}^{3} - \left(3 \cdot \left(x.im \cdot x.re\right)\right) \cdot x.imdouble f(double x_re, double x_im) {
double r235708 = x_re;
double r235709 = r235708 * r235708;
double r235710 = x_im;
double r235711 = r235710 * r235710;
double r235712 = r235709 - r235711;
double r235713 = r235712 * r235708;
double r235714 = r235708 * r235710;
double r235715 = r235710 * r235708;
double r235716 = r235714 + r235715;
double r235717 = r235716 * r235710;
double r235718 = r235713 - r235717;
return r235718;
}
double f(double x_re, double x_im) {
double r235719 = x_re;
double r235720 = 3.0;
double r235721 = pow(r235719, r235720);
double r235722 = x_im;
double r235723 = r235722 * r235719;
double r235724 = r235720 * r235723;
double r235725 = r235724 * r235722;
double r235726 = r235721 - r235725;
return r235726;
}




Bits error versus x.re




Bits error versus x.im
Results
| Original | 7.1 |
|---|---|
| Target | 0.3 |
| Herbie | 0.2 |
Initial program 7.1
Simplified0.2
rmApplied associate-*r*0.2
rmApplied associate-*r*0.2
rmApplied associate-*l*0.2
Final simplification0.2
herbie shell --seed 2019354
(FPCore (x.re x.im)
:name "math.cube on complex, real part"
:precision binary64
:herbie-target
(+ (* (* x.re x.re) (- x.re x.im)) (* (* x.re x.im) (- x.re (* 3 x.im))))
(- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im)))