Average Error: 33.5 → 9.5
Time: 1.4m
Precision: 64
Internal Precision: 3392
\[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;\frac{c}{\left(-\frac{1}{2}\right) \cdot \frac{c}{b_2}} \le -2.9766163216474113 \cdot 10^{+92}:\\ \;\;\;\;\frac{\frac{1}{2} \cdot c}{b_2} - \frac{2 \cdot b_2}{a}\\ \mathbf{if}\;\frac{c}{\left(-\frac{1}{2}\right) \cdot \frac{c}{b_2}} \le 1.318415489433312 \cdot 10^{-135}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{if}\;\frac{c}{\left(-\frac{1}{2}\right) \cdot \frac{c}{b_2}} \le 3.544589042980017 \cdot 10^{-72}:\\ \;\;\;\;\frac{c}{\frac{\frac{1}{2} \cdot a}{\frac{b_2}{c}} - 2 \cdot b_2}\\ \mathbf{if}\;\frac{c}{\left(-\frac{1}{2}\right) \cdot \frac{c}{b_2}} \le 2.583438849668483 \cdot 10^{-08}:\\ \;\;\;\;\frac{c \cdot a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \frac{1}{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 (/ c (* (- 1/2) (/ c b_2))) < -2.9766163216474113e+92

    1. Initial program 43.0

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied clear-num43.1

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    4. Taylor expanded around inf 10.3

      \[\leadsto \frac{1}{\frac{a}{\color{blue}{\frac{1}{2} \cdot \frac{c \cdot a}{b_2} - 2 \cdot b_2}}}\]
    5. Applied simplify4.3

      \[\leadsto \color{blue}{\frac{\frac{1}{2} \cdot c}{b_2} - \frac{2 \cdot b_2}{a}}\]

    if -2.9766163216474113e+92 < (/ c (* (- 1/2) (/ c b_2))) < 1.318415489433312e-135

    1. Initial program 10.9

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]

    if 1.318415489433312e-135 < (/ c (* (- 1/2) (/ c b_2))) < 3.544589042980017e-72 or 2.583438849668483e-08 < (/ c (* (- 1/2) (/ c b_2)))

    1. Initial program 51.9

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

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

      \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}\]
    5. Applied simplify25.6

      \[\leadsto \frac{\frac{c \cdot a}{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    6. Taylor expanded around -inf 20.8

      \[\leadsto \frac{\frac{c \cdot a}{\color{blue}{\frac{1}{2} \cdot \frac{c \cdot a}{b_2} - 2 \cdot b_2}}}{a}\]
    7. Applied simplify9.3

      \[\leadsto \color{blue}{\frac{c}{\frac{\frac{1}{2} \cdot a}{\frac{b_2}{c}} - 2 \cdot b_2}}\]

    if 3.544589042980017e-72 < (/ c (* (- 1/2) (/ c b_2))) < 2.583438849668483e-08

    1. Initial program 40.7

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

      \[\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}\]
    5. Applied simplify18.1

      \[\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 div-inv18.2

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

Runtime

Time bar (total: 1.4m)Debug logProfile

herbie shell --seed '#(1071852389 864846987 1238109217 3425890003 4124793586 650694553)' 
(FPCore (a b_2 c)
  :name "quad2m (problem 3.2.1, negative)"
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))