Average Error: 7.0 → 0.2
Time: 15.3s
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.im \cdot \left(-x.im \cdot x.im\right) + \left(x.re \cdot \left(\left(x.re \cdot x.im\right) \cdot 3\right)\right))_*\]

Error

Bits error versus x.re

Bits error versus x.im

Target

Original7.0
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 7.0

    \[\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. Initial simplification7.0

    \[\leadsto (x.im \cdot \left(x.re \cdot x.re - x.im \cdot x.im\right) + \left(\left(x.re \cdot x.re\right) \cdot \left(x.im + x.im\right)\right))_*\]
  3. Taylor expanded around -inf 7.0

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

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

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

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

    \[\leadsto (x.im \cdot \left(x.im \cdot \left(-x.im\right)\right) + \left(\left(x.re \cdot x.im\right) \cdot \left(3 \cdot x.re\right)\right))_* + \color{blue}{0}\]
  9. Using strategy rm
  10. Applied associate-*r*0.2

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

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

Runtime

Time bar (total: 15.3s)Debug logProfile

herbie shell --seed 2018252 +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)))