Average Error: 32.8 → 9.2
Time: 1.5m
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}\;\frac{\frac{-1}{2}}{b/2} \le -1.0745870808200606 \cdot 10^{+31}:\\ \;\;\;\;\frac{\frac{c \cdot a}{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}}{a}\\ \mathbf{if}\;\frac{\frac{-1}{2}}{b/2} \le 5.556411876757934 \cdot 10^{-295}:\\ \;\;\;\;\frac{c}{\left(-b/2\right) + (\left(\frac{c}{b/2}\right) \cdot \left(\frac{1}{2} \cdot a\right) + \left(-b/2\right))_*}\\ \mathbf{if}\;\frac{\frac{-1}{2}}{b/2} \le 7.80568394574664 \cdot 10^{-157}:\\ \;\;\;\;c \cdot \frac{\frac{1}{2}}{b/2} - \left(\frac{b/2}{a} + \frac{b/2}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \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 (/ -1/2 b/2) < -1.0745870808200606e+31

    1. Initial program 22.7

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

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

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

    if -1.0745870808200606e+31 < (/ -1/2 b/2) < 5.556411876757934e-295

    1. Initial program 54.1

      \[\frac{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied flip-+54.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 simplify27.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.8

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

      \[\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))_*}}\]

    if 5.556411876757934e-295 < (/ -1/2 b/2) < 7.80568394574664e-157

    1. Initial program 60.8

      \[\frac{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
    2. Taylor expanded around -inf 9.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 simplify1.7

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

    if 7.80568394574664e-157 < (/ -1/2 b/2)

    1. Initial program 7.9

      \[\frac{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied div-inv8.1

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

Runtime

Time bar (total: 1.5m)Debug logProfile

herbie shell --seed '#(1070386091 2509006183 1430610344 1025408621 36622005 1425925650)' +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))