Average Error: 33.3 → 9.2
Time: 1.7m
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.7990069228274365 \cdot 10^{+112}:\\ \;\;\;\;c \cdot \frac{\frac{1}{2}}{b_2} - \left(\frac{b_2}{a} + \frac{b_2}{a}\right)\\ \mathbf{if}\;b_2 \le 7.277309766204621 \cdot 10^{-202}:\\ \;\;\;\;\left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \mathbf{if}\;b_2 \le 2.5306859285525082 \cdot 10^{-25}:\\ \;\;\;\;\frac{\frac{c \cdot a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\left(-b_2\right) + (\left(\frac{c}{b_2}\right) \cdot \left(\frac{1}{2} \cdot a\right) + \left(-b_2\right))_*}\\ \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.7990069228274365e+112

    1. Initial program 46.2

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

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

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

    if -1.7990069228274365e+112 < b_2 < 7.277309766204621e-202

    1. Initial program 10.6

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

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

    if 7.277309766204621e-202 < b_2 < 2.5306859285525082e-25

    1. Initial program 28.6

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied flip-+28.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. Applied simplify18.9

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

    if 2.5306859285525082e-25 < b_2

    1. Initial program 53.9

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

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

      \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}\]
    5. Taylor expanded around inf 18.4

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

      \[\leadsto \color{blue}{\frac{c}{\left(-b_2\right) + (\left(\frac{c}{b_2}\right) \cdot \left(\frac{1}{2} \cdot a\right) + \left(-b_2\right))_*}}\]
  3. Recombined 4 regimes into one program.

Runtime

Time bar (total: 1.7m)Debug logProfile

herbie shell --seed '#(1072936661 1621281212 3440817831 3219514234 460296804 1258167384)' +o rules:numerics
(FPCore (a b_2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))