\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
\left(-3 \cdot \left(x.re \cdot x.im\right)\right) \cdot x.im + {x.re}^{3}double f(double x_re, double x_im) {
double r293024 = x_re;
double r293025 = r293024 * r293024;
double r293026 = x_im;
double r293027 = r293026 * r293026;
double r293028 = r293025 - r293027;
double r293029 = r293028 * r293024;
double r293030 = r293024 * r293026;
double r293031 = r293026 * r293024;
double r293032 = r293030 + r293031;
double r293033 = r293032 * r293026;
double r293034 = r293029 - r293033;
return r293034;
}
double f(double x_re, double x_im) {
double r293035 = -3.0;
double r293036 = x_re;
double r293037 = x_im;
double r293038 = r293036 * r293037;
double r293039 = r293035 * r293038;
double r293040 = r293039 * r293037;
double r293041 = 3.0;
double r293042 = pow(r293036, r293041);
double r293043 = r293040 + r293042;
return r293043;
}




Bits error versus x.re




Bits error versus x.im
Results
| Original | 7.0 |
|---|---|
| Target | 0.2 |
| Herbie | 0.2 |
Initial program 7.0
Simplified6.9
rmApplied distribute-rgt-neg-in6.9
Applied associate-*r*0.2
rmApplied fma-udef0.2
Simplified0.2
rmApplied associate-*r*0.2
Final simplification0.2
herbie shell --seed 2020056 +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)))