Average Error: 33.7 → 6.4
Time: 25.0s
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 -2.4179539573507906 \cdot 10^{+153}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le -2.689070205918387 \cdot 10^{-289}:\\ \;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - c \cdot a} + \left(-b_2\right)}{a}\\ \mathbf{elif}\;b_2 \le 1.3398806128612029 \cdot 10^{+154}:\\ \;\;\;\;\frac{c}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{-2 \cdot \frac{b_2}{c}}\\ \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 < -2.4179539573507906e+153

    1. Initial program 60.6

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

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

    if -2.4179539573507906e+153 < b_2 < -2.689070205918387e-289

    1. Initial program 7.9

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

    if -2.689070205918387e-289 < b_2 < 1.3398806128612029e+154

    1. Initial program 33.4

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

      \[\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 associate-/l/37.5

      \[\leadsto \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}}{a \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}\]
    5. Simplified19.9

      \[\leadsto \frac{\color{blue}{a \cdot c}}{a \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}\]
    6. Using strategy rm
    7. Applied times-frac8.4

      \[\leadsto \color{blue}{\frac{a}{a} \cdot \frac{c}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\]
    8. Simplified8.4

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

    if 1.3398806128612029e+154 < b_2

    1. Initial program 62.9

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

      \[\leadsto \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}}{a \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}\]
    5. Simplified37.3

      \[\leadsto \frac{\color{blue}{a \cdot c}}{a \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}\]
    6. Using strategy rm
    7. Applied times-frac37.2

      \[\leadsto \color{blue}{\frac{a}{a} \cdot \frac{c}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\]
    8. Simplified37.2

      \[\leadsto \color{blue}{1} \cdot \frac{c}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}\]
    9. Using strategy rm
    10. Applied clear-num37.2

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

      \[\leadsto 1 \cdot \frac{1}{\color{blue}{-2 \cdot \frac{b_2}{c}}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification6.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -2.4179539573507906 \cdot 10^{+153}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le -2.689070205918387 \cdot 10^{-289}:\\ \;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - c \cdot a} + \left(-b_2\right)}{a}\\ \mathbf{elif}\;b_2 \le 1.3398806128612029 \cdot 10^{+154}:\\ \;\;\;\;\frac{c}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{-2 \cdot \frac{b_2}{c}}\\ \end{array}\]

Runtime

Time bar (total: 25.0s)Debug logProfile

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