Average Error: 34.5 → 13.0
Time: 22.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 -5.483710144579545 \cdot 10^{+152}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 1.922455145018763 \cdot 10^{-57}:\\ \;\;\;\;\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - c \cdot a}}} - \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 1.592377222321251 \cdot 10^{+65}:\\ \;\;\;\;\frac{\left(-c\right) \cdot a}{\left(\sqrt{b_2 \cdot b_2 - c \cdot a} + b_2\right) \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-1}{2} \cdot \frac{c \cdot a}{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 < -5.483710144579545e+152

    1. Initial program 60.1

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

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Using strategy rm
    4. Applied div-sub60.1

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a} - \frac{b_2}{a}}\]
    5. Taylor expanded around -inf 2.2

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

    if -5.483710144579545e+152 < b_2 < 1.922455145018763e-57

    1. Initial program 13.4

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification13.4

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Using strategy rm
    4. Applied div-sub13.4

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a} - \frac{b_2}{a}}\]
    5. Using strategy rm
    6. Applied clear-num13.4

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

    if 1.922455145018763e-57 < b_2 < 1.592377222321251e+65

    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{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Using strategy rm
    4. Applied flip--44.0

      \[\leadsto \frac{\color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c} - b_2 \cdot b_2}{\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2}}}{a}\]
    5. Applied associate-/l/46.0

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

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

    if 1.592377222321251e+65 < b_2

    1. Initial program 57.0

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

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - 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}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification13.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -5.483710144579545 \cdot 10^{+152}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 1.922455145018763 \cdot 10^{-57}:\\ \;\;\;\;\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - c \cdot a}}} - \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 1.592377222321251 \cdot 10^{+65}:\\ \;\;\;\;\frac{\left(-c\right) \cdot a}{\left(\sqrt{b_2 \cdot b_2 - c \cdot a} + b_2\right) \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-1}{2} \cdot \frac{c \cdot a}{b_2}}{a}\\ \end{array}\]

Runtime

Time bar (total: 22.7s)Debug logProfile

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