Average Error: 7.5 → 0.7
Time: 17.3s
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 \cdot x.im + x.re \cdot x.im\right) \cdot x.re + \left(\sqrt[3]{\left(\left(x.re - x.im\right) \cdot x.im\right) \cdot \left(x.im + x.re\right)} \cdot \sqrt[3]{\left(\left(x.re - x.im\right) \cdot x.im\right) \cdot \left(x.im + x.re\right)}\right) \cdot \sqrt[3]{\left(\left(x.re - x.im\right) \cdot x.im\right) \cdot \left(x.im + x.re\right)}\]
\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 \cdot x.im + x.re \cdot x.im\right) \cdot x.re + \left(\sqrt[3]{\left(\left(x.re - x.im\right) \cdot x.im\right) \cdot \left(x.im + x.re\right)} \cdot \sqrt[3]{\left(\left(x.re - x.im\right) \cdot x.im\right) \cdot \left(x.im + x.re\right)}\right) \cdot \sqrt[3]{\left(\left(x.re - x.im\right) \cdot x.im\right) \cdot \left(x.im + x.re\right)}
double f(double x_re, double x_im) {
        double r138011 = x_re;
        double r138012 = r138011 * r138011;
        double r138013 = x_im;
        double r138014 = r138013 * r138013;
        double r138015 = r138012 - r138014;
        double r138016 = r138015 * r138013;
        double r138017 = r138011 * r138013;
        double r138018 = r138013 * r138011;
        double r138019 = r138017 + r138018;
        double r138020 = r138019 * r138011;
        double r138021 = r138016 + r138020;
        return r138021;
}

double f(double x_re, double x_im) {
        double r138022 = x_re;
        double r138023 = x_im;
        double r138024 = r138022 * r138023;
        double r138025 = r138024 + r138024;
        double r138026 = r138025 * r138022;
        double r138027 = r138022 - r138023;
        double r138028 = r138027 * r138023;
        double r138029 = r138023 + r138022;
        double r138030 = r138028 * r138029;
        double r138031 = cbrt(r138030);
        double r138032 = r138031 * r138031;
        double r138033 = r138032 * r138031;
        double r138034 = r138026 + r138033;
        return r138034;
}

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.5
Target0.2
Herbie0.7
\[\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.5

    \[\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 add-cube-cbrt7.9

    \[\leadsto \color{blue}{\left(\sqrt[3]{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im} \cdot \sqrt[3]{\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im}\right) \cdot \sqrt[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\]
  4. Simplified7.9

    \[\leadsto \color{blue}{\left(\sqrt[3]{\left(x.re + x.im\right) \cdot \left(\left(x.re - x.im\right) \cdot x.im\right)} \cdot \sqrt[3]{\left(x.re + x.im\right) \cdot \left(\left(x.re - x.im\right) \cdot x.im\right)}\right)} \cdot \sqrt[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\]
  5. Simplified0.7

    \[\leadsto \left(\sqrt[3]{\left(x.re + x.im\right) \cdot \left(\left(x.re - x.im\right) \cdot x.im\right)} \cdot \sqrt[3]{\left(x.re + x.im\right) \cdot \left(\left(x.re - x.im\right) \cdot x.im\right)}\right) \cdot \color{blue}{\sqrt[3]{\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\]
  6. Final simplification0.7

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

Reproduce

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

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