Average Error: 34.2 → 10.2
Time: 4.1m
Precision: 64
Internal Precision: 128
\[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b_2 \le -6.614644252084147 \cdot 10^{-35}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -1.180471078121508 \cdot 10^{-156}:\\ \;\;\;\;\frac{c \cdot a}{a \cdot \left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - c \cdot a}\right)}\\ \mathbf{elif}\;b_2 \le -4.380258891361565 \cdot 10^{-166}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 5.1457556548524475 \cdot 10^{+64}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{(\frac{1}{2} \cdot \left(\frac{a}{\frac{b_2}{c}}\right) + \left(-2 \cdot b_2\right))_*}{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 < -6.614644252084147e-35 or -1.180471078121508e-156 < b_2 < -4.380258891361565e-166

    1. Initial program 53.3

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

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

    if -6.614644252084147e-35 < b_2 < -1.180471078121508e-156

    1. Initial program 30.3

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

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{{b_2}^{2} - a \cdot c}}}{a}\]
    3. Simplified30.3

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{b_2 \cdot b_2 - a \cdot c}}}{a}\]
    4. Using strategy rm
    5. Applied flip--30.4

      \[\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}\]
    6. Applied associate-/l/33.8

      \[\leadsto \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}}{a \cdot \left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}\]
    7. Simplified23.7

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

    if -4.380258891361565e-166 < b_2 < 5.1457556548524475e+64

    1. Initial program 11.9

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

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{{b_2}^{2} - a \cdot c}}}{a}\]
    3. Simplified11.9

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

    if 5.1457556548524475e+64 < b_2

    1. Initial program 38.6

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -6.614644252084147 \cdot 10^{-35}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -1.180471078121508 \cdot 10^{-156}:\\ \;\;\;\;\frac{c \cdot a}{a \cdot \left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - c \cdot a}\right)}\\ \mathbf{elif}\;b_2 \le -4.380258891361565 \cdot 10^{-166}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 5.1457556548524475 \cdot 10^{+64}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{(\frac{1}{2} \cdot \left(\frac{a}{\frac{b_2}{c}}\right) + \left(-2 \cdot b_2\right))_*}{a}\\ \end{array}\]

Reproduce

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