Average Error: 32.8 → 9.3
Time: 1.3m
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 -4.298348323280238 \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 7.408549169010927 \cdot 10^{-295}:\\ \;\;\;\;\frac{c}{\frac{\frac{1}{2} \cdot a}{\frac{b/2}{c}} - 2 \cdot b/2}\\ \mathbf{if}\;\frac{\frac{-1}{2}}{b/2} \le 5.1577682504470215 \cdot 10^{-158}:\\ \;\;\;\;\frac{\frac{1}{2} \cdot c}{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) < -4.298348323280238e+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.9

      \[\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 -4.298348323280238e+31 < (/ -1/2 b/2) < 7.408549169010927e-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}{\color{blue}{\frac{1}{2} \cdot \frac{c \cdot a}{b/2} - 2 \cdot b/2}}}{a}\]
    6. Applied simplify8.1

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

    if 7.408549169010927e-295 < (/ -1/2 b/2) < 5.1577682504470215e-158

    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.3

      \[\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}{\frac{\frac{1}{2} \cdot c}{b/2} - \left(\frac{b/2}{a} + \frac{b/2}{a}\right)}\]

    if 5.1577682504470215e-158 < (/ -1/2 b/2)

    1. Initial program 8.2

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

      \[\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.3m)Debug logProfile

herbie shell --seed '#(1070386091 2509006183 1430610344 1025408621 36622005 1425925650)' 
(FPCore (a b/2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b/2) (sqrt (- (* b/2 b/2) (* a c)))) a))