Average Error: 19.8 → 6.9
Time: 6.8s
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 < -2.9425467623133534e153

    1. Initial program 64.0

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

      \[\leadsto \]
    3. Simplified3.0

      \[\leadsto \]

    if -2.9425467623133534e153 < b < 4.6437836518398973e80

    1. Initial program 9.0

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

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

      \[\leadsto \]
    5. Simplified9.1

      \[\leadsto \]
    6. Simplified9.1

      \[\leadsto \]

    if 4.6437836518398973e80 < b

    1. Initial program 28.7

      \[\]
    2. Taylor expanded around inf 7.0

      \[\leadsto \]
    3. Simplified2.9

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

    \[\leadsto \]

Reproduce

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