Average Error: 33.1 → 6.3
Time: 27.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 -5.709051322868216 \cdot 10^{+150}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.5270348471001126 \cdot 10^{-284}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\ \mathbf{elif}\;b_2 \le 7.774374944213099 \cdot 10^{+79}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\\ \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 -5.709051322868216 \cdot 10^{+150}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

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

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

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

\end{array}
double f(double a, double b_2, double c) {
        double r4041905 = b_2;
        double r4041906 = -r4041905;
        double r4041907 = r4041905 * r4041905;
        double r4041908 = a;
        double r4041909 = c;
        double r4041910 = r4041908 * r4041909;
        double r4041911 = r4041907 - r4041910;
        double r4041912 = sqrt(r4041911);
        double r4041913 = r4041906 - r4041912;
        double r4041914 = r4041913 / r4041908;
        return r4041914;
}

double f(double a, double b_2, double c) {
        double r4041915 = b_2;
        double r4041916 = -5.709051322868216e+150;
        bool r4041917 = r4041915 <= r4041916;
        double r4041918 = -0.5;
        double r4041919 = c;
        double r4041920 = r4041919 / r4041915;
        double r4041921 = r4041918 * r4041920;
        double r4041922 = 1.5270348471001126e-284;
        bool r4041923 = r4041915 <= r4041922;
        double r4041924 = r4041915 * r4041915;
        double r4041925 = a;
        double r4041926 = r4041925 * r4041919;
        double r4041927 = r4041924 - r4041926;
        double r4041928 = sqrt(r4041927);
        double r4041929 = r4041928 - r4041915;
        double r4041930 = r4041919 / r4041929;
        double r4041931 = 7.774374944213099e+79;
        bool r4041932 = r4041915 <= r4041931;
        double r4041933 = 1.0;
        double r4041934 = -r4041915;
        double r4041935 = r4041934 - r4041928;
        double r4041936 = r4041925 / r4041935;
        double r4041937 = r4041933 / r4041936;
        double r4041938 = -2.0;
        double r4041939 = r4041915 / r4041925;
        double r4041940 = r4041938 * r4041939;
        double r4041941 = r4041932 ? r4041937 : r4041940;
        double r4041942 = r4041923 ? r4041930 : r4041941;
        double r4041943 = r4041917 ? r4041921 : r4041942;
        return r4041943;
}

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 < -5.709051322868216e+150

    1. Initial program 62.7

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

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

    if -5.709051322868216e+150 < b_2 < 1.5270348471001126e-284

    1. Initial program 32.2

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

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

      \[\leadsto \frac{\frac{\left(b_2 \cdot b_2 - b_2 \cdot b_2\right) + 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-identity15.3

      \[\leadsto \frac{\frac{\left(b_2 \cdot b_2 - b_2 \cdot b_2\right) + a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{\color{blue}{1 \cdot a}}\]
    8. Applied *-un-lft-identity15.3

      \[\leadsto \frac{\color{blue}{1 \cdot \frac{\left(b_2 \cdot b_2 - b_2 \cdot b_2\right) + a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{1 \cdot a}\]
    9. Applied times-frac15.3

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

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

      \[\leadsto 1 \cdot \color{blue}{\frac{a \cdot c}{a \cdot \left(\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2\right)}}\]
    12. Using strategy rm
    13. Applied associate-/r*13.8

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

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

    if 1.5270348471001126e-284 < b_2 < 7.774374944213099e+79

    1. Initial program 9.1

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

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

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

    if 7.774374944213099e+79 < b_2

    1. Initial program 40.0

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -5.709051322868216 \cdot 10^{+150}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.5270348471001126 \cdot 10^{-284}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\ \mathbf{elif}\;b_2 \le 7.774374944213099 \cdot 10^{+79}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2019144 +o rules:numerics
(FPCore (a b_2 c)
  :name "NMSE problem 3.2.1"
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))