Average Error: 32.6 → 8.0
Time: 4.5s
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 -3.926021394052593 \cdot 10^{118}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 1.05448800274897715 \cdot 10^{-275}:\\ \;\;\;\;\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{elif}\;b_2 \le 8.84337229694695364 \cdot 10^{91}:\\ \;\;\;\;\frac{\frac{a}{-\sqrt[3]{b_2 + \sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt[3]{b_2 + \sqrt{b_2 \cdot b_2 - a \cdot c}}}}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{\frac{c}{\sqrt[3]{b_2 + \sqrt{b_2 \cdot b_2 - a \cdot c}}}}{\sqrt[3]{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \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 < -3.926021394052593e118

    1. Initial program 52.1

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

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

    if -3.926021394052593e118 < b_2 < 1.05448800274897715e-275

    1. Initial program 10.3

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

    if 1.05448800274897715e-275 < b_2 < 8.84337229694695364e91

    1. Initial program 33.2

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt33.2

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

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

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

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

      \[\leadsto \frac{\frac{a \cdot c}{\color{blue}{-\left(b_2 + \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}}{a}\]
    9. Using strategy rm
    10. Applied add-cube-cbrt17.3

      \[\leadsto \frac{\frac{a \cdot c}{-\left(b_2 + \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}{\color{blue}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}}\]
    11. Applied add-cube-cbrt17.5

      \[\leadsto \frac{\frac{a \cdot c}{-\color{blue}{\left(\sqrt[3]{b_2 + \sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt[3]{b_2 + \sqrt{b_2 \cdot b_2 - a \cdot c}}\right) \cdot \sqrt[3]{b_2 + \sqrt{b_2 \cdot b_2 - a \cdot c}}}}}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}\]
    12. Applied distribute-lft-neg-in17.5

      \[\leadsto \frac{\frac{a \cdot c}{\color{blue}{\left(-\sqrt[3]{b_2 + \sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt[3]{b_2 + \sqrt{b_2 \cdot b_2 - a \cdot c}}\right) \cdot \sqrt[3]{b_2 + \sqrt{b_2 \cdot b_2 - a \cdot c}}}}}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}\]
    13. Applied times-frac15.2

      \[\leadsto \frac{\color{blue}{\frac{a}{-\sqrt[3]{b_2 + \sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt[3]{b_2 + \sqrt{b_2 \cdot b_2 - a \cdot c}}} \cdot \frac{c}{\sqrt[3]{b_2 + \sqrt{b_2 \cdot b_2 - a \cdot c}}}}}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}\]
    14. Applied times-frac12.8

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

    if 8.84337229694695364e91 < b_2

    1. Initial program 59.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -3.926021394052593 \cdot 10^{118}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 1.05448800274897715 \cdot 10^{-275}:\\ \;\;\;\;\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{elif}\;b_2 \le 8.84337229694695364 \cdot 10^{91}:\\ \;\;\;\;\frac{\frac{a}{-\sqrt[3]{b_2 + \sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt[3]{b_2 + \sqrt{b_2 \cdot b_2 - a \cdot c}}}}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{\frac{c}{\sqrt[3]{b_2 + \sqrt{b_2 \cdot b_2 - a \cdot c}}}}{\sqrt[3]{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \end{array}\]

Reproduce

herbie shell --seed 2020157 
(FPCore (a b_2 c)
  :name "quad2p (problem 3.2.1, positive)"
  :precision binary64
  (/ (+ (neg b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))