Average Error: 6.9 → 0.7
Time: 30.6s
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(\left(x.re - x.im\right) \cdot x.re\right) \cdot \left(x.im + x.re\right) - \left(\left(\sqrt[3]{\sqrt[3]{\left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot x.im} \cdot \sqrt[3]{\left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot x.im}} \cdot \sqrt[3]{\sqrt[3]{\left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot x.im} \cdot \sqrt[3]{\left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot x.im}}\right) \cdot \sqrt[3]{\sqrt[3]{\left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot x.im} \cdot \sqrt[3]{\left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot x.im}}\right) \cdot \sqrt[3]{\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(\left(x.re - x.im\right) \cdot x.re\right) \cdot \left(x.im + x.re\right) - \left(\left(\sqrt[3]{\sqrt[3]{\left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot x.im} \cdot \sqrt[3]{\left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot x.im}} \cdot \sqrt[3]{\sqrt[3]{\left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot x.im} \cdot \sqrt[3]{\left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot x.im}}\right) \cdot \sqrt[3]{\sqrt[3]{\left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot x.im} \cdot \sqrt[3]{\left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot x.im}}\right) \cdot \sqrt[3]{\left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot x.im}
double f(double x_re, double x_im) {
        double r5668967 = x_re;
        double r5668968 = r5668967 * r5668967;
        double r5668969 = x_im;
        double r5668970 = r5668969 * r5668969;
        double r5668971 = r5668968 - r5668970;
        double r5668972 = r5668971 * r5668967;
        double r5668973 = r5668967 * r5668969;
        double r5668974 = r5668969 * r5668967;
        double r5668975 = r5668973 + r5668974;
        double r5668976 = r5668975 * r5668969;
        double r5668977 = r5668972 - r5668976;
        return r5668977;
}

double f(double x_re, double x_im) {
        double r5668978 = x_re;
        double r5668979 = x_im;
        double r5668980 = r5668978 - r5668979;
        double r5668981 = r5668980 * r5668978;
        double r5668982 = r5668979 + r5668978;
        double r5668983 = r5668981 * r5668982;
        double r5668984 = r5668978 * r5668979;
        double r5668985 = r5668984 + r5668984;
        double r5668986 = r5668985 * r5668979;
        double r5668987 = cbrt(r5668986);
        double r5668988 = r5668987 * r5668987;
        double r5668989 = cbrt(r5668988);
        double r5668990 = r5668989 * r5668989;
        double r5668991 = r5668990 * r5668989;
        double r5668992 = r5668991 * r5668987;
        double r5668993 = r5668983 - r5668992;
        return r5668993;
}

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

Original6.9
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 6.9

    \[\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-squares6.9

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

    \[\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.6

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

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

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

Reproduce

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