Average Error: 7.1 → 0.7
Time: 30.1s
Precision: 64
\[\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\]
\[\left(\sqrt[3]{\left(\left(x.re - x.im\right) \cdot x.re\right) \cdot \left(x.im + x.re\right)} \cdot \sqrt[3]{\left(\left(x.re - x.im\right) \cdot x.re\right) \cdot \left(x.im + x.re\right)}\right) \cdot \sqrt[3]{\left(\left(x.re - x.im\right) \cdot x.re\right) \cdot \left(x.im + x.re\right)} - \left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot x.im\]
\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
\left(\sqrt[3]{\left(\left(x.re - x.im\right) \cdot x.re\right) \cdot \left(x.im + x.re\right)} \cdot \sqrt[3]{\left(\left(x.re - x.im\right) \cdot x.re\right) \cdot \left(x.im + x.re\right)}\right) \cdot \sqrt[3]{\left(\left(x.re - x.im\right) \cdot x.re\right) \cdot \left(x.im + x.re\right)} - \left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot x.im
double f(double x_re, double x_im) {
        double r10197006 = x_re;
        double r10197007 = r10197006 * r10197006;
        double r10197008 = x_im;
        double r10197009 = r10197008 * r10197008;
        double r10197010 = r10197007 - r10197009;
        double r10197011 = r10197010 * r10197006;
        double r10197012 = r10197006 * r10197008;
        double r10197013 = r10197008 * r10197006;
        double r10197014 = r10197012 + r10197013;
        double r10197015 = r10197014 * r10197008;
        double r10197016 = r10197011 - r10197015;
        return r10197016;
}

double f(double x_re, double x_im) {
        double r10197017 = x_re;
        double r10197018 = x_im;
        double r10197019 = r10197017 - r10197018;
        double r10197020 = r10197019 * r10197017;
        double r10197021 = r10197018 + r10197017;
        double r10197022 = r10197020 * r10197021;
        double r10197023 = cbrt(r10197022);
        double r10197024 = r10197023 * r10197023;
        double r10197025 = r10197024 * r10197023;
        double r10197026 = r10197017 * r10197018;
        double r10197027 = r10197026 + r10197026;
        double r10197028 = r10197027 * r10197018;
        double r10197029 = r10197025 - r10197028;
        return r10197029;
}

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.1
Target0.3
Herbie0.7
\[\left(x.re \cdot x.re\right) \cdot \left(x.re - x.im\right) + \left(x.re \cdot x.im\right) \cdot \left(x.re - 3 \cdot x.im\right)\]

Derivation

  1. Initial program 7.1

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

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

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

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

Reproduce

herbie shell --seed 2019129 
(FPCore (x.re x.im)
  :name "math.cube on complex, real part"

  :herbie-target
  (+ (* (* x.re x.re) (- x.re x.im)) (* (* x.re x.im) (- x.re (* 3 x.im))))

  (- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im)))