Average Error: 7.2 → 0.7
Time: 18.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 \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 r277253 = x_re;
        double r277254 = r277253 * r277253;
        double r277255 = x_im;
        double r277256 = r277255 * r277255;
        double r277257 = r277254 - r277256;
        double r277258 = r277257 * r277255;
        double r277259 = r277253 * r277255;
        double r277260 = r277255 * r277253;
        double r277261 = r277259 + r277260;
        double r277262 = r277261 * r277253;
        double r277263 = r277258 + r277262;
        return r277263;
}

double f(double x_re, double x_im) {
        double r277264 = x_re;
        double r277265 = x_im;
        double r277266 = r277264 * r277265;
        double r277267 = r277266 + r277266;
        double r277268 = r277267 * r277264;
        double r277269 = r277264 - r277265;
        double r277270 = r277269 * r277265;
        double r277271 = r277265 + r277264;
        double r277272 = r277270 * r277271;
        double r277273 = cbrt(r277272);
        double r277274 = r277273 * r277273;
        double r277275 = r277274 * r277273;
        double r277276 = r277268 + r277275;
        return r277276;
}

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.2
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.2

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

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

    \[\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 2019179 
(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)))