\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} - 3 \cdot \left(\left(x.re \cdot x.im\right) \cdot x.im\right)double f(double x_re, double x_im) {
double r209493 = x_re;
double r209494 = r209493 * r209493;
double r209495 = x_im;
double r209496 = r209495 * r209495;
double r209497 = r209494 - r209496;
double r209498 = r209497 * r209493;
double r209499 = r209493 * r209495;
double r209500 = r209495 * r209493;
double r209501 = r209499 + r209500;
double r209502 = r209501 * r209495;
double r209503 = r209498 - r209502;
return r209503;
}
double f(double x_re, double x_im) {
double r209504 = x_re;
double r209505 = 3.0;
double r209506 = pow(r209504, r209505);
double r209507 = x_im;
double r209508 = r209504 * r209507;
double r209509 = r209508 * r209507;
double r209510 = r209505 * r209509;
double r209511 = r209506 - r209510;
return r209511;
}




Bits error versus x.re




Bits error versus x.im
Results
| Original | 7.7 |
|---|---|
| Target | 0.3 |
| Herbie | 0.2 |
Initial program 7.7
Simplified0.2
rmApplied associate-*r*0.2
rmApplied associate-*r*0.2
rmApplied associate-*l*0.2
Simplified0.2
rmApplied associate-*l*0.2
Final simplification0.2
herbie shell --seed 2020060
(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)))