\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}
t_0 := x.im \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right)\\
\mathbf{if}\;x.re \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) - t_0 \leq -\infty:\\
\;\;\;\;{x.re}^{3} - t_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x.re, x.im \cdot \left(x.im \cdot -3\right), {x.re}^{3}\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
(let* ((t_0 (* x.im (+ (* x.re x.im) (* x.re x.im)))))
(if (<= (- (* x.re (- (* x.re x.re) (* x.im x.im))) t_0) (- INFINITY))
(- (pow x.re 3.0) t_0)
(fma x.re (* x.im (* x.im -3.0)) (pow x.re 3.0)))))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 t_0 = x_46_im * ((x_46_re * x_46_im) + (x_46_re * x_46_im));
double tmp;
if (((x_46_re * ((x_46_re * x_46_re) - (x_46_im * x_46_im))) - t_0) <= -((double) INFINITY)) {
tmp = pow(x_46_re, 3.0) - t_0;
} else {
tmp = fma(x_46_re, (x_46_im * (x_46_im * -3.0)), pow(x_46_re, 3.0));
}
return tmp;
}




Bits error versus x.re




Bits error versus x.im
| Original | 7.2 |
|---|---|
| Target | 0.2 |
| Herbie | 6.4 |
if (-.f64 (*.f64 (-.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)) x.re) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.im)) < -inf.0Initial program 64.0
Taylor expanded around inf 51.2
if -inf.0 < (-.f64 (*.f64 (-.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)) x.re) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.im)) Initial program 3.8
Simplified3.8
rmApplied associate-*l*_binary643.8
Simplified3.8
Final simplification6.4
herbie shell --seed 2021211
(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)))