Average Error: 33.8 → 11.9
Time: 29.7s
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.3557962116125723 \cdot 10^{+154}:\\ \;\;\;\;\frac{\frac{-1}{2} \cdot \frac{a \cdot c}{b_2}}{a}\\ \mathbf{elif}\;b_2 \le -1.6881136136793343 \cdot 10^{-90}:\\ \;\;\;\;\frac{\frac{a \cdot c}{a}}{\left(-b_2\right) + \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}\\ \mathbf{elif}\;b_2 \le 5.132553795382014 \cdot 10^{+47}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 + \left(-a \cdot c\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b_2

Bits error versus c

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 4 regimes
  2. if b_2 < -1.3557962116125723e+154

    1. Initial program 62.9

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

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

    if -1.3557962116125723e+154 < b_2 < -1.6881136136793343e-90

    1. Initial program 43.7

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt43.7

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}}}{a}\]
    4. Applied sqrt-prod47.2

      \[\leadsto \frac{\left(-b_2\right) - \color{blue}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}}{a}\]
    5. Using strategy rm
    6. Applied div-inv47.2

      \[\leadsto \color{blue}{\left(\left(-b_2\right) - \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}\right) \cdot \frac{1}{a}}\]
    7. Using strategy rm
    8. Applied flip--47.3

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

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

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

    if -1.6881136136793343e-90 < b_2 < 5.132553795382014e+47

    1. Initial program 13.6

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied sub-neg13.6

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

    if 5.132553795382014e+47 < b_2

    1. Initial program 36.1

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied sub-neg36.1

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

      \[\leadsto \color{blue}{-2 \cdot \frac{b_2}{a}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification11.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.3557962116125723 \cdot 10^{+154}:\\ \;\;\;\;\frac{\frac{-1}{2} \cdot \frac{a \cdot c}{b_2}}{a}\\ \mathbf{elif}\;b_2 \le -1.6881136136793343 \cdot 10^{-90}:\\ \;\;\;\;\frac{\frac{a \cdot c}{a}}{\left(-b_2\right) + \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}\\ \mathbf{elif}\;b_2 \le 5.132553795382014 \cdot 10^{+47}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 + \left(-a \cdot c\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array}\]

Runtime

Time bar (total: 29.7s)Debug logProfile

herbie shell --seed 2018254 
(FPCore (a b_2 c)
  :name "quad2m (problem 3.2.1, negative)"
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))