Average Error: 33.4 → 8.0
Time: 42.9s
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 -2.5434455921029368 \cdot 10^{+64}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 3.386674077924689 \cdot 10^{-200}:\\ \;\;\;\;\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)}}\\ \mathbf{elif}\;b_2 \le 7.943654785924554 \cdot 10^{+151}:\\ \;\;\;\;\frac{c}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\left(-b_2\right) - \left(b_2 - \frac{1}{2} \cdot \frac{a \cdot c}{b_2}\right)}\\ \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 < -2.5434455921029368e+64

    1. Initial program 36.8

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

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

    if -2.5434455921029368e+64 < b_2 < 3.386674077924689e-200

    1. Initial program 10.9

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

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

    if 3.386674077924689e-200 < b_2 < 7.943654785924554e+151

    1. Initial program 38.5

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

      \[\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/41.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)}}\]
    5. Simplified17.8

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

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

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

    if 7.943654785924554e+151 < b_2

    1. Initial program 62.8

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

      \[\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/62.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. Simplified37.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)}\]
    6. Using strategy rm
    7. Applied times-frac37.0

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -2.5434455921029368 \cdot 10^{+64}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 3.386674077924689 \cdot 10^{-200}:\\ \;\;\;\;\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)}}\\ \mathbf{elif}\;b_2 \le 7.943654785924554 \cdot 10^{+151}:\\ \;\;\;\;\frac{c}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\left(-b_2\right) - \left(b_2 - \frac{1}{2} \cdot \frac{a \cdot c}{b_2}\right)}\\ \end{array}\]

Runtime

Time bar (total: 42.9s)Debug logProfile

herbie shell --seed 2018220 +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))