Average Error: 33.1 → 8.5
Time: 1.6m
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 -2.34219252374222 \cdot 10^{-103}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\\ \mathbf{if}\;\frac{\frac{-1}{2}}{b_2} \le -3.3742777787660067 \cdot 10^{-308}:\\ \;\;\;\;\frac{b_2}{a} \cdot -2\\ \mathbf{if}\;\frac{\frac{-1}{2}}{b_2} \le 11.414062506765472:\\ \;\;\;\;\frac{c}{b_2} \cdot \left(-\frac{1}{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - 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) < -2.34219252374222e-103

    1. Initial program 8.1

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

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

    if -2.34219252374222e-103 < (/ -1/2 b_2) < -3.3742777787660067e-308

    1. Initial program 45.5

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

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

    if -3.3742777787660067e-308 < (/ -1/2 b_2) < 11.414062506765472

    1. Initial program 55.5

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Taylor expanded around -inf 44.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 simplify5.9

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

    if 11.414062506765472 < (/ -1/2 b_2)

    1. Initial program 24.9

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

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

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

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

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;\frac{\frac{-1}{2}}{b_2} \le -2.34219252374222 \cdot 10^{-103}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\\ \mathbf{if}\;\frac{\frac{-1}{2}}{b_2} \le -3.3742777787660067 \cdot 10^{-308}:\\ \;\;\;\;\frac{b_2}{a} \cdot -2\\ \mathbf{if}\;\frac{\frac{-1}{2}}{b_2} \le 11.414062506765472:\\ \;\;\;\;\frac{c}{b_2} \cdot \left(-\frac{1}{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a}\\ \end{array}}\]

Runtime

Time bar (total: 1.6m)Debug logProfile

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