Average Error: 33.5 → 6.3
Time: 1.4m
Precision: 64
Internal Precision: 3392
\[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b_2 \le -1.264353801794433 \cdot 10^{+154}:\\ \;\;\;\;\frac{\frac{1}{2} \cdot c}{b_2} - \left(\frac{b_2}{a} + \frac{b_2}{a}\right)\\ \mathbf{if}\;b_2 \le -2.071765353195596 \cdot 10^{-234}:\\ \;\;\;\;\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{if}\;b_2 \le 4.888376546781174 \cdot 10^{+141}:\\ \;\;\;\;\frac{1}{\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}{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 < -1.264353801794433e+154

    1. Initial program 61.0

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

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

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

    if -1.264353801794433e+154 < b_2 < -2.071765353195596e-234

    1. Initial program 7.4

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

    if -2.071765353195596e-234 < b_2 < 4.888376546781174e+141

    1. Initial program 31.9

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

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

      \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}\]
    5. Using strategy rm
    6. Applied clear-num15.5

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

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

    if 4.888376546781174e+141 < b_2

    1. Initial program 61.7

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

      \[\leadsto \frac{\color{blue}{\frac{-1}{2} \cdot \frac{c \cdot a}{b_2}}}{a}\]
    3. Applied simplify1.9

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

Runtime

Time bar (total: 1.4m)Debug logProfile

herbie shell --seed '#(1072361757 3390613284 2339397988 1175251238 145061547 3101881848)' 
(FPCore (a b_2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))