Average Error: 33.9 → 10.5
Time: 1.4m
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.794908999297654 \cdot 10^{-113}:\\ \;\;\;\;\left(-\frac{1}{2}\right) \cdot \frac{c}{b_2}\\ \mathbf{if}\;b_2 \le 1.805841061746776 \cdot 10^{+141}:\\ \;\;\;\;\left(-\frac{b_2}{a}\right) - \frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{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 3 regimes
  2. if b_2 < -2.794908999297654e-113

    1. Initial program 50.7

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

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

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

    if -2.794908999297654e-113 < b_2 < 1.805841061746776e+141

    1. Initial program 11.9

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

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

    if 1.805841061746776e+141 < b_2

    1. Initial program 56.2

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

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

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

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;b_2 \le -2.794908999297654 \cdot 10^{-113}:\\ \;\;\;\;\left(-\frac{1}{2}\right) \cdot \frac{c}{b_2}\\ \mathbf{if}\;b_2 \le 1.805841061746776 \cdot 10^{+141}:\\ \;\;\;\;\left(-\frac{b_2}{a}\right) - \frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \end{array}}\]

Runtime

Time bar (total: 1.4m)Debug logProfile

herbie shell --seed 2018206 +o rules:numerics
(FPCore (a b_2 c)
  :name "NMSE problem 3.2.1"
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))