Average Error: 0.0 → 0.0
Time: 8.1s
Precision: 64
Internal Precision: 576
\[re \cdot re - im \cdot im\]
\[(re \cdot re + \left(-im \cdot im\right))_* + (\left(-im\right) \cdot im + \left(im \cdot im\right))_*\]

Error

Bits error versus re

Bits error versus im

Try it out

  1. Inputs

  2. Original Output:

    Herbie Output:

Derivation

  1. Initial program 0.0

    \[re \cdot re - im \cdot im\]
  2. Using strategy rm
  3. Applied prod-diff0.0

    \[\leadsto \color{blue}{(re \cdot re + \left(-im \cdot im\right))_* + (\left(-im\right) \cdot im + \left(im \cdot im\right))_*}\]

Runtime

Time bar (total: 8.1s)Debug logProfile

herbie shell --seed '#(1072361757 3390613284 2339397988 1175251238 145061547 3101881848)' +o rules:numerics
(FPCore (re im)
  :name "math.square on complex, real part"
  (- (* re re) (* im im)))