\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 r116990 = x_re;
double r116991 = r116990 * r116990;
double r116992 = x_im;
double r116993 = r116992 * r116992;
double r116994 = r116991 - r116993;
double r116995 = r116994 * r116990;
double r116996 = r116990 * r116992;
double r116997 = r116992 * r116990;
double r116998 = r116996 + r116997;
double r116999 = r116998 * r116992;
double r117000 = r116995 - r116999;
return r117000;
}
double f(double x_re, double x_im) {
double r117001 = x_re;
double r117002 = 3.0;
double r117003 = pow(r117001, r117002);
double r117004 = x_im;
double r117005 = r117004 * r117002;
double r117006 = r117005 * r117001;
double r117007 = r117006 * r117004;
double r117008 = r117003 - r117007;
return r117008;
}




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