\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 r170423 = x_re;
double r170424 = r170423 * r170423;
double r170425 = x_im;
double r170426 = r170425 * r170425;
double r170427 = r170424 - r170426;
double r170428 = r170427 * r170423;
double r170429 = r170423 * r170425;
double r170430 = r170425 * r170423;
double r170431 = r170429 + r170430;
double r170432 = r170431 * r170425;
double r170433 = r170428 - r170432;
return r170433;
}
double f(double x_re, double x_im) {
double r170434 = x_re;
double r170435 = 3.0;
double r170436 = pow(r170434, r170435);
double r170437 = x_im;
double r170438 = r170437 * r170435;
double r170439 = r170434 * r170437;
double r170440 = r170438 * r170439;
double r170441 = r170436 - r170440;
return r170441;
}




Bits error versus x.re




Bits error versus x.im
Results
| Original | 7.2 |
|---|---|
| Target | 0.2 |
| 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 2019303
(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)))