Average Error: 33.4 → 7.3
Time: 1.2m
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{b/2}{\frac{-1}{2}} \le -2.5196355076960388 \cdot 10^{+110}:\\ \;\;\;\;-2 \cdot \frac{b/2}{a}\\ \mathbf{if}\;\frac{b/2}{\frac{-1}{2}} \le 6.062842183650632 \cdot 10^{-304}:\\ \;\;\;\;\frac{(\left(\sqrt[3]{-b/2} \cdot \sqrt[3]{-b/2}\right) \cdot \left(\sqrt[3]{-b/2}\right) + \left(-\sqrt{b/2 \cdot b/2 - a \cdot c}\right))_*}{a}\\ \mathbf{if}\;\frac{b/2}{\frac{-1}{2}} \le 8.292142612755844 \cdot 10^{+19}:\\ \;\;\;\;\frac{\frac{c}{1}}{\sqrt{b/2 \cdot b/2 - c \cdot a} - b/2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-\frac{1}{2}\right) \cdot \frac{c}{b/2}}{1}\\ \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/2) < -2.5196355076960388e+110

    1. Initial program 46.4

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

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

    if -2.5196355076960388e+110 < (/ b/2 -1/2) < 6.062842183650632e-304

    1. Initial program 9.3

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

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

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

    if 6.062842183650632e-304 < (/ b/2 -1/2) < 8.292142612755844e+19

    1. Initial program 28.3

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

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

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

      \[\leadsto \frac{\frac{c \cdot a}{\color{blue}{\sqrt{b/2 \cdot b/2 - a \cdot c} - b/2}}}{a}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity17.7

      \[\leadsto \frac{\frac{c \cdot a}{\color{blue}{1 \cdot \left(\sqrt{b/2 \cdot b/2 - a \cdot c} - b/2\right)}}}{a}\]
    8. Applied times-frac14.5

      \[\leadsto \frac{\color{blue}{\frac{c}{1} \cdot \frac{a}{\sqrt{b/2 \cdot b/2 - a \cdot c} - b/2}}}{a}\]
    9. Applied associate-/l*9.8

      \[\leadsto \color{blue}{\frac{\frac{c}{1}}{\frac{a}{\frac{a}{\sqrt{b/2 \cdot b/2 - a \cdot c} - b/2}}}}\]
    10. Applied simplify9.7

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

    if 8.292142612755844e+19 < (/ b/2 -1/2)

    1. Initial program 55.6

      \[\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
    2. Taylor expanded around -inf 43.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 simplify4.9

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

Runtime

Time bar (total: 1.2m)Debug logProfile

herbie shell --seed '#(1070864556 424010669 783715395 1203517814 4070606583 4107618214)' +o rules:numerics
(FPCore (a b/2 c)
  :name "quad2m (problem 3.2.1, negative)"
  (/ (- (- b/2) (sqrt (- (* b/2 b/2) (* a c)))) a))