Average Error: 34.3 → 7.3
Time: 6.3s
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 -1.30711257927562294 \cdot 10^{54}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 1.61065190450982591 \cdot 10^{-212}:\\ \;\;\;\;\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{elif}\;b_2 \le 5.22497845636654645 \cdot 10^{104}:\\ \;\;\;\;1 \cdot \frac{\frac{\sqrt[3]{a}}{\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{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 < -1.30711257927562294e54

    1. Initial program 37.8

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

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

    if -1.30711257927562294e54 < b_2 < 1.61065190450982591e-212

    1. Initial program 11.4

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

    if 1.61065190450982591e-212 < b_2 < 5.22497845636654645e104

    1. Initial program 36.6

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

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

      \[\leadsto \frac{\frac{\color{blue}{0 + a \cdot c}}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity15.7

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

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

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

      \[\leadsto \frac{\frac{a}{\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{c}}}{\color{blue}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}}\]
    11. Applied *-un-lft-identity13.7

      \[\leadsto \frac{\frac{a}{\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{\color{blue}{1 \cdot c}}}}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}\]
    12. Applied *-un-lft-identity13.7

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

      \[\leadsto \frac{\frac{a}{\color{blue}{\frac{1}{1} \cdot \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{c}}}}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}\]
    14. Applied add-cube-cbrt12.9

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

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

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

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

    if 5.22497845636654645e104 < b_2

    1. Initial program 59.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.30711257927562294 \cdot 10^{54}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 1.61065190450982591 \cdot 10^{-212}:\\ \;\;\;\;\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{elif}\;b_2 \le 5.22497845636654645 \cdot 10^{104}:\\ \;\;\;\;1 \cdot \frac{\frac{\sqrt[3]{a}}{\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{c}}}{\sqrt[3]{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \end{array}\]

Reproduce

herbie shell --seed 2020149 
(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))