Average Error: 33.8 → 7.2
Time: 1.1m
Precision: 64
Internal Precision: 128
\[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b_2 \le -3.606997037865995 \cdot 10^{+91}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \mathbf{elif}\;b_2 \le 1.0519409219155878 \cdot 10^{-213}:\\ \;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}{a}\\ \mathbf{elif}\;b_2 \le 8.282289051126851 \cdot 10^{+141}:\\ \;\;\;\;\frac{\sqrt[3]{\frac{1}{a}}}{\sqrt{b_2 \cdot b_2 - c \cdot a} + b_2} \cdot \left(\left(-c\right) \cdot \sqrt[3]{a}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{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 < -3.606997037865995e+91

    1. Initial program 44.0

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification44.0

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Taylor expanded around -inf 4.0

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

    if -3.606997037865995e+91 < b_2 < 1.0519409219155878e-213

    1. Initial program 10.0

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification10.0

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]

    if 1.0519409219155878e-213 < b_2 < 8.282289051126851e+141

    1. Initial program 38.2

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

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity38.2

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}\]
    6. Using strategy rm
    7. Applied div-inv38.2

      \[\leadsto \frac{1}{\color{blue}{a \cdot \frac{1}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}\]
    8. Applied associate-/r*38.2

      \[\leadsto \color{blue}{\frac{\frac{1}{a}}{\frac{1}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}\]
    9. Using strategy rm
    10. Applied flip--38.3

      \[\leadsto \frac{\frac{1}{a}}{\frac{1}{\color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c} - b_2 \cdot b_2}{\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2}}}}\]
    11. Applied associate-/r/38.4

      \[\leadsto \frac{\frac{1}{a}}{\color{blue}{\frac{1}{\sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c} - b_2 \cdot b_2} \cdot \left(\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2\right)}}\]
    12. Applied add-cube-cbrt38.6

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{\frac{1}{a}} \cdot \sqrt[3]{\frac{1}{a}}\right) \cdot \sqrt[3]{\frac{1}{a}}}}{\frac{1}{\sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c} - b_2 \cdot b_2} \cdot \left(\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2\right)}\]
    13. Applied times-frac38.6

      \[\leadsto \color{blue}{\frac{\sqrt[3]{\frac{1}{a}} \cdot \sqrt[3]{\frac{1}{a}}}{\frac{1}{\sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c} - b_2 \cdot b_2}} \cdot \frac{\sqrt[3]{\frac{1}{a}}}{\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2}}\]
    14. Simplified15.5

      \[\leadsto \color{blue}{\left(\left(a \cdot \left(-c\right) + 0\right) \cdot \left(\sqrt[3]{\frac{1}{a}} \cdot \sqrt[3]{\frac{1}{a}}\right)\right)} \cdot \frac{\sqrt[3]{\frac{1}{a}}}{\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2}\]
    15. Taylor expanded around inf 37.3

      \[\leadsto \color{blue}{\left(-1 \cdot \left({a}^{\frac{1}{3}} \cdot c\right)\right)} \cdot \frac{\sqrt[3]{\frac{1}{a}}}{\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2}\]
    16. Simplified9.2

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

    if 8.282289051126851e+141 < b_2

    1. Initial program 61.5

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification61.5

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Taylor expanded around inf 1.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -3.606997037865995 \cdot 10^{+91}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \mathbf{elif}\;b_2 \le 1.0519409219155878 \cdot 10^{-213}:\\ \;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}{a}\\ \mathbf{elif}\;b_2 \le 8.282289051126851 \cdot 10^{+141}:\\ \;\;\;\;\frac{\sqrt[3]{\frac{1}{a}}}{\sqrt{b_2 \cdot b_2 - c \cdot a} + b_2} \cdot \left(\left(-c\right) \cdot \sqrt[3]{a}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \end{array}\]

Runtime

Time bar (total: 1.1m)Debug logProfile

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