Average Error: 7.1 → 0.2
Time: 23.8s
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\]
\[{x.re}^{3} - x.im \cdot \left(3 \cdot \left(x.im \cdot x.re\right)\right)\]

Error

Bits error versus x.re

Bits error versus x.im

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original7.1
Target0.2
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 7.1

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

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

    \[\leadsto \color{blue}{{x.re}^{3} - 3 \cdot \left({x.im}^{2} \cdot x.re\right)}\]
  4. Taylor expanded around -inf 62.6

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

    \[\leadsto {x.re}^{3} - \color{blue}{\left(x.im \cdot 3\right) \cdot \left(x.im \cdot x.re\right)}\]
  6. Using strategy rm
  7. Applied associate-*l*0.2

    \[\leadsto {x.re}^{3} - \color{blue}{x.im \cdot \left(3 \cdot \left(x.im \cdot x.re\right)\right)}\]
  8. Final simplification0.2

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

Runtime

Time bar (total: 23.8s)Debug logProfile

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