Average Error: 33.4 → 6.5
Time: 1.2m
Precision: 64
Internal Precision: 3456
\[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b_2 \le -2.760161866632008 \cdot 10^{+146}:\\ \;\;\;\;\frac{\frac{c}{b_2}}{2} - \left(\frac{b_2}{a} + \frac{b_2}{a}\right)\\ \mathbf{if}\;b_2 \le 1.8801709485000942 \cdot 10^{-256}:\\ \;\;\;\;\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{if}\;b_2 \le 5.762268612297691 \cdot 10^{+72}:\\ \;\;\;\;\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 < -2.760161866632008e+146

    1. Initial program 57.4

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

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

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

    if -2.760161866632008e+146 < b_2 < 1.8801709485000942e-256

    1. Initial program 9.1

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

    if 1.8801709485000942e-256 < b_2 < 5.762268612297691e+72

    1. Initial program 33.2

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

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

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

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

    if 5.762268612297691e+72 < b_2

    1. Initial program 57.5

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

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

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

Runtime

Time bar (total: 1.2m)Debug logProfile

herbie shell --seed '#(1070991898 1055468627 4280279443 640792587 928206309 3646738750)' 
(FPCore (a b_2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))