Average Error: 19.6 → 6.5
Time: 6.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 < -9.42133325574221009e131

    1. Initial program 55.9

      \[\]
    2. Taylor expanded around inf 55.9

      \[\leadsto \]
    3. Simplified55.9

      \[\leadsto \]
    4. Taylor expanded around -inf 10.7

      \[\leadsto \]
    5. Simplified2.7

      \[\leadsto \]

    if -9.42133325574221009e131 < b < 3.92178089451345625e97

    1. Initial program 8.5

      \[\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt8.5

      \[\leadsto \]
    4. Applied sqrt-prod8.6

      \[\leadsto \]
    5. Simplified8.6

      \[\leadsto \]
    6. Simplified8.6

      \[\leadsto \]

    if 3.92178089451345625e97 < b

    1. Initial program 29.1

      \[\]
    2. Taylor expanded around inf 6.8

      \[\leadsto \]
    3. Simplified3.0

      \[\leadsto \]
    4. Using strategy rm
    5. Applied add-exp-log3.0

      \[\leadsto \]
    6. 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 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))))