\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.1348970050771735 \cdot 10^{-305}:\\
\;\;\;\;\left({x.re}^{3} - x.re \cdot {x.im}^{2}\right) - x.im \cdot \left(2 \cdot \left(x.re \cdot x.im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left({x.re}^{3} - {\left(x.im \cdot \sqrt{x.re}\right)}^{2}\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 (<= x.re -2.1348970050771735e-305)
(-
(- (pow x.re 3.0) (* x.re (pow x.im 2.0)))
(* x.im (* 2.0 (* x.re x.im))))
(-
(- (pow x.re 3.0) (pow (* x.im (sqrt x.re)) 2.0))
(* 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.1348970050771735e-305) {
tmp = (pow(x_46_re, 3.0) - (x_46_re * pow(x_46_im, 2.0))) - (x_46_im * (2.0 * (x_46_re * x_46_im)));
} else {
tmp = (pow(x_46_re, 3.0) - pow((x_46_im * sqrt(x_46_re)), 2.0)) - (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 | 7.2 |
|---|---|
| Target | 0.2 |
| Herbie | 3.8 |
if x.re < -2.13489700507717355e-305Initial program 7.2
Taylor expanded in x.re around 0 7.1
Taylor expanded in x.re around 0 7.1
if -2.13489700507717355e-305 < x.re Initial program 7.2
Taylor expanded in x.re around 0 7.2
Applied egg-rr0.6
Final simplification3.8
herbie shell --seed 2022130
(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)))