\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
\mathsf{fma}\left(x.im, \left(-3 \cdot x.im\right) \cdot x.re, {x.re}^{3}\right)double f(double x_re, double x_im) {
double r94786 = x_re;
double r94787 = r94786 * r94786;
double r94788 = x_im;
double r94789 = r94788 * r94788;
double r94790 = r94787 - r94789;
double r94791 = r94790 * r94786;
double r94792 = r94786 * r94788;
double r94793 = r94788 * r94786;
double r94794 = r94792 + r94793;
double r94795 = r94794 * r94788;
double r94796 = r94791 - r94795;
return r94796;
}
double f(double x_re, double x_im) {
double r94797 = x_im;
double r94798 = -3.0;
double r94799 = r94798 * r94797;
double r94800 = x_re;
double r94801 = r94799 * r94800;
double r94802 = 3.0;
double r94803 = pow(r94800, r94802);
double r94804 = fma(r94797, r94801, r94803);
return r94804;
}




Bits error versus x.re




Bits error versus x.im
| Original | 6.8 |
|---|---|
| Target | 0.3 |
| Herbie | 0.2 |
Initial program 6.8
Simplified0.2
rmApplied fma-udef0.2
Simplified0.2
rmApplied pow10.2
Applied pow10.2
Applied pow10.2
Applied pow-prod-down0.2
Applied pow10.2
Applied pow-prod-down0.2
Applied pow-prod-down0.2
Simplified0.2
rmApplied *-un-lft-identity0.2
Applied *-un-lft-identity0.2
Applied distribute-lft-out0.2
Simplified0.2
Final simplification0.2
herbie shell --seed 2019194 +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.0 x.im))))
(- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im)))