\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(x.re \cdot \left(x.re \cdot x.im\right)\right) \cdot 3 - \left(x.im \cdot x.im\right) \cdot x.im
double f(double x_re, double x_im) {
double r8695536 = x_re;
double r8695537 = r8695536 * r8695536;
double r8695538 = x_im;
double r8695539 = r8695538 * r8695538;
double r8695540 = r8695537 - r8695539;
double r8695541 = r8695540 * r8695538;
double r8695542 = r8695536 * r8695538;
double r8695543 = r8695538 * r8695536;
double r8695544 = r8695542 + r8695543;
double r8695545 = r8695544 * r8695536;
double r8695546 = r8695541 + r8695545;
return r8695546;
}
double f(double x_re, double x_im) {
double r8695547 = x_re;
double r8695548 = x_im;
double r8695549 = r8695547 * r8695548;
double r8695550 = r8695547 * r8695549;
double r8695551 = 3.0;
double r8695552 = r8695550 * r8695551;
double r8695553 = r8695548 * r8695548;
double r8695554 = r8695553 * r8695548;
double r8695555 = r8695552 - r8695554;
return r8695555;
}




Bits error versus x.re




Bits error versus x.im
Results
| Original | 6.8 |
|---|---|
| Target | 0.2 |
| Herbie | 0.3 |
Initial program 6.8
Simplified6.8
rmApplied add-cube-cbrt7.5
Applied associate-*r*7.5
Taylor expanded around -inf 6.7
Simplified6.8
rmApplied associate-*r*0.3
Final simplification0.3
herbie shell --seed 2019143 +o rules:numerics
(FPCore (x.re x.im)
:name "math.cube on complex, imaginary part"
: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)))