Average Error: 33.4 → 9.3
Time: 1.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 -1.264593303802393 \cdot 10^{+105}:\\ \;\;\;\;\frac{b_2}{a \cdot \frac{-1}{2}}\\ \mathbf{if}\;b_2 \le 1.2756034067314184 \cdot 10^{-220}:\\ \;\;\;\;\left(\sqrt{b_2 \cdot b_2 - c \cdot a} + \left(-b_2\right)\right) \cdot \frac{1}{a}\\ \mathbf{if}\;b_2 \le 2625303235.366119:\\ \;\;\;\;\frac{1}{\frac{a}{\frac{c \cdot a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\left(\left(-b_2\right) - b_2\right) - \frac{c}{b_2} \cdot \left(\frac{1}{2} \cdot a\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 < -1.264593303802393e+105

    1. Initial program 46.8

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

      \[\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 simplify61.8

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

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

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

    if -1.264593303802393e+105 < b_2 < 1.2756034067314184e-220

    1. Initial program 10.5

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

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

    if 1.2756034067314184e-220 < b_2 < 2625303235.366119

    1. Initial program 29.6

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied flip-+29.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 simplify17.5

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

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

    if 2625303235.366119 < b_2

    1. Initial program 54.9

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

      \[\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 simplify27.8

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

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

      \[\leadsto \frac{1}{\frac{a}{\frac{c \cdot a}{\left(-b_2\right) - \color{blue}{\left(b_2 + \frac{1}{2} \cdot \frac{c \cdot a}{b_2}\right)}}}}\]
    8. Applied simplify6.5

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

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;b_2 \le -1.264593303802393 \cdot 10^{+105}:\\ \;\;\;\;\frac{b_2}{a \cdot \frac{-1}{2}}\\ \mathbf{if}\;b_2 \le 1.2756034067314184 \cdot 10^{-220}:\\ \;\;\;\;\left(\sqrt{b_2 \cdot b_2 - c \cdot a} + \left(-b_2\right)\right) \cdot \frac{1}{a}\\ \mathbf{if}\;b_2 \le 2625303235.366119:\\ \;\;\;\;\frac{1}{\frac{a}{\frac{c \cdot a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\left(\left(-b_2\right) - b_2\right) - \frac{c}{b_2} \cdot \left(\frac{1}{2} \cdot a\right)}\\ \end{array}}\]

Runtime

Time bar (total: 1.9m)Debug logProfile

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