Average Error: 33.5 → 9.4
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}\;b_2 \le -527818926895.3873:\\ \;\;\;\;\left(-\frac{1}{2}\right) \cdot \frac{c}{b_2}\\ \mathbf{if}\;b_2 \le -3.705461527675385 \cdot 10^{-80}:\\ \;\;\;\;\frac{\frac{a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a}\\ \mathbf{if}\;b_2 \le -6.821177813634889 \cdot 10^{-105}:\\ \;\;\;\;\left(-\frac{1}{2}\right) \cdot \frac{c}{b_2}\\ \mathbf{if}\;b_2 \le 6.922413474805441 \cdot 10^{+112}:\\ \;\;\;\;\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b_2

Bits error versus c

Derivation

  1. Split input into 4 regimes
  2. if b_2 < -527818926895.3873 or -3.705461527675385e-80 < b_2 < -6.821177813634889e-105

    1. Initial program 53.8

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

      \[\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 simplify6.9

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

    if -527818926895.3873 < b_2 < -3.705461527675385e-80

    1. Initial program 41.1

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

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

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

    if -6.821177813634889e-105 < b_2 < 6.922413474805441e+112

    1. Initial program 11.8

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

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

    if 6.922413474805441e+112 < b_2

    1. Initial program 48.1

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

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

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;b_2 \le -527818926895.3873:\\ \;\;\;\;\left(-\frac{1}{2}\right) \cdot \frac{c}{b_2}\\ \mathbf{if}\;b_2 \le -3.705461527675385 \cdot 10^{-80}:\\ \;\;\;\;\frac{\frac{a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a}\\ \mathbf{if}\;b_2 \le -6.821177813634889 \cdot 10^{-105}:\\ \;\;\;\;\left(-\frac{1}{2}\right) \cdot \frac{c}{b_2}\\ \mathbf{if}\;b_2 \le 6.922413474805441 \cdot 10^{+112}:\\ \;\;\;\;\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array}}\]

Runtime

Time bar (total: 1.6m)Debug logProfile

herbie shell --seed '#(1071373924 2949776965 1885069702 3247780810 90874544 2263903749)' +o rules:numerics
(FPCore (a b_2 c)
  :name "NMSE problem 3.2.1"
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))