\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
\mathsf{fma}\left(x.im, \left(-3 \cdot x.im\right) \cdot x.re, {x.re}^{3}\right)double f(double x_re, double x_im) {
double r125424 = x_re;
double r125425 = r125424 * r125424;
double r125426 = x_im;
double r125427 = r125426 * r125426;
double r125428 = r125425 - r125427;
double r125429 = r125428 * r125424;
double r125430 = r125424 * r125426;
double r125431 = r125426 * r125424;
double r125432 = r125430 + r125431;
double r125433 = r125432 * r125426;
double r125434 = r125429 - r125433;
return r125434;
}
double f(double x_re, double x_im) {
double r125435 = x_im;
double r125436 = -3.0;
double r125437 = r125436 * r125435;
double r125438 = x_re;
double r125439 = r125437 * r125438;
double r125440 = 3.0;
double r125441 = pow(r125438, r125440);
double r125442 = fma(r125435, r125439, r125441);
return r125442;
}




Bits error versus x.re




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