\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 r272030 = x_re;
double r272031 = r272030 * r272030;
double r272032 = x_im;
double r272033 = r272032 * r272032;
double r272034 = r272031 - r272033;
double r272035 = r272034 * r272030;
double r272036 = r272030 * r272032;
double r272037 = r272032 * r272030;
double r272038 = r272036 + r272037;
double r272039 = r272038 * r272032;
double r272040 = r272035 - r272039;
return r272040;
}
double f(double x_re, double x_im) {
double r272041 = x_re;
double r272042 = 3.0;
double r272043 = pow(r272041, r272042);
double r272044 = x_im;
double r272045 = r272041 * r272044;
double r272046 = r272045 * r272044;
double r272047 = r272042 * r272046;
double r272048 = r272043 - r272047;
return r272048;
}




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)))