Average Error: 20.2 → 7.1
Time: 5.5s
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 < -5.7901015788997141e138

    1. Initial program 37.2

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

      \[\leadsto \]
    3. Simplified1.7

      \[\leadsto \]

    if -5.7901015788997141e138 < b < 5.974798443547602e57

    1. Initial program 9.0

      \[\]
    2. Simplified9.1

      \[\leadsto \]

    if 5.974798443547602e57 < b

    1. Initial program 39.3

      \[\]
    2. Taylor expanded around inf 11.0

      \[\leadsto \]
    3. Simplified6.0

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

    \[\leadsto \]

Reproduce

herbie shell --seed 2020191 
(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)))))))