\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(\left(x.im \cdot 3\right) \cdot x.re\right) \cdot x.imdouble f(double x_re, double x_im) {
double r164593 = x_re;
double r164594 = r164593 * r164593;
double r164595 = x_im;
double r164596 = r164595 * r164595;
double r164597 = r164594 - r164596;
double r164598 = r164597 * r164593;
double r164599 = r164593 * r164595;
double r164600 = r164595 * r164593;
double r164601 = r164599 + r164600;
double r164602 = r164601 * r164595;
double r164603 = r164598 - r164602;
return r164603;
}
double f(double x_re, double x_im) {
double r164604 = x_re;
double r164605 = 3.0;
double r164606 = pow(r164604, r164605);
double r164607 = x_im;
double r164608 = r164607 * r164605;
double r164609 = r164608 * r164604;
double r164610 = r164609 * r164607;
double r164611 = r164606 - r164610;
return r164611;
}




Bits error versus x.re




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