Average Error: 33.8 → 6.7
Time: 1.5m
Precision: 64
Internal Precision: 3136
\[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b_2 \le -1.2233919975380109 \cdot 10^{+119}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{if}\;b_2 \le 6.2316798611742 \cdot 10^{-310}:\\ \;\;\;\;\frac{1}{a} \cdot \left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - c \cdot a}\right)\\ \mathbf{if}\;b_2 \le 1.1070225812919294 \cdot 10^{+83}:\\ \;\;\;\;\frac{c}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\frac{a}{b_2} \cdot \left(c \cdot \frac{1}{2}\right) - b_2 \cdot 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 < -1.2233919975380109e+119

    1. Initial program 49.9

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

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

    if -1.2233919975380109e+119 < b_2 < 6.2316798611742e-310

    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.1

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

    if 6.2316798611742e-310 < b_2 < 1.1070225812919294e+83

    1. Initial program 31.9

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

      \[\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.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-identity17.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-frac14.9

      \[\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*10.5

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

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

    if 1.1070225812919294e+83 < b_2

    1. Initial program 57.7

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

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

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

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

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;b_2 \le -1.2233919975380109 \cdot 10^{+119}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{if}\;b_2 \le 6.2316798611742 \cdot 10^{-310}:\\ \;\;\;\;\frac{1}{a} \cdot \left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - c \cdot a}\right)\\ \mathbf{if}\;b_2 \le 1.1070225812919294 \cdot 10^{+83}:\\ \;\;\;\;\frac{c}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\frac{a}{b_2} \cdot \left(c \cdot \frac{1}{2}\right) - b_2 \cdot 2}\\ \end{array}}\]

Runtime

Time bar (total: 1.5m)Debug logProfile

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