Average Error: 29.5 → 0.0
Time: 4.6s
Precision: 64
Internal Precision: 320
\[\sqrt{re \cdot re + im \cdot im}\]
\[\sqrt{re^2 + im^2}^*\]

Error

Bits error versus re

Bits error versus im

Try it out

  1. Inputs

  2. Original Output:

    Herbie Output:

Derivation

  1. Initial program 29.5

    \[\sqrt{re \cdot re + im \cdot im}\]
  2. Applied simplify0.0

    \[\leadsto \color{blue}{\sqrt{re^2 + im^2}^*}\]

Runtime

Time bar (total: 4.6s)Debug logProfile

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