\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 r119043 = x_re;
double r119044 = r119043 * r119043;
double r119045 = x_im;
double r119046 = r119045 * r119045;
double r119047 = r119044 - r119046;
double r119048 = r119047 * r119043;
double r119049 = r119043 * r119045;
double r119050 = r119045 * r119043;
double r119051 = r119049 + r119050;
double r119052 = r119051 * r119045;
double r119053 = r119048 - r119052;
return r119053;
}
double f(double x_re, double x_im) {
double r119054 = x_re;
double r119055 = 3.0;
double r119056 = pow(r119054, r119055);
double r119057 = x_im;
double r119058 = r119057 * r119055;
double r119059 = r119058 * r119054;
double r119060 = r119059 * r119057;
double r119061 = r119056 - r119060;
return r119061;
}




Bits error versus x.re




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