\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 r289193 = x_re;
double r289194 = r289193 * r289193;
double r289195 = x_im;
double r289196 = r289195 * r289195;
double r289197 = r289194 - r289196;
double r289198 = r289197 * r289195;
double r289199 = r289193 * r289195;
double r289200 = r289195 * r289193;
double r289201 = r289199 + r289200;
double r289202 = r289201 * r289193;
double r289203 = r289198 + r289202;
return r289203;
}
double f(double x_re, double x_im) {
double r289204 = 3.0;
double r289205 = x_im;
double r289206 = x_re;
double r289207 = r289205 * r289206;
double r289208 = r289204 * r289207;
double r289209 = r289208 * r289206;
double r289210 = pow(r289205, r289204);
double r289211 = r289209 - r289210;
return r289211;
}




Bits error versus x.re




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