\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.re\right) \cdot x.im, {x.re}^{3}\right)double f(double x_re, double x_im) {
double r224341 = x_re;
double r224342 = r224341 * r224341;
double r224343 = x_im;
double r224344 = r224343 * r224343;
double r224345 = r224342 - r224344;
double r224346 = r224345 * r224341;
double r224347 = r224341 * r224343;
double r224348 = r224343 * r224341;
double r224349 = r224347 + r224348;
double r224350 = r224349 * r224343;
double r224351 = r224346 - r224350;
return r224351;
}
double f(double x_re, double x_im) {
double r224352 = x_im;
double r224353 = -3.0;
double r224354 = x_re;
double r224355 = r224353 * r224354;
double r224356 = r224355 * r224352;
double r224357 = 3.0;
double r224358 = pow(r224354, r224357);
double r224359 = fma(r224352, r224356, r224358);
return r224359;
}




Bits error versus x.re




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