Average Error: 33.5 → 9.9
Time: 1.5m
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}\;\frac{\frac{-1}{2}}{b_2} \le -1.220043164982416 \cdot 10^{+37}:\\ \;\;\;\;\left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \mathbf{if}\;\frac{\frac{-1}{2}}{b_2} \le -8.129679970553972 \cdot 10^{-307}:\\ \;\;\;\;\frac{c}{\frac{b_2}{\frac{-1}{2}}}\\ \mathbf{if}\;\frac{\frac{-1}{2}}{b_2} \le 1.2469313830977722 \cdot 10^{-93}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{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 (/ -1/2 b_2) < -1.220043164982416e+37

    1. Initial program 22.7

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

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

    if -1.220043164982416e+37 < (/ -1/2 b_2) < -8.129679970553972e-307

    1. Initial program 54.0

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

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

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

    if -8.129679970553972e-307 < (/ -1/2 b_2) < 1.2469313830977722e-93

    1. Initial program 43.7

      \[\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 1.2469313830977722e-93 < (/ -1/2 b_2)

    1. Initial program 8.9

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

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

Runtime

Time bar (total: 1.5m)Debug logProfile

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