Average Error: 33.4 → 9.1
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}\;b/2 \le -3.557614257073843 \cdot 10^{+72}:\\ \;\;\;\;\frac{\frac{1}{2} \cdot c}{b/2} - \left(\frac{b/2}{a} + \frac{b/2}{a}\right)\\ \mathbf{if}\;b/2 \le 1.418873522275719 \cdot 10^{-276}:\\ \;\;\;\;\frac{1}{\frac{a}{\sqrt{b/2 \cdot b/2 - a \cdot c} - b/2}}\\ \mathbf{if}\;b/2 \le 1.0122976991441377 \cdot 10^{+22}:\\ \;\;\;\;\frac{\frac{c \cdot a}{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\frac{\frac{1}{2} \cdot a}{\frac{b/2}{c}} - 2 \cdot 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 < -3.557614257073843e+72

    1. Initial program 39.2

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

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

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

    if -3.557614257073843e+72 < b/2 < 1.418873522275719e-276

    1. Initial program 9.6

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

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

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

    if 1.418873522275719e-276 < b/2 < 1.0122976991441377e+22

    1. Initial program 29.1

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

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

    if 1.0122976991441377e+22 < b/2

    1. Initial program 55.8

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

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

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

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

Runtime

Time bar (total: 1.3m)Debug logProfile

herbie shell --seed '#(1070578969 3140398606 632207097 462683394 1189254563 964980650)' 
(FPCore (a b/2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b/2) (sqrt (- (* b/2 b/2) (* a c)))) a))