Average Error: 33.8 → 7.2
Time: 1.7m
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.770906354773264 \cdot 10^{+119}:\\ \;\;\;\;\frac{\frac{b_2}{\frac{-1}{2}}}{a}\\ \mathbf{if}\;b_2 \le 5.571860619390778 \cdot 10^{-210}:\\ \;\;\;\;\left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \mathbf{if}\;b_2 \le 1.4399774592443239 \cdot 10^{+37}:\\ \;\;\;\;\frac{\frac{c}{\sqrt[3]{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt[3]{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}{\sqrt[3]{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\frac{a}{b_2} \cdot \left(\frac{1}{2} \cdot c\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 < -2.770906354773264e+119

    1. Initial program 50.1

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

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

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

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

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

    if -2.770906354773264e+119 < b_2 < 5.571860619390778e-210

    1. Initial program 10.5

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

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

    if 5.571860619390778e-210 < b_2 < 1.4399774592443239e+37

    1. Initial program 32.4

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

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

      \[\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 add-cube-cbrt18.3

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

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

      \[\leadsto \color{blue}{\frac{\frac{c}{\sqrt[3]{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt[3]{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}{\frac{a}{\frac{a}{\sqrt[3]{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}}}\]
    9. Applied simplify9.2

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

    if 1.4399774592443239e+37 < b_2

    1. Initial program 56.3

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

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

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

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

Runtime

Time bar (total: 1.7m)Debug logProfile

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