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

Error

Bits error versus x.re

Bits error versus x.im

Target

Original6.8
Target0.3
Herbie0.1
\[\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.8

    \[\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. Using strategy rm
  3. Applied prod-diff6.8

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

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

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

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

Runtime

Time bar (total: 29.4s)Debug logProfile

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