Average Error: 33.0 → 8.6
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.004969258463693 \cdot 10^{+111}:\\ \;\;\;\;\frac{c}{b_2} \cdot \frac{1}{2} - \frac{b_2}{a} \cdot 2\\ \mathbf{if}\;b_2 \le 2.0545829980519752 \cdot 10^{-104}:\\ \;\;\;\;\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}\\ \mathbf{if}\;b_2 \le 5.505179639378515 \cdot 10^{-09}:\\ \;\;\;\;\frac{1}{\frac{a}{c \cdot \left(-a\right)} \cdot \left(\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2\right)}\\ \mathbf{if}\;b_2 \le 3.272139480756316 \cdot 10^{+65}:\\ \;\;\;\;(e^{\log_* (1 + \frac{c}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}})} - 1)^*\\ \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 5 regimes
  2. if b_2 < -1.004969258463693e+111

    1. Initial program 46.6

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

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

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

    if -1.004969258463693e+111 < b_2 < 2.0545829980519752e-104

    1. Initial program 11.6

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

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

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

    if 2.0545829980519752e-104 < b_2 < 5.505179639378515e-09

    1. Initial program 35.9

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

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

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

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

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

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

    if 5.505179639378515e-09 < b_2 < 3.272139480756316e+65

    1. Initial program 44.2

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

      \[\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 simplify13.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 expm1-log1p-u21.7

      \[\leadsto \color{blue}{(e^{\log_* (1 + \frac{\frac{c \cdot a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}{a})} - 1)^*}\]
    7. Applied simplify13.3

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

    if 3.272139480756316e+65 < b_2

    1. Initial program 57.1

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

      \[\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 simplify29.5

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

      \[\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 5 regimes into one program.

Runtime

Time bar (total: 1.7m)Debug logProfile

herbie shell --seed 2018166 +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))