\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:\\
\;\;\;\;\left(x.re + x.im\right) \cdot \left(x.re \cdot \left(x.re - x.im\right)\right) - t_0\\
\mathbf{else}:\\
\;\;\;\;x.re \cdot \left(x.re \cdot x.re\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)
(- (* (+ x.re x.im) (* x.re (- x.re x.im))) t_0)
(* x.re (* x.re x.re)))))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 = ((x_46_re + x_46_im) * (x_46_re * (x_46_re - x_46_im))) - t_0;
} else {
tmp = x_46_re * (x_46_re * x_46_re);
}
return tmp;
}




Bits error versus x.re




Bits error versus x.im
Results
| Original | 11.1 |
|---|---|
| Target | 8.2 |
| Herbie | 2.1 |
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 4.4
Applied difference-of-squares_binary644.4
Applied associate-*l*_binary640.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 64.0
Simplified17.1
Taylor expanded in x.re around inf 17.1
Simplified17.1
Final simplification2.1
herbie shell --seed 2022068
(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)))