Average Error: 6.9 → 0.2
Time: 1.6m
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\]
\[\left(x.re + x.im\right) \cdot \left(\left(x.re - x.im\right) \cdot x.re\right) - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\]

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. Using strategy rm
  3. Applied difference-of-squares6.9

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

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

Runtime

Time bar (total: 1.6m)Debug logProfile

herbie shell --seed '#(1063313015 2771194459 1594909340 1344785158 2223560818 546365448)' 
(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)))