Average Error: 34.2 → 6.4
Time: 4.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 -2.3366067359337238 \cdot 10^{153}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le -3.0353846959365339 \cdot 10^{-304}:\\ \;\;\;\;\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{elif}\;b_2 \le 1.7040590409047381 \cdot 10^{99}:\\ \;\;\;\;\frac{\frac{1}{a} \cdot 0 + c}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot 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.3366067359337238e153

    1. Initial program 63.9

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

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

    if -2.3366067359337238e153 < b_2 < -3.0353846959365339e-304

    1. Initial program 8.9

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

    if -3.0353846959365339e-304 < b_2 < 1.7040590409047381e99

    1. Initial program 31.6

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

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

      \[\leadsto \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}}} \cdot \frac{1}{a}\]
    6. Applied associate-*l/31.7

      \[\leadsto \color{blue}{\frac{\left(\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}\right) \cdot \frac{1}{a}}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\]
    7. Simplified15.3

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

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

    if 1.7040590409047381e99 < 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.8

      \[\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.3366067359337238 \cdot 10^{153}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le -3.0353846959365339 \cdot 10^{-304}:\\ \;\;\;\;\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{elif}\;b_2 \le 1.7040590409047381 \cdot 10^{99}:\\ \;\;\;\;\frac{\frac{1}{a} \cdot 0 + c}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \end{array}\]

Reproduce

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