Average Error: 37.8 → 5.3
Time: 2.1m
Precision: 64
Internal precision: 2944
\[\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b/2 \le -3.093544874321455 \cdot 10^{-77}:\\ \;\;\;\;\frac{\frac{-1}{2}}{b/2} \cdot c\\ \mathbf{if}\;b/2 \le 5.845042913155354 \cdot 10^{+61}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b/2} \cdot \frac{1}{2} + \frac{\left(-b/2\right) - b/2}{a}\\ \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 < -3.093544874321455e-77

    1. Initial program 59.2

      \[\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}{a}\]
    2. Applied taylor 15.0

      \[\leadsto \frac{\frac{-1}{2} \cdot \frac{a \cdot c}{b/2}}{a}\]
    3. Taylor expanded around -inf 15.0

      \[\leadsto \frac{\color{blue}{\frac{-1}{2} \cdot \frac{a \cdot c}{b/2}}}{a}\]
    4. Applied simplify 0.2

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

    if -3.093544874321455e-77 < b/2 < 5.845042913155354e+61

    1. Initial program 13.2

      \[\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied clear-num 13.3

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}}}\]

    if 5.845042913155354e+61 < b/2

    1. Initial program 41.5

      \[\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied clear-num 41.6

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}}}\]
    4. Applied taylor 12.2

      \[\leadsto \frac{1}{\frac{a}{\left(-b/2\right) - \left(b/2 - \frac{1}{2} \cdot \frac{a \cdot c}{b/2}\right)}}\]
    5. Taylor expanded around inf 12.2

      \[\leadsto \frac{1}{\frac{a}{\left(-b/2\right) - \color{blue}{\left(b/2 - \frac{1}{2} \cdot \frac{a \cdot c}{b/2}\right)}}}\]
    6. Applied simplify 0.1

      \[\leadsto \color{blue}{\frac{c}{b/2} \cdot \frac{1}{2} + \frac{\left(-b/2\right) - b/2}{a}}\]
  3. Recombined 3 regimes into one program.
  4. Removed slow pow expressions

Runtime

Time bar (total: 2.1m) Debug log

Please include this information when filing a bug report:

herbie shell --seed '#(772101555 1905824529 294602591 2478279198 2123125427 4197813737)'
(FPCore (a b/2 c)
  :name "quad2m (problem 3.2.1, negative)"
  (/ (- (- b/2) (sqrt (- (sqr b/2) (* a c)))) a))