Average Error: 33.3 → 6.8
Time: 49.7s
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 -1.4693721793722456 \cdot 10^{+115}:\\ \;\;\;\;-2 \cdot \frac{b/2}{a}\\ \mathbf{if}\;b/2 \le 5.471597732237248 \cdot 10^{-245}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}}\\ \mathbf{if}\;b/2 \le 2.0777803968180052 \cdot 10^{+112}:\\ \;\;\;\;\frac{c}{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b/2} \cdot \frac{-1}{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 < -1.4693721793722456e+115

    1. Initial program 47.0

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

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

    if -1.4693721793722456e+115 < b/2 < 5.471597732237248e-245

    1. Initial program 10.3

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

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

    if 5.471597732237248e-245 < b/2 < 2.0777803968180052e+112

    1. Initial program 35.0

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}}}\]
    4. Using strategy rm
    5. Applied flip-+35.1

      \[\leadsto \frac{1}{\frac{a}{\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}}}}}\]
    6. Applied associate-/r/35.2

      \[\leadsto \frac{1}{\color{blue}{\frac{a}{\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}} \cdot \left(\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}\right)}}\]
    7. Applied associate-/r*35.2

      \[\leadsto \color{blue}{\frac{\frac{1}{\frac{a}{\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}}}\]
    8. Applied simplify7.6

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

    if 2.0777803968180052e+112 < b/2

    1. Initial program 59.5

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

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

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

Runtime

Time bar (total: 49.7s)Debug logProfile

herbie shell --seed '#(1063282112 2455465480 4141627379 3773598652 1647277307 776739644)' 
(FPCore (a b/2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b/2) (sqrt (- (* b/2 b/2) (* a c)))) a))