Average Error: 33.5 → 9.8
Time: 1.7m
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 -9.530429739568814 \cdot 10^{-89}:\\ \;\;\;\;\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.901490906505912 \cdot 10^{-308}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{if}\;\frac{\frac{1}{2}}{b_2} \le 2.0523929251058482 \cdot 10^{+32}:\\ \;\;\;\;\frac{c}{\frac{b_2}{\frac{-1}{2}}}\\ \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) < -9.530429739568814e-89

    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}}\]

    if -9.530429739568814e-89 < (/ 1/2 b_2) < 8.901490906505912e-308

    1. Initial program 42.8

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

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

    if 8.901490906505912e-308 < (/ 1/2 b_2) < 2.0523929251058482e+32

    1. Initial program 54.3

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

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

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

    if 2.0523929251058482e+32 < (/ 1/2 b_2)

    1. Initial program 22.9

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

      \[\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.7m)Debug logProfile

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