\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(3 \cdot \left(x.im \cdot x.re\right)\right) \cdot x.imdouble f(double x_re, double x_im) {
double r25336959 = x_re;
double r25336960 = r25336959 * r25336959;
double r25336961 = x_im;
double r25336962 = r25336961 * r25336961;
double r25336963 = r25336960 - r25336962;
double r25336964 = r25336963 * r25336959;
double r25336965 = r25336959 * r25336961;
double r25336966 = r25336961 * r25336959;
double r25336967 = r25336965 + r25336966;
double r25336968 = r25336967 * r25336961;
double r25336969 = r25336964 - r25336968;
return r25336969;
}
double f(double x_re, double x_im) {
double r25336970 = x_re;
double r25336971 = 3.0;
double r25336972 = pow(r25336970, r25336971);
double r25336973 = x_im;
double r25336974 = r25336973 * r25336970;
double r25336975 = r25336971 * r25336974;
double r25336976 = r25336975 * r25336973;
double r25336977 = r25336972 - r25336976;
return r25336977;
}




Bits error versus x.re




Bits error versus x.im
Results
| Original | 6.8 |
|---|---|
| Target | 0.3 |
| Herbie | 0.2 |
Initial program 6.8
Simplified0.2
rmApplied pow10.2
Applied pow-plus0.2
Applied pow10.2
Applied pow-prod-up0.2
Simplified0.2
rmApplied *-un-lft-identity0.2
Applied distribute-lft1-in0.2
Applied distribute-rgt1-in0.2
Applied associate-*r*0.2
Final simplification0.2
herbie shell --seed 2019124 +o rules:numerics
(FPCore (x.re x.im)
:name "math.cube on complex, real part"
: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)))