Average Error: 33.4 → 6.8
Time: 1.2m
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.813046744218146 \cdot 10^{+108}:\\ \;\;\;\;\frac{b_2}{a \cdot \frac{-1}{2}}\\ \mathbf{if}\;b_2 \le -1.155210343261811 \cdot 10^{-282}:\\ \;\;\;\;\left(\sqrt{b_2 \cdot b_2 - c \cdot a} + \left(-b_2\right)\right) \cdot \frac{1}{a}\\ \mathbf{if}\;b_2 \le 6.91130196611575 \cdot 10^{+143}:\\ \;\;\;\;\frac{c}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\frac{a \cdot \frac{1}{2}}{\frac{b_2}{c}} - 2 \cdot b_2}\\ \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.813046744218146e+108

    1. Initial program 47.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.9

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

      \[\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 -5.813046744218146e+108 < b_2 < -1.155210343261811e-282

    1. Initial program 9.0

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

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

    if -1.155210343261811e-282 < b_2 < 6.91130196611575e+143

    1. Initial program 33.1

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

      \[\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 simplify16.0

      \[\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 *-un-lft-identity16.0

      \[\leadsto \frac{\frac{c \cdot a}{\color{blue}{1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}}{a}\]
    7. Applied times-frac15.2

      \[\leadsto \frac{\color{blue}{\frac{c}{1} \cdot \frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}{a}\]
    8. Applied associate-/l*11.0

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

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

    if 6.91130196611575e+143 < b_2

    1. Initial program 61.3

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

      \[\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 simplify37.7

      \[\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 15.6

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

      \[\leadsto \color{blue}{\frac{c}{\frac{\frac{1}{2} \cdot a}{\frac{b_2}{c}} - 2 \cdot b_2}}\]
  3. Recombined 4 regimes into one program.
  4. Applied simplify6.8

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;b_2 \le -5.813046744218146 \cdot 10^{+108}:\\ \;\;\;\;\frac{b_2}{a \cdot \frac{-1}{2}}\\ \mathbf{if}\;b_2 \le -1.155210343261811 \cdot 10^{-282}:\\ \;\;\;\;\left(\sqrt{b_2 \cdot b_2 - c \cdot a} + \left(-b_2\right)\right) \cdot \frac{1}{a}\\ \mathbf{if}\;b_2 \le 6.91130196611575 \cdot 10^{+143}:\\ \;\;\;\;\frac{c}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\frac{a \cdot \frac{1}{2}}{\frac{b_2}{c}} - 2 \cdot b_2}\\ \end{array}}\]

Runtime

Time bar (total: 1.2m)Debug logProfile

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