\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(\sqrt[3]{3} \cdot \sqrt[3]{3}\right) \cdot \left(\sqrt[3]{3} \cdot \left(x.im \cdot x.re\right)\right)\right) \cdot x.re - {x.im}^{3}double f(double x_re, double x_im) {
double r242224 = x_re;
double r242225 = r242224 * r242224;
double r242226 = x_im;
double r242227 = r242226 * r242226;
double r242228 = r242225 - r242227;
double r242229 = r242228 * r242226;
double r242230 = r242224 * r242226;
double r242231 = r242226 * r242224;
double r242232 = r242230 + r242231;
double r242233 = r242232 * r242224;
double r242234 = r242229 + r242233;
return r242234;
}
double f(double x_re, double x_im) {
double r242235 = 3.0;
double r242236 = cbrt(r242235);
double r242237 = r242236 * r242236;
double r242238 = x_im;
double r242239 = x_re;
double r242240 = r242238 * r242239;
double r242241 = r242236 * r242240;
double r242242 = r242237 * r242241;
double r242243 = r242242 * r242239;
double r242244 = pow(r242238, r242235);
double r242245 = r242243 - r242244;
return r242245;
}




Bits error versus x.re




Bits error versus x.im
Results
| Original | 7.4 |
|---|---|
| Target | 0.2 |
| Herbie | 0.3 |
Initial program 7.4
Simplified7.4
rmApplied associate-*r*0.2
rmApplied associate-*r*0.2
rmApplied add-cube-cbrt0.2
Applied associate-*l*0.3
Final simplification0.3
herbie shell --seed 2020060 +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)))