Average Error: 6.9 → 0.3
Time: 25.0s
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) + \left(x.im \cdot x.re\right) \cdot \left(\left(-\left(x.im + x.re\right)\right) - \left(x.im + x.im\right)\right)\]

Error

Bits error versus x.re

Bits error versus x.im

Derivation

  1. Initial program 6.9

    \[\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 simplify 6.9

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

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

    \[\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)} - x.im \cdot \left(x.im + x.im\right)\right)\]
  6. Applied associate--l+ 6.9

    \[\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) - x.im \cdot \left(x.im + x.im\right)\right)\right)}\]
  7. Applied distribute-lft-in 6.9

    \[\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) - x.im \cdot \left(x.im + x.im\right)\right)}\]
  8. Applied simplify 0.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. Removed slow pow expressions

Runtime

Time bar (total: 25.0s) Debug logProfile

Please include this information when filing a bug report:

herbie shell --seed '#(1064524629 4159152179 2999149171 575749698 4006532819 692958815)'
(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)))