Average Error: 6.5 → 0.3
Time: 1.8m
Precision: 64
Internal Precision: 384
\[\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 \cdot \left(\left(x.re + x.im\right) \cdot x.re\right) + x.im \cdot \left(x.re \cdot \left(\left(-\left(x.im + x.re\right)\right) - \left(x.im + x.im\right)\right)\right)\]

Error

Bits error versus x.re

Bits error versus x.im

Derivation

  1. Initial program 6.5

    \[\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. Applied simplify6.6

    \[\leadsto \color{blue}{x.re \cdot \left(\left(x.re + x.im\right) \cdot \left(x.re - x.im\right) - \left(x.im + x.im\right) \cdot x.im\right)}\]
  3. Using strategy rm
  4. Applied sub-neg6.6

    \[\leadsto x.re \cdot \left(\left(x.re + x.im\right) \cdot \color{blue}{\left(x.re + \left(-x.im\right)\right)} - \left(x.im + x.im\right) \cdot x.im\right)\]
  5. Applied distribute-lft-in6.6

    \[\leadsto x.re \cdot \left(\color{blue}{\left(\left(x.re + x.im\right) \cdot x.re + \left(x.re + x.im\right) \cdot \left(-x.im\right)\right)} - \left(x.im + x.im\right) \cdot x.im\right)\]
  6. Applied associate--l+6.6

    \[\leadsto x.re \cdot \color{blue}{\left(\left(x.re + x.im\right) \cdot x.re + \left(\left(x.re + x.im\right) \cdot \left(-x.im\right) - \left(x.im + x.im\right) \cdot x.im\right)\right)}\]
  7. Applied distribute-lft-in6.6

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

    \[\leadsto x.re \cdot \left(\left(x.re + x.im\right) \cdot x.re\right) + \color{blue}{\left(x.im \cdot x.re\right) \cdot \left(\left(-\left(x.im + x.re\right)\right) - \left(x.im + x.im\right)\right)}\]
  9. Using strategy rm
  10. Applied associate-*l*0.3

    \[\leadsto x.re \cdot \left(\left(x.re + x.im\right) \cdot x.re\right) + \color{blue}{x.im \cdot \left(x.re \cdot \left(\left(-\left(x.im + x.re\right)\right) - \left(x.im + x.im\right)\right)\right)}\]
  11. Removed slow pow expressions.

Runtime

Time bar (total: 1.8m)Debug logProfile

herbie shell --seed '#(1062930989 876886121 3990119081 3032829768 3060892583 1929069376)' 
(FPCore (x.re x.im)
  :name "math.cube on complex, real part"
  (- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im)))