Average Error: 34.5 → 8.7
Time: 7.2s
Precision: binary64
\[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b_2 \le -6.64734878459886193 \cdot 10^{38}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -2.06216930025553428 \cdot 10^{-127}:\\ \;\;\;\;\frac{\frac{\frac{a}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{c}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{\sqrt[3]{e^{\log \left(\sqrt{b_2 \cdot b_2 - a \cdot c}\right)} - b_2}}}{a}\\ \mathbf{elif}\;b_2 \le 3.2255380126760236 \cdot 10^{123}:\\ \;\;\;\;\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 < -6.64734878459886193e38

    1. Initial program 56.3

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

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

    if -6.64734878459886193e38 < b_2 < -2.06216930025553428e-127

    1. Initial program 36.8

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

      \[\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. Simplified16.3

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

      \[\leadsto \frac{\frac{0 + a \cdot c}{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    6. Using strategy rm
    7. Applied add-cube-cbrt17.0

      \[\leadsto \frac{\frac{0 + a \cdot c}{\color{blue}{\left(\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\right) \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}{a}\]
    8. Applied associate-/r*17.0

      \[\leadsto \frac{\color{blue}{\frac{\frac{0 + a \cdot c}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}{a}\]
    9. Simplified14.7

      \[\leadsto \frac{\frac{\color{blue}{\frac{a}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{c}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    10. Using strategy rm
    11. Applied add-exp-log15.6

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

    if -2.06216930025553428e-127 < b_2 < 3.2255380126760236e123

    1. Initial program 11.5

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

    if 3.2255380126760236e123 < b_2

    1. Initial program 54.6

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -6.64734878459886193 \cdot 10^{38}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -2.06216930025553428 \cdot 10^{-127}:\\ \;\;\;\;\frac{\frac{\frac{a}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{c}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{\sqrt[3]{e^{\log \left(\sqrt{b_2 \cdot b_2 - a \cdot c}\right)} - b_2}}}{a}\\ \mathbf{elif}\;b_2 \le 3.2255380126760236 \cdot 10^{123}:\\ \;\;\;\;\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 2020147 
(FPCore (a b_2 c)
  :name "quad2m (problem 3.2.1, negative)"
  :precision binary64
  (/ (- (neg b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))