Average Error: 7.5 → 0.7
Time: 17.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 r141025 = x_re;
        double r141026 = r141025 * r141025;
        double r141027 = x_im;
        double r141028 = r141027 * r141027;
        double r141029 = r141026 - r141028;
        double r141030 = r141029 * r141027;
        double r141031 = r141025 * r141027;
        double r141032 = r141027 * r141025;
        double r141033 = r141031 + r141032;
        double r141034 = r141033 * r141025;
        double r141035 = r141030 + r141034;
        return r141035;
}

double f(double x_re, double x_im) {
        double r141036 = x_re;
        double r141037 = x_im;
        double r141038 = r141036 * r141037;
        double r141039 = r141038 + r141038;
        double r141040 = r141039 * r141036;
        double r141041 = r141036 - r141037;
        double r141042 = r141041 * r141037;
        double r141043 = r141037 + r141036;
        double r141044 = r141042 * r141043;
        double r141045 = cbrt(r141044);
        double r141046 = r141045 * r141045;
        double r141047 = r141046 * r141045;
        double r141048 = r141040 + r141047;
        return r141048;
}

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)))