Average Error: 35.2 → 6.9
Time: 5.0s
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.23308921910295448 \cdot 10^{118}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 4.77273554566535998 \cdot 10^{-238}:\\ \;\;\;\;1 \cdot \frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\ \mathbf{elif}\;b_2 \le 7.37280539354795168 \cdot 10^{65}:\\ \;\;\;\;\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 < -3.23308921910295448e118

    1. Initial program 60.6

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

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

    if -3.23308921910295448e118 < b_2 < 4.77273554566535998e-238

    1. Initial program 29.4

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

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

      \[\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 *-un-lft-identity15.2

      \[\leadsto \frac{\frac{0 + a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{\color{blue}{1 \cdot a}}\]
    8. Applied associate-/r*15.2

      \[\leadsto \color{blue}{\frac{\frac{\frac{0 + a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{1}}{a}}\]
    9. Simplified13.9

      \[\leadsto \frac{\color{blue}{\frac{a}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}}{a}\]
    10. Using strategy rm
    11. Applied clear-num13.9

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\frac{a}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}}}\]
    12. Simplified10.4

      \[\leadsto \frac{1}{\color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}\]
    13. Using strategy rm
    14. Applied *-un-lft-identity10.4

      \[\leadsto \frac{1}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{\color{blue}{1 \cdot c}}}\]
    15. Applied *-un-lft-identity10.4

      \[\leadsto \frac{1}{\frac{\color{blue}{1 \cdot \left(\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2\right)}}{1 \cdot c}}\]
    16. Applied times-frac10.4

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{1} \cdot \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}\]
    17. Applied add-cube-cbrt10.4

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\frac{1}{1} \cdot \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}\]
    18. Applied times-frac10.4

      \[\leadsto \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{1}{1}} \cdot \frac{\sqrt[3]{1}}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}\]
    19. Simplified10.4

      \[\leadsto \color{blue}{1} \cdot \frac{\sqrt[3]{1}}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}\]
    20. Simplified9.9

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

    if 4.77273554566535998e-238 < b_2 < 7.37280539354795168e65

    1. Initial program 7.7

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

    if 7.37280539354795168e65 < b_2

    1. Initial program 41.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -3.23308921910295448 \cdot 10^{118}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 4.77273554566535998 \cdot 10^{-238}:\\ \;\;\;\;1 \cdot \frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\ \mathbf{elif}\;b_2 \le 7.37280539354795168 \cdot 10^{65}:\\ \;\;\;\;\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 2020157 
(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))