\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(x.im \cdot 3\right) \cdot \left(x.re \cdot x.im\right)double f(double x_re, double x_im) {
double r296590 = x_re;
double r296591 = r296590 * r296590;
double r296592 = x_im;
double r296593 = r296592 * r296592;
double r296594 = r296591 - r296593;
double r296595 = r296594 * r296590;
double r296596 = r296590 * r296592;
double r296597 = r296592 * r296590;
double r296598 = r296596 + r296597;
double r296599 = r296598 * r296592;
double r296600 = r296595 - r296599;
return r296600;
}
double f(double x_re, double x_im) {
double r296601 = x_re;
double r296602 = 3.0;
double r296603 = pow(r296601, r296602);
double r296604 = x_im;
double r296605 = r296604 * r296602;
double r296606 = r296601 * r296604;
double r296607 = r296605 * r296606;
double r296608 = r296603 - r296607;
return r296608;
}




Bits error versus x.re




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