Average Error: 34.1 → 6.4
Time: 6.9s
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 -2.2217078168726145 \cdot 10^{105}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le -9.5875108532266008 \cdot 10^{-281}:\\ \;\;\;\;\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}\\ \mathbf{elif}\;b_2 \le 1.4390013145474845 \cdot 10^{107}:\\ \;\;\;\;\frac{\frac{1}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}{\frac{1}{c}}\\ \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 < -2.2217078168726145e105

    1. Initial program 47.9

      \[\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 -2.2217078168726145e105 < b_2 < -9.5875108532266008e-281

    1. Initial program 8.6

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

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

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

    if -9.5875108532266008e-281 < b_2 < 1.4390013145474845e107

    1. Initial program 31.7

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

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

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

      \[\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*16.6

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

      \[\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 div-inv14.2

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

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

      \[\leadsto \frac{\color{blue}{\frac{1}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \frac{a}{\frac{1}{c}}}}{a}\]
    13. Applied associate-/l*16.0

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

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

    if 1.4390013145474845e107 < b_2

    1. Initial program 59.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -2.2217078168726145 \cdot 10^{105}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le -9.5875108532266008 \cdot 10^{-281}:\\ \;\;\;\;\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}\\ \mathbf{elif}\;b_2 \le 1.4390013145474845 \cdot 10^{107}:\\ \;\;\;\;\frac{\frac{1}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}{\frac{1}{c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \end{array}\]

Reproduce

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