\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 -2.580140784623766 \cdot 10^{+144} \lor \neg \left(x.re \leq 1.2725287036008839 \cdot 10^{+151}\right):\\
\;\;\;\;\mathsf{fma}\left(x.re + x.im, x.im \cdot \left(x.re - x.im\right), x.re \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x.im \cdot \left(3 \cdot \left(x.re \cdot x.re\right) - 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 -2.580140784623766e+144)
(not (<= x.re 1.2725287036008839e+151)))
(fma
(+ x.re x.im)
(* x.im (- x.re x.im))
(* x.re (+ (* x.re x.im) (* x.re x.im))))
(* x.im (- (* 3.0 (* x.re x.re)) (* 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 <= -2.580140784623766e+144) || !(x_46_re <= 1.2725287036008839e+151)) {
tmp = fma((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 * ((3.0 * (x_46_re * x_46_re)) - (x_46_im * x_46_im));
}
return tmp;
}




Bits error versus x.re




Bits error versus x.im
| Original | 10.8 |
|---|---|
| Target | 5.4 |
| Herbie | 2.2 |
if x.re < -2.58014078462376613e144 or 1.2725287036008839e151 < x.re Initial program 29.9
Applied difference-of-squares_binary6422.3
Applied associate-*l*_binary648.4
Applied fma-def_binary648.3
if -2.58014078462376613e144 < x.re < 1.2725287036008839e151Initial program 4.3
Simplified0.2
Taylor expanded in x.re around 0 0.2
Simplified0.2
Final simplification2.2
herbie shell --seed 2022068
(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)))