\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
-3 \cdot \left(\left(x.re \cdot x.im\right) \cdot x.im\right) + {x.re}^{3}double f(double x_re, double x_im) {
double r283880 = x_re;
double r283881 = r283880 * r283880;
double r283882 = x_im;
double r283883 = r283882 * r283882;
double r283884 = r283881 - r283883;
double r283885 = r283884 * r283880;
double r283886 = r283880 * r283882;
double r283887 = r283882 * r283880;
double r283888 = r283886 + r283887;
double r283889 = r283888 * r283882;
double r283890 = r283885 - r283889;
return r283890;
}
double f(double x_re, double x_im) {
double r283891 = -3.0;
double r283892 = x_re;
double r283893 = x_im;
double r283894 = r283892 * r283893;
double r283895 = r283894 * r283893;
double r283896 = r283891 * r283895;
double r283897 = 3.0;
double r283898 = pow(r283892, r283897);
double r283899 = r283896 + r283898;
return r283899;
}




Bits error versus x.re




Bits error versus x.im
Results
| Original | 7.3 |
|---|---|
| Target | 0.2 |
| Herbie | 0.2 |
Initial program 7.3
Simplified7.3
rmApplied distribute-lft-neg-in7.3
Applied associate-*r*0.2
rmApplied fma-udef0.2
Simplified0.2
rmApplied pow10.2
Final simplification0.2
herbie shell --seed 2020089 +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)))