Average Error: 33.5 → 6.8
Time: 16.7s
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.396811349079212 \cdot 10^{+61}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.7036165226371234 \cdot 10^{-298}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\ \mathbf{elif}\;b_2 \le 2.777729270705496 \cdot 10^{+74}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-2 \cdot 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 -3.396811349079212 \cdot 10^{+61}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

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

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

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

\end{array}
double f(double a, double b_2, double c) {
        double r1967062 = b_2;
        double r1967063 = -r1967062;
        double r1967064 = r1967062 * r1967062;
        double r1967065 = a;
        double r1967066 = c;
        double r1967067 = r1967065 * r1967066;
        double r1967068 = r1967064 - r1967067;
        double r1967069 = sqrt(r1967068);
        double r1967070 = r1967063 - r1967069;
        double r1967071 = r1967070 / r1967065;
        return r1967071;
}

double f(double a, double b_2, double c) {
        double r1967072 = b_2;
        double r1967073 = -3.396811349079212e+61;
        bool r1967074 = r1967072 <= r1967073;
        double r1967075 = -0.5;
        double r1967076 = c;
        double r1967077 = r1967076 / r1967072;
        double r1967078 = r1967075 * r1967077;
        double r1967079 = 1.7036165226371234e-298;
        bool r1967080 = r1967072 <= r1967079;
        double r1967081 = r1967072 * r1967072;
        double r1967082 = a;
        double r1967083 = r1967082 * r1967076;
        double r1967084 = r1967081 - r1967083;
        double r1967085 = sqrt(r1967084);
        double r1967086 = r1967085 - r1967072;
        double r1967087 = r1967076 / r1967086;
        double r1967088 = 2.777729270705496e+74;
        bool r1967089 = r1967072 <= r1967088;
        double r1967090 = -r1967072;
        double r1967091 = r1967090 - r1967085;
        double r1967092 = r1967091 / r1967082;
        double r1967093 = -2.0;
        double r1967094 = r1967093 * r1967072;
        double r1967095 = r1967094 / r1967082;
        double r1967096 = r1967089 ? r1967092 : r1967095;
        double r1967097 = r1967080 ? r1967087 : r1967096;
        double r1967098 = r1967074 ? r1967078 : r1967097;
        return r1967098;
}

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.396811349079212e+61

    1. Initial program 57.2

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

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

    if -3.396811349079212e+61 < b_2 < 1.7036165226371234e-298

    1. Initial program 29.7

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt29.7

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

      \[\leadsto \frac{\left(-b_2\right) - \color{blue}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}}{a}\]
    5. Using strategy rm
    6. Applied flip--30.5

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

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

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

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

      \[\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}\]
    12. Applied *-un-lft-identity17.0

      \[\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}\]
    13. Applied times-frac17.0

      \[\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}\]
    14. Applied times-frac17.0

      \[\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}}\]
    15. Simplified17.0

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

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

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

    if 1.7036165226371234e-298 < b_2 < 2.777729270705496e+74

    1. Initial program 9.6

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

    if 2.777729270705496e+74 < b_2

    1. Initial program 38.9

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt38.9

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

      \[\leadsto \frac{\left(-b_2\right) - \color{blue}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}}{a}\]
    5. Using strategy rm
    6. Applied flip--58.6

      \[\leadsto \frac{\color{blue}{\frac{\left(-b_2\right) \cdot \left(-b_2\right) - \left(\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}\right) \cdot \left(\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}\right)}{\left(-b_2\right) + \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}}}{a}\]
    7. Simplified60.9

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -3.396811349079212 \cdot 10^{+61}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.7036165226371234 \cdot 10^{-298}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\ \mathbf{elif}\;b_2 \le 2.777729270705496 \cdot 10^{+74}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-2 \cdot b_2}{a}\\ \end{array}\]

Reproduce

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