Average Error: 7.4 → 0.5
Time: 23.5s
Precision: 64
\[\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\]
\[\left(x.re + x.im\right) \cdot \left(\left(x.re - x.im\right) \cdot x.im\right) + \left(\left(\left(\sqrt[3]{2} \cdot \left(\sqrt[3]{x.re} \cdot \sqrt[3]{x.im}\right)\right) \cdot \sqrt[3]{x.im \cdot \left(x.re + x.re\right)}\right) \cdot \sqrt[3]{x.im \cdot \left(x.re + x.re\right)}\right) \cdot x.re\]
\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
\left(x.re + x.im\right) \cdot \left(\left(x.re - x.im\right) \cdot x.im\right) + \left(\left(\left(\sqrt[3]{2} \cdot \left(\sqrt[3]{x.re} \cdot \sqrt[3]{x.im}\right)\right) \cdot \sqrt[3]{x.im \cdot \left(x.re + x.re\right)}\right) \cdot \sqrt[3]{x.im \cdot \left(x.re + x.re\right)}\right) \cdot x.re
double f(double x_re, double x_im) {
        double r252900 = x_re;
        double r252901 = r252900 * r252900;
        double r252902 = x_im;
        double r252903 = r252902 * r252902;
        double r252904 = r252901 - r252903;
        double r252905 = r252904 * r252902;
        double r252906 = r252900 * r252902;
        double r252907 = r252902 * r252900;
        double r252908 = r252906 + r252907;
        double r252909 = r252908 * r252900;
        double r252910 = r252905 + r252909;
        return r252910;
}

double f(double x_re, double x_im) {
        double r252911 = x_re;
        double r252912 = x_im;
        double r252913 = r252911 + r252912;
        double r252914 = r252911 - r252912;
        double r252915 = r252914 * r252912;
        double r252916 = r252913 * r252915;
        double r252917 = 2.0;
        double r252918 = cbrt(r252917);
        double r252919 = cbrt(r252911);
        double r252920 = cbrt(r252912);
        double r252921 = r252919 * r252920;
        double r252922 = r252918 * r252921;
        double r252923 = r252911 + r252911;
        double r252924 = r252912 * r252923;
        double r252925 = cbrt(r252924);
        double r252926 = r252922 * r252925;
        double r252927 = r252926 * r252925;
        double r252928 = r252927 * r252911;
        double r252929 = r252916 + r252928;
        return r252929;
}

Error

Bits error versus x.re

Bits error versus x.im

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original7.4
Target0.2
Herbie0.5
\[\left(x.re \cdot x.im\right) \cdot \left(2 \cdot x.re\right) + \left(x.im \cdot \left(x.re - x.im\right)\right) \cdot \left(x.re + x.im\right)\]

Derivation

  1. Initial program 7.4

    \[\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\]
  2. Using strategy rm
  3. Applied difference-of-squares7.4

    \[\leadsto \color{blue}{\left(\left(x.re + x.im\right) \cdot \left(x.re - x.im\right)\right)} \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re\]
  4. Applied associate-*l*0.2

    \[\leadsto \color{blue}{\left(x.re + x.im\right) \cdot \left(\left(x.re - x.im\right) \cdot x.im\right)} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re\]
  5. Using strategy rm
  6. Applied add-cube-cbrt0.6

    \[\leadsto \left(x.re + x.im\right) \cdot \left(\left(x.re - x.im\right) \cdot x.im\right) + \color{blue}{\left(\left(\sqrt[3]{x.re \cdot x.im + x.im \cdot x.re} \cdot \sqrt[3]{x.re \cdot x.im + x.im \cdot x.re}\right) \cdot \sqrt[3]{x.re \cdot x.im + x.im \cdot x.re}\right)} \cdot x.re\]
  7. Simplified0.6

    \[\leadsto \left(x.re + x.im\right) \cdot \left(\left(x.re - x.im\right) \cdot x.im\right) + \left(\color{blue}{\left(\sqrt[3]{x.im \cdot \left(x.re + x.re\right)} \cdot \sqrt[3]{x.im \cdot \left(x.re + x.re\right)}\right)} \cdot \sqrt[3]{x.re \cdot x.im + x.im \cdot x.re}\right) \cdot x.re\]
  8. Simplified0.6

    \[\leadsto \left(x.re + x.im\right) \cdot \left(\left(x.re - x.im\right) \cdot x.im\right) + \left(\left(\sqrt[3]{x.im \cdot \left(x.re + x.re\right)} \cdot \sqrt[3]{x.im \cdot \left(x.re + x.re\right)}\right) \cdot \color{blue}{\sqrt[3]{x.im \cdot \left(x.re + x.re\right)}}\right) \cdot x.re\]
  9. Taylor expanded around 0 48.7

    \[\leadsto \left(x.re + x.im\right) \cdot \left(\left(x.re - x.im\right) \cdot x.im\right) + \left(\left(\color{blue}{\left(e^{\frac{1}{3} \cdot \left(\log x.re + \log x.im\right)} \cdot \sqrt[3]{2}\right)} \cdot \sqrt[3]{x.im \cdot \left(x.re + x.re\right)}\right) \cdot \sqrt[3]{x.im \cdot \left(x.re + x.re\right)}\right) \cdot x.re\]
  10. Simplified0.6

    \[\leadsto \left(x.re + x.im\right) \cdot \left(\left(x.re - x.im\right) \cdot x.im\right) + \left(\left(\color{blue}{\left(\sqrt[3]{2} \cdot \sqrt[3]{x.re \cdot x.im}\right)} \cdot \sqrt[3]{x.im \cdot \left(x.re + x.re\right)}\right) \cdot \sqrt[3]{x.im \cdot \left(x.re + x.re\right)}\right) \cdot x.re\]
  11. Using strategy rm
  12. Applied cbrt-prod0.5

    \[\leadsto \left(x.re + x.im\right) \cdot \left(\left(x.re - x.im\right) \cdot x.im\right) + \left(\left(\left(\sqrt[3]{2} \cdot \color{blue}{\left(\sqrt[3]{x.re} \cdot \sqrt[3]{x.im}\right)}\right) \cdot \sqrt[3]{x.im \cdot \left(x.re + x.re\right)}\right) \cdot \sqrt[3]{x.im \cdot \left(x.re + x.re\right)}\right) \cdot x.re\]
  13. Final simplification0.5

    \[\leadsto \left(x.re + x.im\right) \cdot \left(\left(x.re - x.im\right) \cdot x.im\right) + \left(\left(\left(\sqrt[3]{2} \cdot \left(\sqrt[3]{x.re} \cdot \sqrt[3]{x.im}\right)\right) \cdot \sqrt[3]{x.im \cdot \left(x.re + x.re\right)}\right) \cdot \sqrt[3]{x.im \cdot \left(x.re + x.re\right)}\right) \cdot x.re\]

Reproduce

herbie shell --seed 2019304 
(FPCore (x.re x.im)
  :name "math.cube on complex, imaginary part"
  :precision binary64

  :herbie-target
  (+ (* (* x.re x.im) (* 2 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)))