\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} - \mathsf{fma}\left(x.im, \left(x.im \cdot x.re\right), \left(\left(x.im \cdot x.re\right) \cdot \left(x.im + x.im\right)\right)\right)double f(double x_re, double x_im) {
double r5248912 = x_re;
double r5248913 = r5248912 * r5248912;
double r5248914 = x_im;
double r5248915 = r5248914 * r5248914;
double r5248916 = r5248913 - r5248915;
double r5248917 = r5248916 * r5248912;
double r5248918 = r5248912 * r5248914;
double r5248919 = r5248914 * r5248912;
double r5248920 = r5248918 + r5248919;
double r5248921 = r5248920 * r5248914;
double r5248922 = r5248917 - r5248921;
return r5248922;
}
double f(double x_re, double x_im) {
double r5248923 = x_re;
double r5248924 = 3.0;
double r5248925 = pow(r5248923, r5248924);
double r5248926 = x_im;
double r5248927 = r5248926 * r5248923;
double r5248928 = r5248926 + r5248926;
double r5248929 = r5248927 * r5248928;
double r5248930 = fma(r5248926, r5248927, r5248929);
double r5248931 = r5248925 - r5248930;
return r5248931;
}




Bits error versus x.re




Bits error versus x.im
| Original | 6.8 |
|---|---|
| Target | 0.2 |
| Herbie | 0.1 |
Initial program 6.8
Simplified0.2
rmApplied pow10.2
Applied pow10.2
Applied pow-prod-up0.2
Applied pow10.2
Applied pow-prod-up0.2
Simplified0.2
rmApplied distribute-rgt-in0.2
rmApplied fma-def0.1
Final simplification0.1
herbie shell --seed 2019128 +o rules:numerics
(FPCore (x.re x.im)
:name "math.cube on complex, real part"
: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)))