Average Error: 6.8 → 0.2
Time: 45.6s
Precision: 64
Internal Precision: 576
\[\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\]
\[(x.re \cdot \left(\left(x.re \cdot x.im\right) \cdot 3\right) + \left(\left(-x.im\right) \cdot \left(x.im \cdot x.im\right)\right))_* + 0\]

Error

Bits error versus x.re

Bits error versus x.im

Target

Original6.8
Target0.2
Herbie0.2
\[\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 6.8

    \[\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. Applied simplify0.2

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

    \[\leadsto \color{blue}{3 \cdot \left({x.re}^{2} \cdot x.im\right) - {x.im}^{3}}\]
  4. Using strategy rm
  5. Applied add-cube-cbrt7.1

    \[\leadsto 3 \cdot \left({x.re}^{2} \cdot x.im\right) - \color{blue}{\left(\sqrt[3]{{x.im}^{3}} \cdot \sqrt[3]{{x.im}^{3}}\right) \cdot \sqrt[3]{{x.im}^{3}}}\]
  6. Applied prod-diff7.1

    \[\leadsto \color{blue}{(3 \cdot \left({x.re}^{2} \cdot x.im\right) + \left(-\sqrt[3]{{x.im}^{3}} \cdot \left(\sqrt[3]{{x.im}^{3}} \cdot \sqrt[3]{{x.im}^{3}}\right)\right))_* + (\left(-\sqrt[3]{{x.im}^{3}}\right) \cdot \left(\sqrt[3]{{x.im}^{3}} \cdot \sqrt[3]{{x.im}^{3}}\right) + \left(\sqrt[3]{{x.im}^{3}} \cdot \left(\sqrt[3]{{x.im}^{3}} \cdot \sqrt[3]{{x.im}^{3}}\right)\right))_*}\]
  7. Applied simplify0.2

    \[\leadsto \color{blue}{(x.re \cdot \left(\left(x.re \cdot x.im\right) \cdot 3\right) + \left(\left(-x.im\right) \cdot \left(x.im \cdot x.im\right)\right))_*} + (\left(-\sqrt[3]{{x.im}^{3}}\right) \cdot \left(\sqrt[3]{{x.im}^{3}} \cdot \sqrt[3]{{x.im}^{3}}\right) + \left(\sqrt[3]{{x.im}^{3}} \cdot \left(\sqrt[3]{{x.im}^{3}} \cdot \sqrt[3]{{x.im}^{3}}\right)\right))_*\]
  8. Applied simplify0.2

    \[\leadsto (x.re \cdot \left(\left(x.re \cdot x.im\right) \cdot 3\right) + \left(\left(-x.im\right) \cdot \left(x.im \cdot x.im\right)\right))_* + \color{blue}{0}\]

Runtime

Time bar (total: 45.6s)Debug logProfile

herbie shell --seed 2018214 +o rules:numerics
(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)))