Average Error: 7.3 → 0.3
Time: 1.7m
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 7.3

    \[\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 simplify7.4

    \[\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-neg7.4

    \[\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-in7.4

    \[\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+7.4

    \[\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-in7.4

    \[\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.3

    \[\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.7m)Debug logProfile

herbie shell --seed '#(1063027428 1192549564 1443466578 604016274 3637110559 1698629644)' 
(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)))