Average Error: 33.6 → 10.6
Time: 5.1s
Precision: binary64
\[\]
\[\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Target

Original33.6
Target20.9
Herbie10.6
\[\]

Derivation

  1. Split input into 3 regimes
  2. if b < -1.3061538410972681e63

    1. Initial program 39.9

      \[\]
    2. Simplified39.9

      \[\leadsto \]
    3. Taylor expanded around -inf 5.5

      \[\leadsto \]
    4. Simplified5.5

      \[\leadsto \]

    if -1.3061538410972681e63 < b < 9.6001021312979276e-81

    1. Initial program 13.7

      \[\]
    2. Simplified13.7

      \[\leadsto \]
    3. Using strategy rm
    4. Applied clear-num13.8

      \[\leadsto \]
    5. Simplified13.8

      \[\leadsto \]

    if 9.6001021312979276e-81 < b

    1. Initial program 52.4

      \[\]
    2. Simplified52.4

      \[\leadsto \]
    3. Taylor expanded around inf 9.5

      \[\leadsto \]
  3. Recombined 3 regimes into one program.
  4. Final simplification10.6

    \[\leadsto \]

Reproduce

herbie shell --seed 2020192 
(FPCore (a b c)
  :name "quadp (p42, positive)"
  :precision binary64
  :herbie-expected #f

  :herbie-target
  (if (< b 0.0) (/ (+ (neg b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)) (/ c (* a (/ (- (neg b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))))

  (/ (+ (neg b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))