Average Error: 7.4 → 0.2
Time: 3.7s
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(\left(3 \cdot x.re\right) \cdot \left(x.im \cdot x.re\right)\right)}^{1} - {x.im}^{3}\]
\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(\left(3 \cdot x.re\right) \cdot \left(x.im \cdot x.re\right)\right)}^{1} - {x.im}^{3}
double f(double x_re, double x_im) {
        double r243780 = x_re;
        double r243781 = r243780 * r243780;
        double r243782 = x_im;
        double r243783 = r243782 * r243782;
        double r243784 = r243781 - r243783;
        double r243785 = r243784 * r243782;
        double r243786 = r243780 * r243782;
        double r243787 = r243782 * r243780;
        double r243788 = r243786 + r243787;
        double r243789 = r243788 * r243780;
        double r243790 = r243785 + r243789;
        return r243790;
}

double f(double x_re, double x_im) {
        double r243791 = 3.0;
        double r243792 = x_re;
        double r243793 = r243791 * r243792;
        double r243794 = x_im;
        double r243795 = r243794 * r243792;
        double r243796 = r243793 * r243795;
        double r243797 = 1.0;
        double r243798 = pow(r243796, r243797);
        double r243799 = pow(r243794, r243791);
        double r243800 = r243798 - r243799;
        return r243800;
}

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.2
\[\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. Simplified7.3

    \[\leadsto \color{blue}{3 \cdot \left(x.im \cdot \left(x.re \cdot x.re\right)\right) - {x.im}^{3}}\]
  3. Using strategy rm
  4. Applied associate-*r*0.2

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

    \[\leadsto \color{blue}{\left(\left(\sqrt[3]{3} \cdot \sqrt[3]{3}\right) \cdot \sqrt[3]{3}\right)} \cdot \left(\left(x.im \cdot x.re\right) \cdot x.re\right) - {x.im}^{3}\]
  7. Applied associate-*l*0.3

    \[\leadsto \color{blue}{\left(\sqrt[3]{3} \cdot \sqrt[3]{3}\right) \cdot \left(\sqrt[3]{3} \cdot \left(\left(x.im \cdot x.re\right) \cdot x.re\right)\right)} - {x.im}^{3}\]
  8. Using strategy rm
  9. Applied pow10.3

    \[\leadsto \left(\sqrt[3]{3} \cdot \sqrt[3]{3}\right) \cdot \left(\sqrt[3]{3} \cdot \left(\left(x.im \cdot x.re\right) \cdot \color{blue}{{x.re}^{1}}\right)\right) - {x.im}^{3}\]
  10. Applied pow10.3

    \[\leadsto \left(\sqrt[3]{3} \cdot \sqrt[3]{3}\right) \cdot \left(\sqrt[3]{3} \cdot \left(\left(x.im \cdot \color{blue}{{x.re}^{1}}\right) \cdot {x.re}^{1}\right)\right) - {x.im}^{3}\]
  11. Applied pow10.3

    \[\leadsto \left(\sqrt[3]{3} \cdot \sqrt[3]{3}\right) \cdot \left(\sqrt[3]{3} \cdot \left(\left(\color{blue}{{x.im}^{1}} \cdot {x.re}^{1}\right) \cdot {x.re}^{1}\right)\right) - {x.im}^{3}\]
  12. Applied pow-prod-down0.3

    \[\leadsto \left(\sqrt[3]{3} \cdot \sqrt[3]{3}\right) \cdot \left(\sqrt[3]{3} \cdot \left(\color{blue}{{\left(x.im \cdot x.re\right)}^{1}} \cdot {x.re}^{1}\right)\right) - {x.im}^{3}\]
  13. Applied pow-prod-down0.3

    \[\leadsto \left(\sqrt[3]{3} \cdot \sqrt[3]{3}\right) \cdot \left(\sqrt[3]{3} \cdot \color{blue}{{\left(\left(x.im \cdot x.re\right) \cdot x.re\right)}^{1}}\right) - {x.im}^{3}\]
  14. Applied pow10.3

    \[\leadsto \left(\sqrt[3]{3} \cdot \sqrt[3]{3}\right) \cdot \left(\color{blue}{{\left(\sqrt[3]{3}\right)}^{1}} \cdot {\left(\left(x.im \cdot x.re\right) \cdot x.re\right)}^{1}\right) - {x.im}^{3}\]
  15. Applied pow-prod-down0.3

    \[\leadsto \left(\sqrt[3]{3} \cdot \sqrt[3]{3}\right) \cdot \color{blue}{{\left(\sqrt[3]{3} \cdot \left(\left(x.im \cdot x.re\right) \cdot x.re\right)\right)}^{1}} - {x.im}^{3}\]
  16. Applied pow10.3

    \[\leadsto \left(\sqrt[3]{3} \cdot \color{blue}{{\left(\sqrt[3]{3}\right)}^{1}}\right) \cdot {\left(\sqrt[3]{3} \cdot \left(\left(x.im \cdot x.re\right) \cdot x.re\right)\right)}^{1} - {x.im}^{3}\]
  17. Applied pow10.3

    \[\leadsto \left(\color{blue}{{\left(\sqrt[3]{3}\right)}^{1}} \cdot {\left(\sqrt[3]{3}\right)}^{1}\right) \cdot {\left(\sqrt[3]{3} \cdot \left(\left(x.im \cdot x.re\right) \cdot x.re\right)\right)}^{1} - {x.im}^{3}\]
  18. Applied pow-prod-down0.3

    \[\leadsto \color{blue}{{\left(\sqrt[3]{3} \cdot \sqrt[3]{3}\right)}^{1}} \cdot {\left(\sqrt[3]{3} \cdot \left(\left(x.im \cdot x.re\right) \cdot x.re\right)\right)}^{1} - {x.im}^{3}\]
  19. Applied pow-prod-down0.3

    \[\leadsto \color{blue}{{\left(\left(\sqrt[3]{3} \cdot \sqrt[3]{3}\right) \cdot \left(\sqrt[3]{3} \cdot \left(\left(x.im \cdot x.re\right) \cdot x.re\right)\right)\right)}^{1}} - {x.im}^{3}\]
  20. Simplified0.2

    \[\leadsto {\color{blue}{\left(\left(3 \cdot x.re\right) \cdot \left(x.im \cdot x.re\right)\right)}}^{1} - {x.im}^{3}\]
  21. Final simplification0.2

    \[\leadsto {\left(\left(3 \cdot x.re\right) \cdot \left(x.im \cdot x.re\right)\right)}^{1} - {x.im}^{3}\]

Reproduce

herbie shell --seed 2019354 
(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)))