Average Error: 34.0 → 7.0
Time: 15.6s
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.055872925556576031818370432171423983379 \cdot 10^{149}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 6.13840982072700821100736409173177839429 \cdot 10^{-224}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\ \mathbf{elif}\;b_2 \le 5.830427332017467499442498685774915746958 \cdot 10^{107}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\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.055872925556576031818370432171423983379 \cdot 10^{149}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

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

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

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

\end{array}
double f(double a, double b_2, double c) {
        double r2738922 = b_2;
        double r2738923 = -r2738922;
        double r2738924 = r2738922 * r2738922;
        double r2738925 = a;
        double r2738926 = c;
        double r2738927 = r2738925 * r2738926;
        double r2738928 = r2738924 - r2738927;
        double r2738929 = sqrt(r2738928);
        double r2738930 = r2738923 - r2738929;
        double r2738931 = r2738930 / r2738925;
        return r2738931;
}

double f(double a, double b_2, double c) {
        double r2738932 = b_2;
        double r2738933 = -3.055872925556576e+149;
        bool r2738934 = r2738932 <= r2738933;
        double r2738935 = -0.5;
        double r2738936 = c;
        double r2738937 = r2738936 / r2738932;
        double r2738938 = r2738935 * r2738937;
        double r2738939 = 6.138409820727008e-224;
        bool r2738940 = r2738932 <= r2738939;
        double r2738941 = r2738932 * r2738932;
        double r2738942 = a;
        double r2738943 = r2738942 * r2738936;
        double r2738944 = r2738941 - r2738943;
        double r2738945 = sqrt(r2738944);
        double r2738946 = r2738945 - r2738932;
        double r2738947 = r2738936 / r2738946;
        double r2738948 = 5.8304273320174675e+107;
        bool r2738949 = r2738932 <= r2738948;
        double r2738950 = -r2738932;
        double r2738951 = r2738950 - r2738945;
        double r2738952 = r2738951 / r2738942;
        double r2738953 = r2738932 / r2738942;
        double r2738954 = -2.0;
        double r2738955 = r2738953 * r2738954;
        double r2738956 = r2738949 ? r2738952 : r2738955;
        double r2738957 = r2738940 ? r2738947 : r2738956;
        double r2738958 = r2738934 ? r2738938 : r2738957;
        return r2738958;
}

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.055872925556576e+149

    1. Initial program 63.5

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

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

    if -3.055872925556576e+149 < b_2 < 6.138409820727008e-224

    1. Initial program 31.9

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

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

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

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

      \[\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-identity15.9

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

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

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

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

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

      \[\leadsto 1 \cdot \color{blue}{\frac{\frac{c \cdot a}{a}}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}}\]
    14. Taylor expanded around 0 9.5

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

    if 6.138409820727008e-224 < b_2 < 5.8304273320174675e+107

    1. Initial program 8.4

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

    if 5.8304273320174675e+107 < b_2

    1. Initial program 49.1

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

      \[\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. Simplified62.3

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -3.055872925556576031818370432171423983379 \cdot 10^{149}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 6.13840982072700821100736409173177839429 \cdot 10^{-224}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\ \mathbf{elif}\;b_2 \le 5.830427332017467499442498685774915746958 \cdot 10^{107}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b_2}{a} \cdot -2\\ \end{array}\]

Reproduce

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