Average Error: 19.5 → 7.8
Time: 5.0s
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 < -3.1989072191100113e139

    1. Initial program 35.6

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

      \[\leadsto \]
    3. Simplified2.2

      \[\leadsto \]

    if -3.1989072191100113e139 < b < 1.6693019817677781e-29

    1. Initial program 9.1

      \[\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt9.1

      \[\leadsto \]
    4. Applied sqrt-prod9.2

      \[\leadsto \]
    5. Simplified9.2

      \[\leadsto \]
    6. Simplified9.2

      \[\leadsto \]

    if 1.6693019817677781e-29 < b

    1. Initial program 28.8

      \[\]
    2. Taylor expanded around inf 12.7

      \[\leadsto \]
    3. Simplified9.1

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

    \[\leadsto \]

Reproduce

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