\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
\begin{array}{l}
\mathbf{if}\;x.re \leq -2.6528090666816572 \cdot 10^{+163} \lor \neg \left(x.re \leq 3.1664951455267414 \cdot 10^{+196}\right):\\
\;\;\;\;{x.re}^{3}\\
\mathbf{else}:\\
\;\;\;\;\left(x.re + x.im\right) \cdot \left(x.re \cdot \left(x.re - x.im\right)\right) - x.im \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right)\\
\end{array}
(FPCore (x.re x.im) :precision binary64 (- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im)))
(FPCore (x.re x.im)
:precision binary64
(if (or (<= x.re -2.6528090666816572e+163)
(not (<= x.re 3.1664951455267414e+196)))
(pow x.re 3.0)
(-
(* (+ x.re x.im) (* x.re (- x.re x.im)))
(* x.im (+ (* x.re x.im) (* x.re 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_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im);
}
double code(double x_46_re, double x_46_im) {
double tmp;
if ((x_46_re <= -2.6528090666816572e+163) || !(x_46_re <= 3.1664951455267414e+196)) {
tmp = pow(x_46_re, 3.0);
} else {
tmp = ((x_46_re + x_46_im) * (x_46_re * (x_46_re - x_46_im))) - (x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im)));
}
return tmp;
}




Bits error versus x.re




Bits error versus x.im
Results
| Original | 11.6 |
|---|---|
| Target | 8.1 |
| Herbie | 2.2 |
if x.re < -2.6528090666816572e163 or 3.1664951455267414e196 < x.re Initial program 29.3
Simplified10.1
Taylor expanded in x.re around inf 6.3
if -2.6528090666816572e163 < x.re < 3.1664951455267414e196Initial program 7.0
Applied difference-of-squares_binary646.3
Applied associate-*l*_binary641.2
Final simplification2.2
herbie shell --seed 2022067
(FPCore (x.re x.im)
:name "math.cube on complex, real part"
:precision binary64
: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)))