\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 r231035 = x_re;
double r231036 = r231035 * r231035;
double r231037 = x_im;
double r231038 = r231037 * r231037;
double r231039 = r231036 - r231038;
double r231040 = r231039 * r231035;
double r231041 = r231035 * r231037;
double r231042 = r231037 * r231035;
double r231043 = r231041 + r231042;
double r231044 = r231043 * r231037;
double r231045 = r231040 - r231044;
return r231045;
}
double f(double x_re, double x_im) {
double r231046 = x_re;
double r231047 = 3.0;
double r231048 = pow(r231046, r231047);
double r231049 = x_im;
double r231050 = r231049 * r231047;
double r231051 = r231050 * r231046;
double r231052 = r231051 * r231049;
double r231053 = r231048 - r231052;
return r231053;
}




Bits error versus x.re




Bits error versus x.im
Results
| Original | 7.3 |
|---|---|
| Target | 0.2 |
| 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 2019323
(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)))