\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re
\left(3 \cdot \left(x.im \cdot x.re\right)\right) \cdot x.re - {x.im}^{3}double f(double x_re, double x_im) {
double r251088 = x_re;
double r251089 = r251088 * r251088;
double r251090 = x_im;
double r251091 = r251090 * r251090;
double r251092 = r251089 - r251091;
double r251093 = r251092 * r251090;
double r251094 = r251088 * r251090;
double r251095 = r251090 * r251088;
double r251096 = r251094 + r251095;
double r251097 = r251096 * r251088;
double r251098 = r251093 + r251097;
return r251098;
}
double f(double x_re, double x_im) {
double r251099 = 3.0;
double r251100 = x_im;
double r251101 = x_re;
double r251102 = r251100 * r251101;
double r251103 = r251099 * r251102;
double r251104 = r251103 * r251101;
double r251105 = pow(r251100, r251099);
double r251106 = r251104 - r251105;
return r251106;
}




Bits error versus x.re




Bits error versus x.im
Results
| Original | 7.7 |
|---|---|
| Target | 0.3 |
| Herbie | 0.2 |
Initial program 7.7
Simplified7.6
rmApplied associate-*r*0.2
rmApplied associate-*r*0.2
Final simplification0.2
herbie shell --seed 2019353 +o rules:numerics
(FPCore (x.re x.im)
:name "math.cube on complex, imaginary part"
:precision binary64
:herbie-target
(+ (* (* x.re x.im) (* 2 x.re)) (* (* x.im (- x.re x.im)) (+ x.re x.im)))
(+ (* (- (* x.re x.re) (* x.im x.im)) x.im) (* (+ (* x.re x.im) (* x.im x.re)) x.re)))