\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 r200300 = x_re;
double r200301 = r200300 * r200300;
double r200302 = x_im;
double r200303 = r200302 * r200302;
double r200304 = r200301 - r200303;
double r200305 = r200304 * r200300;
double r200306 = r200300 * r200302;
double r200307 = r200302 * r200300;
double r200308 = r200306 + r200307;
double r200309 = r200308 * r200302;
double r200310 = r200305 - r200309;
return r200310;
}
double f(double x_re, double x_im) {
double r200311 = x_re;
double r200312 = 3.0;
double r200313 = pow(r200311, r200312);
double r200314 = x_im;
double r200315 = r200314 * r200311;
double r200316 = r200312 * r200315;
double r200317 = r200316 * r200314;
double r200318 = r200313 - r200317;
return r200318;
}




Bits error versus x.re




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