Average Error: 33.2 → 6.6
Time: 18.4s
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 -3.364694627550853 \cdot 10^{+89}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -1.5510446836147797 \cdot 10^{-300}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}\\ \mathbf{elif}\;b_2 \le 2.559678284282607 \cdot 10^{+69}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \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 -3.364694627550853 \cdot 10^{+89}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

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

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

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

\end{array}
double f(double a, double b_2, double c) {
        double r1375933 = b_2;
        double r1375934 = -r1375933;
        double r1375935 = r1375933 * r1375933;
        double r1375936 = a;
        double r1375937 = c;
        double r1375938 = r1375936 * r1375937;
        double r1375939 = r1375935 - r1375938;
        double r1375940 = sqrt(r1375939);
        double r1375941 = r1375934 - r1375940;
        double r1375942 = r1375941 / r1375936;
        return r1375942;
}

double f(double a, double b_2, double c) {
        double r1375943 = b_2;
        double r1375944 = -3.364694627550853e+89;
        bool r1375945 = r1375943 <= r1375944;
        double r1375946 = -0.5;
        double r1375947 = c;
        double r1375948 = r1375947 / r1375943;
        double r1375949 = r1375946 * r1375948;
        double r1375950 = -1.5510446836147797e-300;
        bool r1375951 = r1375943 <= r1375950;
        double r1375952 = r1375943 * r1375943;
        double r1375953 = a;
        double r1375954 = r1375947 * r1375953;
        double r1375955 = r1375952 - r1375954;
        double r1375956 = sqrt(r1375955);
        double r1375957 = r1375956 - r1375943;
        double r1375958 = r1375947 / r1375957;
        double r1375959 = 2.559678284282607e+69;
        bool r1375960 = r1375943 <= r1375959;
        double r1375961 = -r1375943;
        double r1375962 = r1375961 - r1375956;
        double r1375963 = r1375962 / r1375953;
        double r1375964 = 0.5;
        double r1375965 = r1375964 * r1375948;
        double r1375966 = r1375943 / r1375953;
        double r1375967 = 2.0;
        double r1375968 = r1375966 * r1375967;
        double r1375969 = r1375965 - r1375968;
        double r1375970 = r1375960 ? r1375963 : r1375969;
        double r1375971 = r1375951 ? r1375958 : r1375970;
        double r1375972 = r1375945 ? r1375949 : r1375971;
        return r1375972;
}

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 < -3.364694627550853e+89

    1. Initial program 57.9

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

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

    if -3.364694627550853e+89 < b_2 < -1.5510446836147797e-300

    1. Initial program 31.6

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

      \[\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.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. Simplified15.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 *-un-lft-identity15.5

      \[\leadsto \frac{\color{blue}{1 \cdot \frac{0 + a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    8. Applied associate-/l*15.6

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

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

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

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

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

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

    if -1.5510446836147797e-300 < b_2 < 2.559678284282607e+69

    1. Initial program 9.4

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

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{{b_2}^{2} - a \cdot c}}}{a}\]
    3. Simplified9.4

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

    if 2.559678284282607e+69 < b_2

    1. Initial program 38.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -3.364694627550853 \cdot 10^{+89}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -1.5510446836147797 \cdot 10^{-300}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}\\ \mathbf{elif}\;b_2 \le 2.559678284282607 \cdot 10^{+69}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \end{array}\]

Reproduce

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