\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 r193476 = x_re;
double r193477 = r193476 * r193476;
double r193478 = x_im;
double r193479 = r193478 * r193478;
double r193480 = r193477 - r193479;
double r193481 = r193480 * r193476;
double r193482 = r193476 * r193478;
double r193483 = r193478 * r193476;
double r193484 = r193482 + r193483;
double r193485 = r193484 * r193478;
double r193486 = r193481 - r193485;
return r193486;
}
double f(double x_re, double x_im) {
double r193487 = x_re;
double r193488 = 3.0;
double r193489 = pow(r193487, r193488);
double r193490 = x_im;
double r193491 = r193490 * r193487;
double r193492 = r193488 * r193491;
double r193493 = r193492 * r193490;
double r193494 = r193489 - r193493;
return r193494;
}




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