Average Error: 33.2 → 9.9
Time: 1.0m
Precision: 64
Internal Precision: 3392
\[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b_2 \le -1.6457378087109476 \cdot 10^{-83}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{if}\;b_2 \le 1.326155867761659 \cdot 10^{+154}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot \frac{1}{2}}{b_2} - \frac{2}{\frac{a}{b_2}}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b_2

Bits error versus c

Derivation

  1. Split input into 3 regimes
  2. if b_2 < -1.6457378087109476e-83

    1. Initial program 52.0

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Taylor expanded around -inf 20.3

      \[\leadsto \frac{\color{blue}{\frac{-1}{2} \cdot \frac{c \cdot a}{b_2}}}{a}\]
    3. Applied simplify9.2

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b_2}}\]

    if -1.6457378087109476e-83 < b_2 < 1.326155867761659e+154

    1. Initial program 12.1

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]

    if 1.326155867761659e+154 < b_2

    1. Initial program 60.8

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Taylor expanded around inf 10.4

      \[\leadsto \frac{\color{blue}{\frac{1}{2} \cdot \frac{c \cdot a}{b_2} - 2 \cdot b_2}}{a}\]
    3. Applied simplify2.4

      \[\leadsto \color{blue}{\frac{c \cdot \frac{1}{2}}{b_2} - \frac{2}{\frac{a}{b_2}}}\]
  3. Recombined 3 regimes into one program.

Runtime

Time bar (total: 1.0m)Debug logProfile

herbie shell --seed '#(1071501266 3581234924 1086666455 2685055582 1243441566 1802958749)' 
(FPCore (a b_2 c)
  :name "quad2m (problem 3.2.1, negative)"
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))