Average Error: 33.6 → 8.9
Time: 4.8s
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 -73773484249037.312:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -2.630698729571271 \cdot 10^{-159}:\\ \;\;\;\;1 \cdot \frac{\frac{a \cdot c}{a}}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\ \mathbf{elif}\;b_2 \le 8.633216037833923 \cdot 10^{65}:\\ \;\;\;\;\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_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 -73773484249037.312:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

\mathbf{elif}\;b_2 \le -2.630698729571271 \cdot 10^{-159}:\\
\;\;\;\;1 \cdot \frac{\frac{a \cdot c}{a}}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\

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

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

\end{array}
double f(double a, double b_2, double c) {
        double r82965 = b_2;
        double r82966 = -r82965;
        double r82967 = r82965 * r82965;
        double r82968 = a;
        double r82969 = c;
        double r82970 = r82968 * r82969;
        double r82971 = r82967 - r82970;
        double r82972 = sqrt(r82971);
        double r82973 = r82966 - r82972;
        double r82974 = r82973 / r82968;
        return r82974;
}

double f(double a, double b_2, double c) {
        double r82975 = b_2;
        double r82976 = -73773484249037.31;
        bool r82977 = r82975 <= r82976;
        double r82978 = -0.5;
        double r82979 = c;
        double r82980 = r82979 / r82975;
        double r82981 = r82978 * r82980;
        double r82982 = -2.630698729571271e-159;
        bool r82983 = r82975 <= r82982;
        double r82984 = 1.0;
        double r82985 = a;
        double r82986 = r82985 * r82979;
        double r82987 = r82986 / r82985;
        double r82988 = r82975 * r82975;
        double r82989 = r82988 - r82986;
        double r82990 = sqrt(r82989);
        double r82991 = r82990 - r82975;
        double r82992 = r82987 / r82991;
        double r82993 = r82984 * r82992;
        double r82994 = 8.633216037833923e+65;
        bool r82995 = r82975 <= r82994;
        double r82996 = -r82975;
        double r82997 = r82996 - r82990;
        double r82998 = r82984 / r82985;
        double r82999 = r82997 * r82998;
        double r83000 = -2.0;
        double r83001 = r82975 / r82985;
        double r83002 = r83000 * r83001;
        double r83003 = r82995 ? r82999 : r83002;
        double r83004 = r82983 ? r82993 : r83003;
        double r83005 = r82977 ? r82981 : r83004;
        return r83005;
}

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 < -73773484249037.31

    1. Initial program 55.9

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

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

    if -73773484249037.31 < b_2 < -2.630698729571271e-159

    1. Initial program 32.5

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

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

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

      \[\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 div-inv16.5

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

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

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

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

    if -2.630698729571271e-159 < b_2 < 8.633216037833923e+65

    1. Initial program 10.9

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

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

    if 8.633216037833923e+65 < b_2

    1. Initial program 40.1

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied flip--61.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. Simplified61.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. Simplified61.0

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -73773484249037.312:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -2.630698729571271 \cdot 10^{-159}:\\ \;\;\;\;1 \cdot \frac{\frac{a \cdot c}{a}}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\ \mathbf{elif}\;b_2 \le 8.633216037833923 \cdot 10^{65}:\\ \;\;\;\;\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2020057 
(FPCore (a b_2 c)
  :name "NMSE problem 3.2.1"
  :precision binary64
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))