\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re
\left(3 \cdot \left(x.im \cdot x.re\right)\right) \cdot x.re - {x.im}^{3}double f(double x_re, double x_im) {
double r230494 = x_re;
double r230495 = r230494 * r230494;
double r230496 = x_im;
double r230497 = r230496 * r230496;
double r230498 = r230495 - r230497;
double r230499 = r230498 * r230496;
double r230500 = r230494 * r230496;
double r230501 = r230496 * r230494;
double r230502 = r230500 + r230501;
double r230503 = r230502 * r230494;
double r230504 = r230499 + r230503;
return r230504;
}
double f(double x_re, double x_im) {
double r230505 = 3.0;
double r230506 = x_im;
double r230507 = x_re;
double r230508 = r230506 * r230507;
double r230509 = r230505 * r230508;
double r230510 = r230509 * r230507;
double r230511 = pow(r230506, r230505);
double r230512 = r230510 - r230511;
return r230512;
}




Bits error versus x.re




Bits error versus x.im
Results
| Original | 7.3 |
|---|---|
| Target | 0.2 |
| Herbie | 0.2 |
Initial program 7.3
Simplified7.2
rmApplied associate-*r*0.2
rmApplied associate-*r*0.2
Final simplification0.2
herbie shell --seed 2020035 +o rules:numerics
(FPCore (x.re x.im)
:name "math.cube on complex, imaginary part"
:precision binary64
:herbie-target
(+ (* (* x.re x.im) (* 2 x.re)) (* (* x.im (- x.re x.im)) (+ x.re x.im)))
(+ (* (- (* x.re x.re) (* x.im x.im)) x.im) (* (+ (* x.re x.im) (* x.im x.re)) x.re)))