\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re
\begin{array}{l}
\mathbf{if}\;x.re \leq -3.273291574359745 \cdot 10^{+164} \lor \neg \left(x.re \leq 8.978711195291429 \cdot 10^{+151}\right):\\
\;\;\;\;\left(x.re + x.im\right) \cdot \left(x.im \cdot \left(x.re - x.im\right)\right) + x.re \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right)\\
\mathbf{else}:\\
\;\;\;\;x.im \cdot \mathsf{fma}\left(x.re, x.re \cdot 3, -x.im \cdot x.im\right)\\
\end{array}
(FPCore (x.re x.im) :precision binary64 (+ (* (- (* x.re x.re) (* x.im x.im)) x.im) (* (+ (* x.re x.im) (* x.im x.re)) x.re)))
(FPCore (x.re x.im)
:precision binary64
(if (or (<= x.re -3.273291574359745e+164)
(not (<= x.re 8.978711195291429e+151)))
(+
(* (+ x.re x.im) (* x.im (- x.re x.im)))
(* x.re (+ (* x.re x.im) (* x.re x.im))))
(* x.im (fma x.re (* x.re 3.0) (- (* x.im x.im))))))double code(double x_46_re, double x_46_im) {
return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re);
}
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_re <= -3.273291574359745e+164) || !(x_46_re <= 8.978711195291429e+151)) {
tmp = ((x_46_re + x_46_im) * (x_46_im * (x_46_re - x_46_im))) + (x_46_re * ((x_46_re * x_46_im) + (x_46_re * x_46_im)));
} else {
tmp = x_46_im * fma(x_46_re, (x_46_re * 3.0), -(x_46_im * x_46_im));
}
return tmp;
}




Bits error versus x.re




Bits error versus x.im
| Original | 11.5 |
|---|---|
| Target | 5.5 |
| Herbie | 2.1 |
if x.re < -3.27329157435974482e164 or 8.97871119529142927e151 < x.re Initial program 31.5
Applied difference-of-squares_binary6422.6
Applied associate-*l*_binary647.4
if -3.27329157435974482e164 < x.re < 8.97871119529142927e151Initial program 5.0
Simplified0.4
Applied *-un-lft-identity_binary640.4
Final simplification2.1
herbie shell --seed 2022067
(FPCore (x.re x.im)
:name "math.cube on complex, imaginary part"
:precision binary64
:herbie-target
(+ (* (* x.re x.im) (* 2.0 x.re)) (* (* x.im (- x.re x.im)) (+ x.re x.im)))
(+ (* (- (* x.re x.re) (* x.im x.im)) x.im) (* (+ (* x.re x.im) (* x.im x.re)) x.re)))