\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 r217020 = x_re;
double r217021 = r217020 * r217020;
double r217022 = x_im;
double r217023 = r217022 * r217022;
double r217024 = r217021 - r217023;
double r217025 = r217024 * r217020;
double r217026 = r217020 * r217022;
double r217027 = r217022 * r217020;
double r217028 = r217026 + r217027;
double r217029 = r217028 * r217022;
double r217030 = r217025 - r217029;
return r217030;
}
double f(double x_re, double x_im) {
double r217031 = -3.0;
double r217032 = x_im;
double r217033 = x_re;
double r217034 = r217032 * r217033;
double r217035 = r217034 * r217032;
double r217036 = 3.0;
double r217037 = pow(r217033, r217036);
double r217038 = fma(r217031, r217035, r217037);
return r217038;
}




Bits error versus x.re




Bits error versus x.im
| Original | 7.3 |
|---|---|
| Target | 0.3 |
| Herbie | 0.2 |
Initial program 7.3
Simplified0.2
rmApplied associate-*r*0.2
Simplified0.2
rmApplied associate-*l*0.2
Taylor expanded around 0 7.3
Simplified0.2
Final simplification0.2
herbie shell --seed 2019198 +o rules:numerics
(FPCore (x.re x.im)
:name "math.cube on complex, real part"
:herbie-target
(+ (* (* x.re x.re) (- x.re x.im)) (* (* x.re x.im) (- x.re (* 3.0 x.im))))
(- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im)))