\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(x.im \cdot 3\right) \cdot \left(x.re \cdot x.im\right)double f(double x_re, double x_im) {
double r168675 = x_re;
double r168676 = r168675 * r168675;
double r168677 = x_im;
double r168678 = r168677 * r168677;
double r168679 = r168676 - r168678;
double r168680 = r168679 * r168675;
double r168681 = r168675 * r168677;
double r168682 = r168677 * r168675;
double r168683 = r168681 + r168682;
double r168684 = r168683 * r168677;
double r168685 = r168680 - r168684;
return r168685;
}
double f(double x_re, double x_im) {
double r168686 = x_re;
double r168687 = 3.0;
double r168688 = pow(r168686, r168687);
double r168689 = x_im;
double r168690 = r168689 * r168687;
double r168691 = r168686 * r168689;
double r168692 = r168690 * r168691;
double r168693 = r168688 - r168692;
return r168693;
}




Bits error versus x.re




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