\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
{x.re}^{3} - \left(\left(x.im \cdot 3\right) \cdot x.re\right) \cdot x.imdouble f(double x_re, double x_im) {
double r119913 = x_re;
double r119914 = r119913 * r119913;
double r119915 = x_im;
double r119916 = r119915 * r119915;
double r119917 = r119914 - r119916;
double r119918 = r119917 * r119913;
double r119919 = r119913 * r119915;
double r119920 = r119915 * r119913;
double r119921 = r119919 + r119920;
double r119922 = r119921 * r119915;
double r119923 = r119918 - r119922;
return r119923;
}
double f(double x_re, double x_im) {
double r119924 = x_re;
double r119925 = 3.0;
double r119926 = pow(r119924, r119925);
double r119927 = x_im;
double r119928 = r119927 * r119925;
double r119929 = r119928 * r119924;
double r119930 = r119929 * r119927;
double r119931 = r119926 - r119930;
return r119931;
}




Bits error versus x.re




Bits error versus x.im
Results
| Original | 7.3 |
|---|---|
| Target | 0.3 |
| Herbie | 0.2 |
Initial program 7.3
Simplified0.2
rmApplied associate-*r*0.2
rmApplied associate-*r*0.2
Simplified0.2
Final simplification0.2
herbie shell --seed 2019306
(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)))