Average Error: 33.8 → 7.0
Time: 4.9m
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 -3.1927207612853347 \cdot 10^{+93}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le -1.8693079465846072 \cdot 10^{-171}:\\ \;\;\;\;\left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - c \cdot a}\right) \cdot \frac{1}{a}\\ \mathbf{elif}\;b_2 \le 1.2851922611689858 \cdot 10^{+75}:\\ \;\;\;\;\frac{c}{\frac{a}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{-2 \cdot b_2}\\ \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 < -3.1927207612853347e+93

    1. Initial program 44.8

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

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

    if -3.1927207612853347e+93 < b_2 < -1.8693079465846072e-171

    1. Initial program 6.3

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

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

    if -1.8693079465846072e-171 < b_2 < 1.2851922611689858e+75

    1. Initial program 27.9

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied flip-+28.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}\]
    4. Applied associate-/l/33.7

      \[\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)}}\]
    5. Simplified22.0

      \[\leadsto \frac{\color{blue}{c \cdot a}}{a \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}\]
    6. Using strategy rm
    7. Applied associate-/l*18.1

      \[\leadsto \color{blue}{\frac{c}{\frac{a \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}{a}}}\]
    8. Using strategy rm
    9. Applied associate-/l*11.0

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

    if 1.2851922611689858e+75 < b_2

    1. Initial program 57.4

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

      \[\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}\]
    4. Applied associate-/l/57.8

      \[\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)}}\]
    5. Simplified30.6

      \[\leadsto \frac{\color{blue}{c \cdot a}}{a \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}\]
    6. Using strategy rm
    7. Applied associate-/l*29.4

      \[\leadsto \color{blue}{\frac{c}{\frac{a \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}{a}}}\]
    8. Taylor expanded around 0 3.5

      \[\leadsto \frac{c}{\color{blue}{-2 \cdot b_2}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification7.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -3.1927207612853347 \cdot 10^{+93}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le -1.8693079465846072 \cdot 10^{-171}:\\ \;\;\;\;\left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - c \cdot a}\right) \cdot \frac{1}{a}\\ \mathbf{elif}\;b_2 \le 1.2851922611689858 \cdot 10^{+75}:\\ \;\;\;\;\frac{c}{\frac{a}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{-2 \cdot b_2}\\ \end{array}\]

Runtime

Time bar (total: 4.9m)Debug logProfile

herbie shell --seed 2018215 +o rules:numerics
(FPCore (a b_2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))