\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 r246355 = x_re;
double r246356 = r246355 * r246355;
double r246357 = x_im;
double r246358 = r246357 * r246357;
double r246359 = r246356 - r246358;
double r246360 = r246359 * r246355;
double r246361 = r246355 * r246357;
double r246362 = r246357 * r246355;
double r246363 = r246361 + r246362;
double r246364 = r246363 * r246357;
double r246365 = r246360 - r246364;
return r246365;
}
double f(double x_re, double x_im) {
double r246366 = x_re;
double r246367 = 3.0;
double r246368 = pow(r246366, r246367);
double r246369 = x_im;
double r246370 = r246369 * r246366;
double r246371 = r246367 * r246370;
double r246372 = r246371 * r246369;
double r246373 = r246368 - r246372;
return r246373;
}




Bits error versus x.re




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