\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}
t_0 := \mathsf{fma}\left(x.re, x.re \cdot 3, -x.im \cdot x.im\right)\\
\mathbf{if}\;x.im \leq -5.179057929550085 \cdot 10^{+106}:\\
\;\;\;\;\begin{array}{l}
t_1 := x.im \cdot t_0\\
\sqrt[3]{t_1 \cdot t_1} \cdot \sqrt[3]{t_1}
\end{array}\\
\mathbf{elif}\;x.im \leq 3.841500425837586 \cdot 10^{+101}:\\
\;\;\;\;3 \cdot \left(x.re \cdot \left(x.im \cdot x.re\right)\right) - {x.im}^{3}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_2 := \sqrt[3]{t_0}\\
t_2 \cdot \left(x.im \cdot \left(t_2 \cdot t_2\right)\right)
\end{array}\\
\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
(let* ((t_0 (fma x.re (* x.re 3.0) (- (* x.im x.im)))))
(if (<= x.im -5.179057929550085e+106)
(let* ((t_1 (* x.im t_0))) (* (cbrt (* t_1 t_1)) (cbrt t_1)))
(if (<= x.im 3.841500425837586e+101)
(- (* 3.0 (* x.re (* x.im x.re))) (pow x.im 3.0))
(let* ((t_2 (cbrt t_0))) (* t_2 (* x.im (* t_2 t_2))))))))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 t_0 = fma(x_46_re, (x_46_re * 3.0), -(x_46_im * x_46_im));
double tmp;
if (x_46_im <= -5.179057929550085e+106) {
double t_1_1 = x_46_im * t_0;
tmp = cbrt(t_1_1 * t_1_1) * cbrt(t_1_1);
} else if (x_46_im <= 3.841500425837586e+101) {
tmp = (3.0 * (x_46_re * (x_46_im * x_46_re))) - pow(x_46_im, 3.0);
} else {
double t_2 = cbrt(t_0);
tmp = t_2 * (x_46_im * (t_2 * t_2));
}
return tmp;
}




Bits error versus x.re




Bits error versus x.im
| Original | 11.1 |
|---|---|
| Target | 5.6 |
| Herbie | 1.9 |
if x.im < -5.1790579295500851e106Initial program 22.8
Simplified5.6
Applied add-cube-cbrt_binary645.6
Applied cbrt-unprod_binary645.6
if -5.1790579295500851e106 < x.im < 3.84150042583758608e101Initial program 5.9
Simplified5.9
Taylor expanded in x.im around 0 5.9
Applied unpow2_binary645.9
Applied associate-*l*_binary640.3
if 3.84150042583758608e101 < x.im Initial program 20.1
Simplified4.9
Applied add-cube-cbrt_binary644.9
Applied associate-*r*_binary644.9
Final simplification1.9
herbie shell --seed 2022088
(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)))