Average Error: 32.6 → 8.8
Time: 1.7m
Precision: 64
Internal Precision: 3456
\[\frac{\left(-b2\right) - \sqrt{b2 \cdot b2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b2 \le -4.028298909023817 \cdot 10^{+63}:\\ \;\;\;\;\frac{c}{b2} \cdot \frac{-1}{2}\\ \mathbf{if}\;b2 \le -6.162851395522511 \cdot 10^{-154}:\\ \;\;\;\;\frac{\frac{c \cdot a}{\left(-b2\right) + \sqrt{b2 \cdot b2 - a \cdot c}}}{a}\\ \mathbf{if}\;b2 \le 4.4788708655259834 \cdot 10^{+105}:\\ \;\;\;\;\frac{\left(-b2\right) - \sqrt{b2 \cdot b2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\left(-\frac{b2}{a}\right) - \left(\frac{b2}{a} - \frac{c}{\frac{b2}{\frac{1}{2}}}\right)\\ \end{array}\]

Error

Bits error versus a

Bits error versus b2

Bits error versus c

Derivation

  1. Split input into 4 regimes
  2. if b2 < -4.028298909023817e+63

    1. Initial program 56.3

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

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

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

    if -4.028298909023817e+63 < b2 < -6.162851395522511e-154

    1. Initial program 36.9

      \[\frac{\left(-b2\right) - \sqrt{b2 \cdot b2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied flip--37.0

      \[\leadsto \frac{\color{blue}{\frac{\left(-b2\right) \cdot \left(-b2\right) - \sqrt{b2 \cdot b2 - a \cdot c} \cdot \sqrt{b2 \cdot b2 - a \cdot c}}{\left(-b2\right) + \sqrt{b2 \cdot b2 - a \cdot c}}}}{a}\]
    4. Applied simplify15.8

      \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{\left(-b2\right) + \sqrt{b2 \cdot b2 - a \cdot c}}}{a}\]

    if -6.162851395522511e-154 < b2 < 4.4788708655259834e+105

    1. Initial program 10.7

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

    if 4.4788708655259834e+105 < b2

    1. Initial program 45.6

      \[\frac{\left(-b2\right) - \sqrt{b2 \cdot b2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied div-inv45.7

      \[\leadsto \color{blue}{\left(\left(-b2\right) - \sqrt{b2 \cdot b2 - a \cdot c}\right) \cdot \frac{1}{a}}\]
    4. Taylor expanded around inf 10.9

      \[\leadsto \left(\left(-b2\right) - \color{blue}{\left(b2 - \frac{1}{2} \cdot \frac{c \cdot a}{b2}\right)}\right) \cdot \frac{1}{a}\]
    5. Applied simplify4.4

      \[\leadsto \color{blue}{\left(-\frac{b2}{a}\right) - \left(\frac{b2}{a} - \frac{c}{\frac{b2}{\frac{1}{2}}}\right)}\]
  3. Recombined 4 regimes into one program.

Runtime

Time bar (total: 1.7m)Debug log

herbie shell --seed '#(1743936871 1855164119 3668777427 1254258049 132811564 1366975197)' 
(FPCore (a b2 c)
  :name "NMSE problem 3.2.1, negative"
  :pre (and (>= (* b2 b2) (* a c)) (!= a 0))
  (/ (- (- b2) (sqrt (- (* b2 b2) (* a c)))) a))