\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 r227494 = x_re;
double r227495 = r227494 * r227494;
double r227496 = x_im;
double r227497 = r227496 * r227496;
double r227498 = r227495 - r227497;
double r227499 = r227498 * r227496;
double r227500 = r227494 * r227496;
double r227501 = r227496 * r227494;
double r227502 = r227500 + r227501;
double r227503 = r227502 * r227494;
double r227504 = r227499 + r227503;
return r227504;
}
double f(double x_re, double x_im) {
double r227505 = 3.0;
double r227506 = x_im;
double r227507 = x_re;
double r227508 = r227506 * r227507;
double r227509 = r227505 * r227508;
double r227510 = r227509 * r227507;
double r227511 = pow(r227506, r227505);
double r227512 = r227510 - r227511;
return r227512;
}




Bits error versus x.re




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