\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im
\left(-3 \cdot \left(x.re \cdot x.im\right)\right) \cdot x.im + {x.re}^{3}double f(double x_re, double x_im) {
double r235347 = x_re;
double r235348 = r235347 * r235347;
double r235349 = x_im;
double r235350 = r235349 * r235349;
double r235351 = r235348 - r235350;
double r235352 = r235351 * r235347;
double r235353 = r235347 * r235349;
double r235354 = r235349 * r235347;
double r235355 = r235353 + r235354;
double r235356 = r235355 * r235349;
double r235357 = r235352 - r235356;
return r235357;
}
double f(double x_re, double x_im) {
double r235358 = -3.0;
double r235359 = x_re;
double r235360 = x_im;
double r235361 = r235359 * r235360;
double r235362 = r235358 * r235361;
double r235363 = r235362 * r235360;
double r235364 = 3.0;
double r235365 = pow(r235359, r235364);
double r235366 = r235363 + r235365;
return r235366;
}




Bits error versus x.re




Bits error versus x.im
Results
| Original | 7.3 |
|---|---|
| Target | 0.2 |
| Herbie | 0.2 |
Initial program 7.3
Simplified7.2
rmApplied distribute-lft-neg-in7.2
Applied associate-*r*0.2
rmApplied fma-udef0.2
Simplified0.2
rmApplied associate-*r*0.2
Final simplification0.2
herbie shell --seed 2020002 +o rules:numerics
(FPCore (x.re x.im)
:name "math.cube on complex, real part"
:precision binary64
:herbie-target
(+ (* (* x.re x.re) (- x.re x.im)) (* (* x.re x.im) (- x.re (* 3 x.im))))
(- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im)))