Average Error: 34.0 → 8.1
Time: 23.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 -4.293594559701796 \cdot 10^{+48}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -7.54129264686236 \cdot 10^{-161}:\\ \;\;\;\;\frac{\frac{1}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}}{\sqrt[3]{a}} \cdot \left(c \cdot \sqrt[3]{a}\right)\\ \mathbf{elif}\;b_2 \le 2.6656023684116586 \cdot 10^{+55}:\\ \;\;\;\;\left(-\frac{b_2}{a}\right) - \frac{\sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \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 -4.293594559701796 \cdot 10^{+48}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

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

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

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

\end{array}
double f(double a, double b_2, double c) {
        double r790876 = b_2;
        double r790877 = -r790876;
        double r790878 = r790876 * r790876;
        double r790879 = a;
        double r790880 = c;
        double r790881 = r790879 * r790880;
        double r790882 = r790878 - r790881;
        double r790883 = sqrt(r790882);
        double r790884 = r790877 - r790883;
        double r790885 = r790884 / r790879;
        return r790885;
}

double f(double a, double b_2, double c) {
        double r790886 = b_2;
        double r790887 = -4.293594559701796e+48;
        bool r790888 = r790886 <= r790887;
        double r790889 = -0.5;
        double r790890 = c;
        double r790891 = r790890 / r790886;
        double r790892 = r790889 * r790891;
        double r790893 = -7.54129264686236e-161;
        bool r790894 = r790886 <= r790893;
        double r790895 = 1.0;
        double r790896 = r790886 * r790886;
        double r790897 = a;
        double r790898 = r790890 * r790897;
        double r790899 = r790896 - r790898;
        double r790900 = sqrt(r790899);
        double r790901 = r790900 - r790886;
        double r790902 = r790895 / r790901;
        double r790903 = cbrt(r790897);
        double r790904 = r790902 / r790903;
        double r790905 = r790890 * r790903;
        double r790906 = r790904 * r790905;
        double r790907 = 2.6656023684116586e+55;
        bool r790908 = r790886 <= r790907;
        double r790909 = r790886 / r790897;
        double r790910 = -r790909;
        double r790911 = r790900 / r790897;
        double r790912 = r790910 - r790911;
        double r790913 = -2.0;
        double r790914 = r790913 * r790909;
        double r790915 = r790908 ? r790912 : r790914;
        double r790916 = r790894 ? r790906 : r790915;
        double r790917 = r790888 ? r790892 : r790916;
        return r790917;
}

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 < -4.293594559701796e+48

    1. Initial program 56.9

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

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

    if -4.293594559701796e+48 < b_2 < -7.54129264686236e-161

    1. Initial program 36.0

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

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

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

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

      \[\leadsto \frac{\frac{0 + a \cdot c}{\sqrt{\color{blue}{{b_2}^{2} - a \cdot c}} - b_2}}{a}\]
    7. Simplified16.7

      \[\leadsto \frac{\frac{0 + a \cdot c}{\sqrt{\color{blue}{b_2 \cdot b_2 - a \cdot c}} - b_2}}{a}\]
    8. Using strategy rm
    9. Applied add-cube-cbrt17.4

      \[\leadsto \frac{\frac{0 + a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{\color{blue}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}}\]
    10. Applied div-inv17.4

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

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

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

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

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

    if -7.54129264686236e-161 < b_2 < 2.6656023684116586e+55

    1. Initial program 12.0

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

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

    if 2.6656023684116586e+55 < b_2

    1. Initial program 37.1

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

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

      \[\leadsto \frac{\frac{0 + a \cdot c}{\sqrt{\color{blue}{{b_2}^{2} - a \cdot c}} - b_2}}{a}\]
    7. Simplified60.4

      \[\leadsto \frac{\frac{0 + a \cdot c}{\sqrt{\color{blue}{b_2 \cdot b_2 - a \cdot c}} - b_2}}{a}\]
    8. Using strategy rm
    9. Applied add-cube-cbrt60.4

      \[\leadsto \frac{\frac{0 + a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{\color{blue}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}}\]
    10. Applied div-inv60.4

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -4.293594559701796 \cdot 10^{+48}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -7.54129264686236 \cdot 10^{-161}:\\ \;\;\;\;\frac{\frac{1}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}}{\sqrt[3]{a}} \cdot \left(c \cdot \sqrt[3]{a}\right)\\ \mathbf{elif}\;b_2 \le 2.6656023684116586 \cdot 10^{+55}:\\ \;\;\;\;\left(-\frac{b_2}{a}\right) - \frac{\sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2019141 
(FPCore (a b_2 c)
  :name "quad2m (problem 3.2.1, negative)"
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))