Average Error: 32.8 → 7.1
Time: 1.0m
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.49466947661044 \cdot 10^{+70}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 2.8837329304169817 \cdot 10^{-269}:\\ \;\;\;\;\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)}}\\ \mathbf{elif}\;b_2 \le 9.140635277920892 \cdot 10^{+45}:\\ \;\;\;\;\frac{c}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\left(\frac{1}{2} \cdot c\right) \cdot \frac{a}{b_2} - \left(b_2 + b_2\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 < -5.49466947661044e+70

    1. Initial program 38.7

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

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

    if -5.49466947661044e+70 < b_2 < 2.8837329304169817e-269

    1. Initial program 9.9

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

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

    if 2.8837329304169817e-269 < b_2 < 9.140635277920892e+45

    1. Initial program 29.1

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

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

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

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

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

    if 9.140635277920892e+45 < b_2

    1. Initial program 56.0

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

      \[\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/56.6

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

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

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

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

      \[\leadsto 1 \cdot \frac{c}{\left(-b_2\right) - \color{blue}{\left(b_2 - \frac{1}{2} \cdot \frac{a \cdot c}{b_2}\right)}}\]
    10. Using strategy rm
    11. Applied add-sqr-sqrt7.9

      \[\leadsto 1 \cdot \frac{c}{\left(-b_2\right) - \color{blue}{\sqrt{b_2 - \frac{1}{2} \cdot \frac{a \cdot c}{b_2}} \cdot \sqrt{b_2 - \frac{1}{2} \cdot \frac{a \cdot c}{b_2}}}}\]
    12. Applied add-sqr-sqrt62.9

      \[\leadsto 1 \cdot \frac{c}{\color{blue}{\sqrt{-b_2} \cdot \sqrt{-b_2}} - \sqrt{b_2 - \frac{1}{2} \cdot \frac{a \cdot c}{b_2}} \cdot \sqrt{b_2 - \frac{1}{2} \cdot \frac{a \cdot c}{b_2}}}\]
    13. Applied prod-diff62.9

      \[\leadsto 1 \cdot \frac{c}{\color{blue}{(\left(\sqrt{-b_2}\right) \cdot \left(\sqrt{-b_2}\right) + \left(-\sqrt{b_2 - \frac{1}{2} \cdot \frac{a \cdot c}{b_2}} \cdot \sqrt{b_2 - \frac{1}{2} \cdot \frac{a \cdot c}{b_2}}\right))_* + (\left(-\sqrt{b_2 - \frac{1}{2} \cdot \frac{a \cdot c}{b_2}}\right) \cdot \left(\sqrt{b_2 - \frac{1}{2} \cdot \frac{a \cdot c}{b_2}}\right) + \left(\sqrt{b_2 - \frac{1}{2} \cdot \frac{a \cdot c}{b_2}} \cdot \sqrt{b_2 - \frac{1}{2} \cdot \frac{a \cdot c}{b_2}}\right))_*}}\]
    14. Simplified7.9

      \[\leadsto 1 \cdot \frac{c}{\color{blue}{\left(\left(\frac{1}{2} \cdot c\right) \cdot \frac{a}{b_2} - \left(b_2 + b_2\right)\right)} + (\left(-\sqrt{b_2 - \frac{1}{2} \cdot \frac{a \cdot c}{b_2}}\right) \cdot \left(\sqrt{b_2 - \frac{1}{2} \cdot \frac{a \cdot c}{b_2}}\right) + \left(\sqrt{b_2 - \frac{1}{2} \cdot \frac{a \cdot c}{b_2}} \cdot \sqrt{b_2 - \frac{1}{2} \cdot \frac{a \cdot c}{b_2}}\right))_*}\]
    15. Simplified4.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -5.49466947661044 \cdot 10^{+70}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 2.8837329304169817 \cdot 10^{-269}:\\ \;\;\;\;\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)}}\\ \mathbf{elif}\;b_2 \le 9.140635277920892 \cdot 10^{+45}:\\ \;\;\;\;\frac{c}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\left(\frac{1}{2} \cdot c\right) \cdot \frac{a}{b_2} - \left(b_2 + b_2\right)}\\ \end{array}\]

Runtime

Time bar (total: 1.0m)Debug logProfile

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