Average Error: 33.6 → 10.2
Time: 1.5m
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 -7.169092009692374 \cdot 10^{-54}:\\ \;\;\;\;\frac{\frac{-1}{2} \cdot c}{b_2}\\ \mathbf{if}\;b_2 \le 3.5444769557638723 \cdot 10^{+95}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\\ \mathbf{else}:\\ \;\;\;\;-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 < -7.169092009692374e-54

    1. Initial program 53.0

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    4. Taylor expanded around -inf 19.5

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

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

    if -7.169092009692374e-54 < b_2 < 3.5444769557638723e+95

    1. Initial program 14.0

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

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

    if 3.5444769557638723e+95 < b_2

    1. Initial program 44.2

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

      \[\leadsto \color{blue}{-2 \cdot \frac{b_2}{a}}\]
  3. Recombined 3 regimes into one program.

Runtime

Time bar (total: 1.5m)Debug logProfile

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