\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 r261393 = x_re;
double r261394 = r261393 * r261393;
double r261395 = x_im;
double r261396 = r261395 * r261395;
double r261397 = r261394 - r261396;
double r261398 = r261397 * r261395;
double r261399 = r261393 * r261395;
double r261400 = r261395 * r261393;
double r261401 = r261399 + r261400;
double r261402 = r261401 * r261393;
double r261403 = r261398 + r261402;
return r261403;
}
double f(double x_re, double x_im) {
double r261404 = 3.0;
double r261405 = x_im;
double r261406 = x_re;
double r261407 = r261405 * r261406;
double r261408 = r261404 * r261407;
double r261409 = r261408 * r261406;
double r261410 = pow(r261405, r261404);
double r261411 = r261409 - r261410;
return r261411;
}




Bits error versus x.re




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