Average Error: 34.2 → 10.0
Time: 6.0s
Precision: 64
\[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b_2 \le -9.66563711558993385 \cdot 10^{-69}:\\ \;\;\;\;1 \cdot \left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)\\ \mathbf{elif}\;b_2 \le 9.1585291365273219 \cdot 10^{122}:\\ \;\;\;\;1 \cdot \left(\frac{-b_2}{a} - \frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(-2 \cdot \frac{b_2}{a}\right)\\ \end{array}\]
\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}
\begin{array}{l}
\mathbf{if}\;b_2 \le -9.66563711558993385 \cdot 10^{-69}:\\
\;\;\;\;1 \cdot \left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)\\

\mathbf{elif}\;b_2 \le 9.1585291365273219 \cdot 10^{122}:\\
\;\;\;\;1 \cdot \left(\frac{-b_2}{a} - \frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\right)\\

\mathbf{else}:\\
\;\;\;\;1 \cdot \left(-2 \cdot \frac{b_2}{a}\right)\\

\end{array}
double f(double a, double b_2, double c) {
        double r15732 = b_2;
        double r15733 = -r15732;
        double r15734 = r15732 * r15732;
        double r15735 = a;
        double r15736 = c;
        double r15737 = r15735 * r15736;
        double r15738 = r15734 - r15737;
        double r15739 = sqrt(r15738);
        double r15740 = r15733 - r15739;
        double r15741 = r15740 / r15735;
        return r15741;
}

double f(double a, double b_2, double c) {
        double r15742 = b_2;
        double r15743 = -9.665637115589934e-69;
        bool r15744 = r15742 <= r15743;
        double r15745 = 1.0;
        double r15746 = -0.5;
        double r15747 = c;
        double r15748 = r15747 / r15742;
        double r15749 = r15746 * r15748;
        double r15750 = r15745 * r15749;
        double r15751 = 9.158529136527322e+122;
        bool r15752 = r15742 <= r15751;
        double r15753 = -r15742;
        double r15754 = a;
        double r15755 = r15753 / r15754;
        double r15756 = r15742 * r15742;
        double r15757 = r15754 * r15747;
        double r15758 = r15756 - r15757;
        double r15759 = sqrt(r15758);
        double r15760 = r15759 / r15754;
        double r15761 = r15755 - r15760;
        double r15762 = r15745 * r15761;
        double r15763 = -2.0;
        double r15764 = r15742 / r15754;
        double r15765 = r15763 * r15764;
        double r15766 = r15745 * r15765;
        double r15767 = r15752 ? r15762 : r15766;
        double r15768 = r15744 ? r15750 : r15767;
        return r15768;
}

Error

Bits error versus a

Bits error versus b_2

Bits error versus c

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if b_2 < -9.665637115589934e-69

    1. Initial program 53.8

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

      \[\leadsto \color{blue}{\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity53.8

      \[\leadsto \color{blue}{\left(1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)\right)} \cdot \frac{1}{a}\]
    6. Applied associate-*l*53.8

      \[\leadsto \color{blue}{1 \cdot \left(\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}\right)}\]
    7. Simplified53.8

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

      \[\leadsto 1 \cdot \color{blue}{\left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)}\]

    if -9.665637115589934e-69 < b_2 < 9.158529136527322e+122

    1. Initial program 13.0

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

      \[\leadsto \color{blue}{\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity13.1

      \[\leadsto \color{blue}{\left(1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)\right)} \cdot \frac{1}{a}\]
    6. Applied associate-*l*13.1

      \[\leadsto \color{blue}{1 \cdot \left(\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}\right)}\]
    7. Simplified13.0

      \[\leadsto 1 \cdot \color{blue}{\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}}\]
    8. Using strategy rm
    9. Applied div-sub13.0

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

    if 9.158529136527322e+122 < b_2

    1. Initial program 53.1

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

      \[\leadsto \color{blue}{\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity53.2

      \[\leadsto \color{blue}{\left(1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)\right)} \cdot \frac{1}{a}\]
    6. Applied associate-*l*53.2

      \[\leadsto \color{blue}{1 \cdot \left(\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}\right)}\]
    7. Simplified53.1

      \[\leadsto 1 \cdot \color{blue}{\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}}\]
    8. Using strategy rm
    9. Applied clear-num53.2

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

      \[\leadsto 1 \cdot \color{blue}{\left(-2 \cdot \frac{b_2}{a}\right)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification10.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -9.66563711558993385 \cdot 10^{-69}:\\ \;\;\;\;1 \cdot \left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)\\ \mathbf{elif}\;b_2 \le 9.1585291365273219 \cdot 10^{122}:\\ \;\;\;\;1 \cdot \left(\frac{-b_2}{a} - \frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(-2 \cdot \frac{b_2}{a}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020036 +o rules:numerics
(FPCore (a b_2 c)
  :name "quad2m (problem 3.2.1, negative)"
  :precision binary64
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))