Average Error: 33.9 → 10.2
Time: 5.6s
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 -4.43130813824076946 \cdot 10^{86}:\\ \;\;\;\;\frac{a \cdot \left(c \cdot \frac{\frac{1}{2}}{b_2}\right) + b_2 \cdot -2}{a}\\ \mathbf{elif}\;b_2 \le 4.4378498285549336 \cdot 10^{-64}:\\ \;\;\;\;\frac{\frac{1}{a}}{\frac{1}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}\\ \mathbf{else}:\\ \;\;\;\;c \cdot \frac{\frac{-1}{2}}{b_2}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b_2

Bits error versus c

Derivation

  1. Split input into 3 regimes
  2. if b_2 < -4.43130813824076946e86

    1. Initial program 44.4

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

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}}\]
    3. Taylor expanded around -inf 10.4

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

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

    if -4.43130813824076946e86 < b_2 < 4.4378498285549336e-64

    1. Initial program 13.5

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

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}}\]
    3. Using strategy rm
    4. Applied clear-num13.6

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}\]
    5. Using strategy rm
    6. Applied div-inv13.6

      \[\leadsto \frac{1}{\color{blue}{a \cdot \frac{1}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}\]
    7. Applied associate-/r*13.6

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

    if 4.4378498285549336e-64 < b_2

    1. Initial program 53.3

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

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}}\]
    3. Taylor expanded around inf 8.9

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b_2}}\]
    4. Simplified9.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -4.43130813824076946 \cdot 10^{86}:\\ \;\;\;\;\frac{a \cdot \left(c \cdot \frac{\frac{1}{2}}{b_2}\right) + b_2 \cdot -2}{a}\\ \mathbf{elif}\;b_2 \le 4.4378498285549336 \cdot 10^{-64}:\\ \;\;\;\;\frac{\frac{1}{a}}{\frac{1}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}\\ \mathbf{else}:\\ \;\;\;\;c \cdot \frac{\frac{-1}{2}}{b_2}\\ \end{array}\]

Reproduce

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