Average Error: 33.4 → 8.8
Time: 1.9m
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{c}{\left(-\frac{1}{2}\right) \cdot \frac{c}{b_2}} \le -6.559374218424621 \cdot 10^{+128}:\\ \;\;\;\;\frac{c}{b_2} \cdot \frac{1}{2} - \frac{b_2}{a} \cdot 2\\ \mathbf{if}\;\frac{c}{\left(-\frac{1}{2}\right) \cdot \frac{c}{b_2}} \le 9.006552185340026 \cdot 10^{-127}:\\ \;\;\;\;\frac{-b_2}{a} - \frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{if}\;\frac{c}{\left(-\frac{1}{2}\right) \cdot \frac{c}{b_2}} \le 2.8868738160878425 \cdot 10^{+96}:\\ \;\;\;\;\frac{c \cdot a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\frac{a}{b_2} \cdot \left(c \cdot \frac{1}{2}\right) - \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 (/ c (* (- 1/2) (/ c b_2))) < -6.559374218424621e+128

    1. Initial program 48.4

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

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

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

    if -6.559374218424621e+128 < (/ c (* (- 1/2) (/ c b_2))) < 9.006552185340026e-127

    1. Initial program 11.7

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

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

    if 9.006552185340026e-127 < (/ c (* (- 1/2) (/ c b_2))) < 2.8868738160878425e+96

    1. Initial program 42.1

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

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

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

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

    if 2.8868738160878425e+96 < (/ c (* (- 1/2) (/ c b_2)))

    1. Initial program 57.0

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

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

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

      \[\leadsto \color{blue}{\frac{c \cdot a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \frac{1}{a}}\]
    8. Taylor expanded around -inf 14.0

      \[\leadsto \frac{c \cdot a}{\color{blue}{\left(\frac{1}{2} \cdot \frac{c \cdot a}{b_2} - b_2\right)} - b_2} \cdot \frac{1}{a}\]
    9. Applied simplify2.5

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

Runtime

Time bar (total: 1.9m)Debug logProfile

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