Average Error: 19.5 → 6.7
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 < -3.27738173899066951e67

    1. Initial program 41.4

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

      \[\leadsto \]
    3. Simplified4.4

      \[\leadsto \]
    4. Taylor expanded around 0 4.3

      \[\leadsto \]
    5. Simplified4.3

      \[\leadsto \]

    if -3.27738173899066951e67 < b < 4.4305067213711337e95

    1. Initial program 9.0

      \[\]
    2. Using strategy rm
    3. Applied add-cube-cbrt9.2

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

      \[\leadsto \]
    5. Simplified9.2

      \[\leadsto \]
    6. Simplified9.2

      \[\leadsto \]

    if 4.4305067213711337e95 < b

    1. Initial program 28.5

      \[\]
    2. Taylor expanded around inf 6.0

      \[\leadsto \]
    3. Simplified2.3

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

    \[\leadsto \]

Reproduce

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