Average Error: 33.1 → 9.5
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}\;\frac{\frac{-1}{2}}{b_2} \le -8189120166.134877:\\ \;\;\;\;\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}\right) \cdot \frac{1}{a}\\ \mathbf{if}\;\frac{\frac{-1}{2}}{b_2} \le -1.4183813613325507 \cdot 10^{-305}:\\ \;\;\;\;\frac{b_2}{a} \cdot -2\\ \mathbf{if}\;\frac{\frac{-1}{2}}{b_2} \le 8.286579634223413 \cdot 10^{+21}:\\ \;\;\;\;\frac{c}{b_2} \cdot \left(-\frac{1}{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{c}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}} \cdot \frac{a}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}}}{a}\\ \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 (/ -1/2 b_2) < -8189120166.134877

    1. Initial program 11.0

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

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

    if -8189120166.134877 < (/ -1/2 b_2) < -1.4183813613325507e-305

    1. Initial program 29.0

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

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

    if -1.4183813613325507e-305 < (/ -1/2 b_2) < 8.286579634223413e+21

    1. Initial program 54.7

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

      \[\leadsto \frac{\left(-b_2\right) - \color{blue}{\left(\frac{1}{2} \cdot \frac{c \cdot a}{b_2} - b_2\right)}}{a}\]
    3. Applied simplify7.0

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

    if 8.286579634223413e+21 < (/ -1/2 b_2)

    1. Initial program 22.6

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

      \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}\]
    5. Applied simplify15.7

      \[\leadsto \frac{\frac{c \cdot a}{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    6. Using strategy rm
    7. Applied add-cube-cbrt16.5

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

      \[\leadsto \frac{\color{blue}{\frac{c}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{a}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}{a}\]
  3. Recombined 4 regimes into one program.
  4. Applied simplify9.5

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;\frac{\frac{-1}{2}}{b_2} \le -8189120166.134877:\\ \;\;\;\;\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}\right) \cdot \frac{1}{a}\\ \mathbf{if}\;\frac{\frac{-1}{2}}{b_2} \le -1.4183813613325507 \cdot 10^{-305}:\\ \;\;\;\;\frac{b_2}{a} \cdot -2\\ \mathbf{if}\;\frac{\frac{-1}{2}}{b_2} \le 8.286579634223413 \cdot 10^{+21}:\\ \;\;\;\;\frac{c}{b_2} \cdot \left(-\frac{1}{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{c}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}} \cdot \frac{a}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}}}{a}\\ \end{array}}\]

Runtime

Time bar (total: 1.7m)Debug logProfile

herbie shell --seed 2018170 +o rules:numerics
(FPCore (a b_2 c)
  :name "quad2m (problem 3.2.1, negative)"
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))