Average Error: 33.3 → 5.5
Time: 1.5m
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 -9.379389100315109 \cdot 10^{+138}:\\ \;\;\;\;\frac{c}{b/2} \cdot \frac{-1}{2}\\ \mathbf{if}\;b/2 \le -1.1578962494443976 \cdot 10^{-204}:\\ \;\;\;\;\left(\sqrt[3]{\frac{c}{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}} \cdot \sqrt[3]{\frac{c}{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}}\right) \cdot \sqrt[3]{\frac{c}{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}}\\ \mathbf{if}\;b/2 \le 2.668929577274876 \cdot 10^{+121}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b/2}{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 b/2 < -9.379389100315109e+138

    1. Initial program 61.8

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

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

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

    if -9.379389100315109e+138 < b/2 < -1.1578962494443976e-204

    1. Initial program 37.6

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

      \[\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 simplify15.3

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

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

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

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

    if -1.1578962494443976e-204 < b/2 < 2.668929577274876e+121

    1. Initial program 9.0

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

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

    if 2.668929577274876e+121 < b/2

    1. Initial program 51.0

      \[\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}}\]
  3. Recombined 4 regimes into one program.
  4. Removed slow pow expressions.

Runtime

Time bar (total: 1.5m)Debug logProfile

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