\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(\left(3 \cdot x.im\right) \cdot x.re\right) \cdot x.re - {x.im}^{3}double f(double x_re, double x_im) {
double r202191 = x_re;
double r202192 = r202191 * r202191;
double r202193 = x_im;
double r202194 = r202193 * r202193;
double r202195 = r202192 - r202194;
double r202196 = r202195 * r202193;
double r202197 = r202191 * r202193;
double r202198 = r202193 * r202191;
double r202199 = r202197 + r202198;
double r202200 = r202199 * r202191;
double r202201 = r202196 + r202200;
return r202201;
}
double f(double x_re, double x_im) {
double r202202 = 3.0;
double r202203 = x_im;
double r202204 = r202202 * r202203;
double r202205 = x_re;
double r202206 = r202204 * r202205;
double r202207 = r202206 * r202205;
double r202208 = pow(r202203, r202202);
double r202209 = r202207 - r202208;
return r202209;
}




Bits error versus x.re




Bits error versus x.im
Results
| Original | 7.3 |
|---|---|
| Target | 0.3 |
| Herbie | 0.2 |
Initial program 7.3
Simplified7.3
rmApplied associate-*r*0.2
rmApplied associate-*r*0.2
rmApplied associate-*r*0.2
Final simplification0.2
herbie shell --seed 2020049 +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)))