Average Error: 33.9 → 13.2
Time: 48.6s
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.7412060648765384 \cdot 10^{+90}:\\ \;\;\;\;\frac{\frac{-1}{2} \cdot \frac{a \cdot c}{b_2}}{a}\\ \mathbf{elif}\;b_2 \le -2.9108748169166987 \cdot 10^{-67}:\\ \;\;\;\;\frac{a \cdot c}{\left(\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)\right) \cdot a}\\ \mathbf{elif}\;b_2 \le -2.1613479380498387 \cdot 10^{-84}:\\ \;\;\;\;\frac{\frac{-1}{2} \cdot \frac{a \cdot c}{b_2}}{a}\\ \mathbf{elif}\;b_2 \le 2.417420081991872 \cdot 10^{+49}:\\ \;\;\;\;(\left(-b_2\right) \cdot \left(\frac{1}{a}\right) + \left(-\frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\right))_*\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b_2\right) - (\left(\frac{c}{b_2} \cdot a\right) \cdot \frac{-1}{2} + b_2)_*}{a}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b_2

Bits error versus c

Derivation

  1. Split input into 4 regimes
  2. if b_2 < -1.7412060648765384e+90 or -2.9108748169166987e-67 < b_2 < -2.1613479380498387e-84

    1. Initial program 56.9

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification56.9

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

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

    if -1.7412060648765384e+90 < b_2 < -2.9108748169166987e-67

    1. Initial program 44.0

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification44.0

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    3. Using strategy rm
    4. Applied flip--44.1

      \[\leadsto \frac{\color{blue}{\frac{\left(-b_2\right) \cdot \left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}}{a}\]
    5. Applied associate-/l/47.1

      \[\leadsto \color{blue}{\frac{\left(-b_2\right) \cdot \left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}{a \cdot \left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}\]
    6. Simplified17.1

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

    if -2.1613479380498387e-84 < b_2 < 2.417420081991872e+49

    1. Initial program 14.1

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification14.1

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    3. Using strategy rm
    4. Applied div-sub14.1

      \[\leadsto \color{blue}{\frac{-b_2}{a} - \frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a}}\]
    5. Using strategy rm
    6. Applied div-inv14.1

      \[\leadsto \color{blue}{\left(-b_2\right) \cdot \frac{1}{a}} - \frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    7. Applied fma-neg14.1

      \[\leadsto \color{blue}{(\left(-b_2\right) \cdot \left(\frac{1}{a}\right) + \left(-\frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\right))_*}\]

    if 2.417420081991872e+49 < b_2

    1. Initial program 36.6

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification36.6

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

      \[\leadsto \frac{\left(-b_2\right) - \color{blue}{\left(b_2 - \frac{1}{2} \cdot \frac{a \cdot c}{b_2}\right)}}{a}\]
    4. Simplified5.3

      \[\leadsto \frac{\left(-b_2\right) - \color{blue}{(\left(\frac{c}{b_2} \cdot a\right) \cdot \frac{-1}{2} + b_2)_*}}{a}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification13.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.7412060648765384 \cdot 10^{+90}:\\ \;\;\;\;\frac{\frac{-1}{2} \cdot \frac{a \cdot c}{b_2}}{a}\\ \mathbf{elif}\;b_2 \le -2.9108748169166987 \cdot 10^{-67}:\\ \;\;\;\;\frac{a \cdot c}{\left(\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)\right) \cdot a}\\ \mathbf{elif}\;b_2 \le -2.1613479380498387 \cdot 10^{-84}:\\ \;\;\;\;\frac{\frac{-1}{2} \cdot \frac{a \cdot c}{b_2}}{a}\\ \mathbf{elif}\;b_2 \le 2.417420081991872 \cdot 10^{+49}:\\ \;\;\;\;(\left(-b_2\right) \cdot \left(\frac{1}{a}\right) + \left(-\frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\right))_*\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b_2\right) - (\left(\frac{c}{b_2} \cdot a\right) \cdot \frac{-1}{2} + b_2)_*}{a}\\ \end{array}\]

Runtime

Time bar (total: 48.6s)Debug logProfile

herbie shell --seed 2018248 +o rules:numerics
(FPCore (a b_2 c)
  :name "quad2m (problem 3.2.1, negative)"
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))