Average Error: 7.1 → 0.6
Time: 38.7s
Precision: 64
Internal Precision: 128
\[\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(\left(\sqrt[3]{2} \cdot \sqrt[3]{x.re \cdot x.im}\right) \cdot \left(\sqrt[3]{2} \cdot \sqrt[3]{x.re \cdot x.im}\right)\right) \cdot \left(x.re \cdot \sqrt[3]{x.re \cdot x.im + x.re \cdot x.im}\right) + \left(\left(x.re - x.im\right) \cdot x.im\right) \cdot \left(x.im + x.re\right)\]

Error

Bits error versus x.re

Bits error versus x.im

Target

Original7.1
Target0.2
Herbie0.6
\[\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.1

    \[\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 difference-of-squares7.1

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

    \[\leadsto \left(x.re + x.im\right) \cdot \left(\left(x.re - x.im\right) \cdot x.im\right) + \color{blue}{\left(\sqrt[3]{x.re \cdot x.im + x.im \cdot x.re} \cdot \sqrt[3]{x.re \cdot x.im + x.im \cdot x.re}\right) \cdot \left(\sqrt[3]{x.re \cdot x.im + x.im \cdot x.re} \cdot x.re\right)}\]
  8. Taylor expanded around 0 47.6

    \[\leadsto \left(x.re + x.im\right) \cdot \left(\left(x.re - x.im\right) \cdot x.im\right) + \color{blue}{\left({\left(\sqrt[3]{2}\right)}^{2} \cdot e^{\frac{1}{3} \cdot \left(2 \cdot \log x.im + 2 \cdot \log x.re\right)}\right)} \cdot \left(\sqrt[3]{x.re \cdot x.im + x.im \cdot x.re} \cdot x.re\right)\]
  9. Simplified0.6

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

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

Reproduce

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

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