\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(-3, \left(x.im \cdot x.re\right) \cdot x.im, {x.re}^{3}\right)double f(double x_re, double x_im) {
double r109282 = x_re;
double r109283 = r109282 * r109282;
double r109284 = x_im;
double r109285 = r109284 * r109284;
double r109286 = r109283 - r109285;
double r109287 = r109286 * r109282;
double r109288 = r109282 * r109284;
double r109289 = r109284 * r109282;
double r109290 = r109288 + r109289;
double r109291 = r109290 * r109284;
double r109292 = r109287 - r109291;
return r109292;
}
double f(double x_re, double x_im) {
double r109293 = -3.0;
double r109294 = x_im;
double r109295 = x_re;
double r109296 = r109294 * r109295;
double r109297 = r109296 * r109294;
double r109298 = 3.0;
double r109299 = pow(r109295, r109298);
double r109300 = fma(r109293, r109297, r109299);
return r109300;
}




Bits error versus x.re




Bits error versus x.im
| Original | 7.6 |
|---|---|
| Target | 0.2 |
| Herbie | 0.2 |
Initial program 7.6
Simplified0.2
rmApplied add-cube-cbrt0.2
Applied associate-*l*0.2
Taylor expanded around 0 7.5
Simplified0.2
Final simplification0.2
herbie shell --seed 2019347 +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)))