\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 r244500 = x_re;
double r244501 = r244500 * r244500;
double r244502 = x_im;
double r244503 = r244502 * r244502;
double r244504 = r244501 - r244503;
double r244505 = r244504 * r244502;
double r244506 = r244500 * r244502;
double r244507 = r244502 * r244500;
double r244508 = r244506 + r244507;
double r244509 = r244508 * r244500;
double r244510 = r244505 + r244509;
return r244510;
}
double f(double x_re, double x_im) {
double r244511 = 3.0;
double r244512 = x_im;
double r244513 = x_re;
double r244514 = r244512 * r244513;
double r244515 = r244511 * r244514;
double r244516 = r244515 * r244513;
double r244517 = pow(r244512, r244511);
double r244518 = r244516 - r244517;
return r244518;
}




Bits error versus x.re




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