Average Error: 34.3 → 8.3
Time: 4.6s
Precision: 64
\[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b_2 \le -2.9600705709081314 \cdot 10^{66}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -1.5747579267209835 \cdot 10^{-308}:\\ \;\;\;\;\left(\frac{1}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{a}{\frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{c}}\right) \cdot \frac{1}{a}\\ \mathbf{elif}\;b_2 \le 2.3976737670559321 \cdot 10^{73}:\\ \;\;\;\;\frac{\left(-b_2\right) - \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

Derivation

  1. Split input into 4 regimes
  2. if b_2 < -2.9600705709081314e+66

    1. Initial program 58.0

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

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

    if -2.9600705709081314e+66 < b_2 < -1.5747579267209835e-308

    1. Initial program 30.2

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

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

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

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

      \[\leadsto \frac{0 + a \cdot c}{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{1}{a}\]
    8. Using strategy rm
    9. Applied add-sqr-sqrt16.3

      \[\leadsto \frac{0 + a \cdot c}{\color{blue}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}} \cdot \frac{1}{a}\]
    10. Applied *-un-lft-identity16.3

      \[\leadsto \frac{\color{blue}{1 \cdot \left(0 + a \cdot c\right)}}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{1}{a}\]
    11. Applied times-frac16.3

      \[\leadsto \color{blue}{\left(\frac{1}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{0 + a \cdot c}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}\right)} \cdot \frac{1}{a}\]
    12. Simplified14.9

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

    if -1.5747579267209835e-308 < b_2 < 2.397673767055932e+73

    1. Initial program 9.6

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

    if 2.397673767055932e+73 < b_2

    1. Initial program 42.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -2.9600705709081314 \cdot 10^{66}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -1.5747579267209835 \cdot 10^{-308}:\\ \;\;\;\;\left(\frac{1}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{a}{\frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{c}}\right) \cdot \frac{1}{a}\\ \mathbf{elif}\;b_2 \le 2.3976737670559321 \cdot 10^{73}:\\ \;\;\;\;\frac{\left(-b_2\right) - \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}\]

Reproduce

herbie shell --seed 2020129 
(FPCore (a b_2 c)
  :name "NMSE problem 3.2.1"
  :precision binary64
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))