\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 r119145 = x_re;
double r119146 = r119145 * r119145;
double r119147 = x_im;
double r119148 = r119147 * r119147;
double r119149 = r119146 - r119148;
double r119150 = r119149 * r119145;
double r119151 = r119145 * r119147;
double r119152 = r119147 * r119145;
double r119153 = r119151 + r119152;
double r119154 = r119153 * r119147;
double r119155 = r119150 - r119154;
return r119155;
}
double f(double x_re, double x_im) {
double r119156 = -3.0;
double r119157 = x_im;
double r119158 = x_re;
double r119159 = r119157 * r119158;
double r119160 = r119159 * r119157;
double r119161 = 3.0;
double r119162 = pow(r119158, r119161);
double r119163 = fma(r119156, r119160, r119162);
return r119163;
}




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 add-cube-cbrt0.2
Applied associate-*l*0.2
Taylor expanded around 0 7.1
Simplified0.2
Final simplification0.2
herbie shell --seed 2019303 +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)))