Average Error: 31.8 → 18.3
Time: 2.9s
Precision: binary64
\[\]
\[\]

Error

Bits error versus re

Bits error versus im

Derivation

  1. Split input into 3 regimes
  2. if re < -1.69098607420795857e60

    1. Initial program 44.5

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

      \[\leadsto \]
    3. Simplified12.0

      \[\leadsto \]

    if -1.69098607420795857e60 < re < 4.2484476987621222e82

    1. Initial program 22.6

      \[\]

    if 4.2484476987621222e82 < re

    1. Initial program 48.9

      \[\]
    2. Taylor expanded around inf 11.0

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

    \[\leadsto \]

Reproduce

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