Average Error: 31.5 → 17.2
Time: 1.8s
Precision: binary64
\[\]
\[\]

Error

Bits error versus re

Bits error versus im

Derivation

  1. Split input into 3 regimes
  2. if re < -3.4475662606183263e130

    1. Initial program 56.9

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

      \[\leadsto \]
    3. Simplified7.7

      \[\leadsto \]

    if -3.4475662606183263e130 < re < 1.8766509938470789e142

    1. Initial program 20.8

      \[\]

    if 1.8766509938470789e142 < re

    1. Initial program 60.5

      \[\]
    2. Taylor expanded around inf 8.5

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

    \[\leadsto \]

Reproduce

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