Average Error: 19.8 → 6.5
Time: 5.7s
Precision: binary64
\[\]
\[\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Split input into 3 regimes
  2. if b < -1.03114482829894554e131

    1. Initial program 34.1

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

      \[\leadsto \]
    3. Simplified1.8

      \[\leadsto \]

    if -1.03114482829894554e131 < b < 5.1560798101124901e113

    1. Initial program 8.7

      \[\]
    2. Simplified8.7

      \[\leadsto \]

    if 5.1560798101124901e113 < b

    1. Initial program 50.0

      \[\]
    2. Taylor expanded around inf 9.6

      \[\leadsto \]
    3. Simplified3.0

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

    \[\leadsto \]

Reproduce

herbie shell --seed 2020181 
(FPCore (a b c)
  :name "jeff quadratic root 1"
  :precision binary64
  (if (>= b 0.0) (/ (- (neg b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)) (/ (* 2.0 c) (+ (neg b) (sqrt (- (* b b) (* (* 4.0 a) c)))))))