Average Error: 31.0 → 17.6
Time: 1.5s
Precision: binary64
\[\]
\[\]

Error

Bits error versus re

Bits error versus im

Derivation

  1. Split input into 3 regimes
  2. if re < -2.3287772795912036e57

    1. Initial program 45.5

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

      \[\leadsto \]
    3. Simplified12.3

      \[\leadsto \]

    if -2.3287772795912036e57 < re < 7.5384845989707597e108

    1. Initial program 21.0

      \[\]

    if 7.5384845989707597e108 < re

    1. Initial program 53.0

      \[\]
    2. Taylor expanded around inf 10.6

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

    \[\leadsto \]

Reproduce

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