Average Error: 34.1 → 7.5
Time: 18.9s
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 -1.949506152818805461026129307942387611116 \cdot 10^{68}:\\ \;\;\;\;\frac{c}{b_2} \cdot \frac{-1}{2}\\ \mathbf{elif}\;b_2 \le -1.548986092369567119714011438756155483384 \cdot 10^{-252}:\\ \;\;\;\;\sqrt[3]{\frac{c}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2} \cdot \frac{a}{a}} \cdot \left(\sqrt[3]{\frac{c}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2} \cdot \frac{a}{a}} \cdot \sqrt[3]{\frac{c}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2} \cdot \frac{a}{a}}\right)\\ \mathbf{elif}\;b_2 \le 1.082532154480775910274546311935699605569 \cdot 10^{78}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot 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 -1.949506152818805461026129307942387611116 \cdot 10^{68}:\\
\;\;\;\;\frac{c}{b_2} \cdot \frac{-1}{2}\\

\mathbf{elif}\;b_2 \le -1.548986092369567119714011438756155483384 \cdot 10^{-252}:\\
\;\;\;\;\sqrt[3]{\frac{c}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2} \cdot \frac{a}{a}} \cdot \left(\sqrt[3]{\frac{c}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2} \cdot \frac{a}{a}} \cdot \sqrt[3]{\frac{c}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2} \cdot \frac{a}{a}}\right)\\

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

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

\end{array}
double f(double a, double b_2, double c) {
        double r30029 = b_2;
        double r30030 = -r30029;
        double r30031 = r30029 * r30029;
        double r30032 = a;
        double r30033 = c;
        double r30034 = r30032 * r30033;
        double r30035 = r30031 - r30034;
        double r30036 = sqrt(r30035);
        double r30037 = r30030 - r30036;
        double r30038 = r30037 / r30032;
        return r30038;
}

double f(double a, double b_2, double c) {
        double r30039 = b_2;
        double r30040 = -1.9495061528188055e+68;
        bool r30041 = r30039 <= r30040;
        double r30042 = c;
        double r30043 = r30042 / r30039;
        double r30044 = -0.5;
        double r30045 = r30043 * r30044;
        double r30046 = -1.548986092369567e-252;
        bool r30047 = r30039 <= r30046;
        double r30048 = r30039 * r30039;
        double r30049 = a;
        double r30050 = r30042 * r30049;
        double r30051 = r30048 - r30050;
        double r30052 = sqrt(r30051);
        double r30053 = r30052 - r30039;
        double r30054 = r30042 / r30053;
        double r30055 = r30049 / r30049;
        double r30056 = r30054 * r30055;
        double r30057 = cbrt(r30056);
        double r30058 = r30057 * r30057;
        double r30059 = r30057 * r30058;
        double r30060 = 1.082532154480776e+78;
        bool r30061 = r30039 <= r30060;
        double r30062 = 1.0;
        double r30063 = -r30039;
        double r30064 = r30063 - r30052;
        double r30065 = r30049 / r30064;
        double r30066 = r30062 / r30065;
        double r30067 = r30039 / r30049;
        double r30068 = -2.0;
        double r30069 = r30067 * r30068;
        double r30070 = r30061 ? r30066 : r30069;
        double r30071 = r30047 ? r30059 : r30070;
        double r30072 = r30041 ? r30045 : r30071;
        return r30072;
}

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 < -1.9495061528188055e+68

    1. Initial program 58.2

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

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b_2}}\]
    3. Simplified3.9

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

    if -1.9495061528188055e+68 < b_2 < -1.548986092369567e-252

    1. Initial program 32.9

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

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

      \[\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 add-cube-cbrt18.1

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

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

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

    if -1.548986092369567e-252 < b_2 < 1.082532154480776e+78

    1. Initial program 9.9

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

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

    if 1.082532154480776e+78 < b_2

    1. Initial program 42.5

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.949506152818805461026129307942387611116 \cdot 10^{68}:\\ \;\;\;\;\frac{c}{b_2} \cdot \frac{-1}{2}\\ \mathbf{elif}\;b_2 \le -1.548986092369567119714011438756155483384 \cdot 10^{-252}:\\ \;\;\;\;\sqrt[3]{\frac{c}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2} \cdot \frac{a}{a}} \cdot \left(\sqrt[3]{\frac{c}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2} \cdot \frac{a}{a}} \cdot \sqrt[3]{\frac{c}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2} \cdot \frac{a}{a}}\right)\\ \mathbf{elif}\;b_2 \le 1.082532154480775910274546311935699605569 \cdot 10^{78}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b_2}{a} \cdot -2\\ \end{array}\]

Reproduce

herbie shell --seed 2019196 +o rules:numerics
(FPCore (a b_2 c)
  :name "quad2m (problem 3.2.1, negative)"
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))