Average Error: 33.1 → 8.5
Time: 21.2s
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 -1.1643926003340064 \cdot 10^{+104}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -2.2033917388951676 \cdot 10^{-187}:\\ \;\;\;\;\frac{\frac{c \cdot a}{a}}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}\\ \mathbf{elif}\;b_2 \le 5.704492581538356 \cdot 10^{+80}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b_2 \cdot -2}{a}\\ \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 -1.1643926003340064 \cdot 10^{+104}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

\mathbf{elif}\;b_2 \le -2.2033917388951676 \cdot 10^{-187}:\\
\;\;\;\;\frac{\frac{c \cdot a}{a}}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}\\

\mathbf{elif}\;b_2 \le 5.704492581538356 \cdot 10^{+80}:\\
\;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{b_2 \cdot -2}{a}\\

\end{array}
double f(double a, double b_2, double c) {
        double r585654 = b_2;
        double r585655 = -r585654;
        double r585656 = r585654 * r585654;
        double r585657 = a;
        double r585658 = c;
        double r585659 = r585657 * r585658;
        double r585660 = r585656 - r585659;
        double r585661 = sqrt(r585660);
        double r585662 = r585655 - r585661;
        double r585663 = r585662 / r585657;
        return r585663;
}

double f(double a, double b_2, double c) {
        double r585664 = b_2;
        double r585665 = -1.1643926003340064e+104;
        bool r585666 = r585664 <= r585665;
        double r585667 = -0.5;
        double r585668 = c;
        double r585669 = r585668 / r585664;
        double r585670 = r585667 * r585669;
        double r585671 = -2.2033917388951676e-187;
        bool r585672 = r585664 <= r585671;
        double r585673 = a;
        double r585674 = r585668 * r585673;
        double r585675 = r585674 / r585673;
        double r585676 = r585664 * r585664;
        double r585677 = r585676 - r585674;
        double r585678 = sqrt(r585677);
        double r585679 = r585678 - r585664;
        double r585680 = r585675 / r585679;
        double r585681 = 5.704492581538356e+80;
        bool r585682 = r585664 <= r585681;
        double r585683 = -r585664;
        double r585684 = r585683 - r585678;
        double r585685 = r585684 / r585673;
        double r585686 = -2.0;
        double r585687 = r585664 * r585686;
        double r585688 = r585687 / r585673;
        double r585689 = r585682 ? r585685 : r585688;
        double r585690 = r585672 ? r585680 : r585689;
        double r585691 = r585666 ? r585670 : r585690;
        return r585691;
}

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 4 regimes
  2. if b_2 < -1.1643926003340064e+104

    1. Initial program 59.0

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

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

    if -1.1643926003340064e+104 < b_2 < -2.2033917388951676e-187

    1. Initial program 35.8

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

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

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

      \[\leadsto \frac{\frac{0 + a \cdot c}{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity16.0

      \[\leadsto \frac{\frac{0 + a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{\color{blue}{1 \cdot a}}\]
    8. Applied *-un-lft-identity16.0

      \[\leadsto \frac{\color{blue}{1 \cdot \frac{0 + a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{1 \cdot a}\]
    9. Applied times-frac16.0

      \[\leadsto \color{blue}{\frac{1}{1} \cdot \frac{\frac{0 + a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a}}\]
    10. Simplified16.0

      \[\leadsto \color{blue}{1} \cdot \frac{\frac{0 + a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a}\]
    11. Simplified15.0

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

    if -2.2033917388951676e-187 < b_2 < 5.704492581538356e+80

    1. Initial program 10.6

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

    if 5.704492581538356e+80 < b_2

    1. Initial program 40.2

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

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

      \[\leadsto \frac{\frac{\color{blue}{0 + a \cdot c}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}\]
    5. Simplified61.4

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

      \[\leadsto \frac{\color{blue}{-2 \cdot b_2}}{a}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification8.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.1643926003340064 \cdot 10^{+104}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -2.2033917388951676 \cdot 10^{-187}:\\ \;\;\;\;\frac{\frac{c \cdot a}{a}}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}\\ \mathbf{elif}\;b_2 \le 5.704492581538356 \cdot 10^{+80}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b_2 \cdot -2}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2019144 
(FPCore (a b_2 c)
  :name "quad2m (problem 3.2.1, negative)"
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))