\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 r881 = x_re;
double r882 = r881 * r881;
double r883 = x_im;
double r884 = r883 * r883;
double r885 = r882 - r884;
double r886 = r885 * r883;
double r887 = r881 * r883;
double r888 = r883 * r881;
double r889 = r887 + r888;
double r890 = r889 * r881;
double r891 = r886 + r890;
return r891;
}
double f(double x_re, double x_im) {
double r892 = 3.0;
double r893 = x_im;
double r894 = x_re;
double r895 = r893 * r894;
double r896 = r892 * r895;
double r897 = r896 * r894;
double r898 = pow(r893, r892);
double r899 = r897 - r898;
return r899;
}




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)))