Average Error: 31.3 → 17.6
Time: 3.4s
Precision: binary64
\[\]
\[\]

Error

Bits error versus re

Bits error versus im

Derivation

  1. Split input into 4 regimes
  2. if re < -3.8911963948436084e148

    1. Initial program 62.5

      \[\]
    2. Taylor expanded around -inf 7.3

      \[\leadsto \]
    3. Simplified7.3

      \[\leadsto \]

    if -3.8911963948436084e148 < re < -7.0195584571619032e-182 or -1.05288433537404246e-271 < re < 4.84533569762603965e122

    1. Initial program 19.6

      \[\]

    if -7.0195584571619032e-182 < re < -1.05288433537404246e-271

    1. Initial program 32.2

      \[\]
    2. Taylor expanded around 0 34.9

      \[\leadsto \]

    if 4.84533569762603965e122 < re

    1. Initial program 56.3

      \[\]
    2. Taylor expanded around inf 8.9

      \[\leadsto \]
  3. Recombined 4 regimes into one program.
  4. Final simplification17.6

    \[\leadsto \]

Reproduce

herbie shell --seed 2020191 
(FPCore (re im)
  :name "math.abs on complex"
  :precision binary64
  (sqrt (+ (* re re) (* im im))))