\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re
\left(3 \cdot \left(x.im \cdot x.re\right)\right) \cdot x.re - {x.im}^{3}double f(double x_re, double x_im) {
double r279865 = x_re;
double r279866 = r279865 * r279865;
double r279867 = x_im;
double r279868 = r279867 * r279867;
double r279869 = r279866 - r279868;
double r279870 = r279869 * r279867;
double r279871 = r279865 * r279867;
double r279872 = r279867 * r279865;
double r279873 = r279871 + r279872;
double r279874 = r279873 * r279865;
double r279875 = r279870 + r279874;
return r279875;
}
double f(double x_re, double x_im) {
double r279876 = 3.0;
double r279877 = x_im;
double r279878 = x_re;
double r279879 = r279877 * r279878;
double r279880 = r279876 * r279879;
double r279881 = r279880 * r279878;
double r279882 = pow(r279877, r279876);
double r279883 = r279881 - r279882;
return r279883;
}




Bits error versus x.re




Bits error versus x.im
Results
| Original | 7.7 |
|---|---|
| Target | 0.2 |
| Herbie | 0.2 |
Initial program 7.7
Simplified7.7
rmApplied associate-*r*0.2
rmApplied associate-*r*0.2
Final simplification0.2
herbie shell --seed 2020025 +o rules:numerics
(FPCore (x.re x.im)
:name "math.cube on complex, imaginary part"
:precision binary64
:herbie-target
(+ (* (* x.re x.im) (* 2 x.re)) (* (* x.im (- x.re x.im)) (+ x.re x.im)))
(+ (* (- (* x.re x.re) (* x.im x.im)) x.im) (* (+ (* x.re x.im) (* x.im x.re)) x.re)))