Average Error: 33.7 → 7.4
Time: 1.7m
Precision: 64
Internal Precision: 2944
\[\frac{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b/2 \le -7.170088175001252 \cdot 10^{+145}:\\ \;\;\;\;-2 \cdot \frac{b/2}{a}\\ \mathbf{if}\;b/2 \le 1.060772382971958 \cdot 10^{-166}:\\ \;\;\;\;\frac{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\\ \mathbf{if}\;b/2 \le 2.668929577274876 \cdot 10^{+121}:\\ \;\;\;\;\frac{\frac{c}{\sqrt[3]{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}} \cdot \sqrt[3]{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}} \cdot \frac{a}{\sqrt[3]{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b/2\right) + b/2}{a} - \frac{\frac{1}{2}}{\frac{b/2}{c}}\\ \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 < -7.170088175001252e+145

    1. Initial program 58.2

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

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

    if -7.170088175001252e+145 < b/2 < 1.060772382971958e-166

    1. Initial program 9.4

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

    if 1.060772382971958e-166 < b/2 < 2.668929577274876e+121

    1. Initial program 39.1

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

      \[\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 add-cube-cbrt15.5

      \[\leadsto \frac{\frac{c \cdot a}{\color{blue}{\left(\sqrt[3]{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}} \cdot \sqrt[3]{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}\right) \cdot \sqrt[3]{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}}}}{a}\]
    7. Applied times-frac13.6

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

    if 2.668929577274876e+121 < b/2

    1. Initial program 60.6

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

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

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

Runtime

Time bar (total: 1.7m)Debug logProfile

herbie shell --seed '#(1062900086 561157142 2241869825 1166610429 2484609072 2159574644)' 
(FPCore (a b/2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b/2) (sqrt (- (* b/2 b/2) (* a c)))) a))