Average Error: 6.7 → 0.2
Time: 12.3s
Precision: 64
Internal Precision: 320
\[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\]
\[(x.im \cdot \left(\left(3 \cdot x.re\right) \cdot \left(-x.im\right)\right) + \left({x.re}^{3}\right))_*\]

Error

Bits error versus x.re

Bits error versus x.im

Target

Original6.7
Target0.3
Herbie0.2
\[\left(x.re \cdot x.re\right) \cdot \left(x.re - x.im\right) + \left(x.re \cdot x.im\right) \cdot \left(x.re - 3 \cdot x.im\right)\]

Derivation

  1. Initial program 6.7

    \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\]
  2. Initial simplification6.6

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

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

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

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

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

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

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

Runtime

Time bar (total: 12.3s)Debug logProfile

herbie shell --seed 2018221 +o rules:numerics
(FPCore (x.re x.im)
  :name "math.cube on complex, real part"

  :herbie-target
  (+ (* (* x.re x.re) (- x.re x.im)) (* (* x.re x.im) (- x.re (* 3 x.im))))

  (- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im)))