Average Error: 34.1 → 8.4
Time: 7.0s
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 -5.9781116525486667988079736143201932298 \cdot 10^{136}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.626652957185991075321821178076734677364 \cdot 10^{-213}:\\ \;\;\;\;\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \frac{\frac{\left(\left({b_2}^{2} - {b_2}^{2}\right) + a \cdot c\right) \cdot \sqrt[3]{1}}{a}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\\ \mathbf{elif}\;b_2 \le 3.130048246919790211040224873353462903248 \cdot 10^{128}:\\ \;\;\;\;\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \left(\frac{\sqrt[3]{1}}{a} \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 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 -5.9781116525486667988079736143201932298 \cdot 10^{136}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

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

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

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

\end{array}
double f(double a, double b_2, double c) {
        double r25917 = b_2;
        double r25918 = -r25917;
        double r25919 = r25917 * r25917;
        double r25920 = a;
        double r25921 = c;
        double r25922 = r25920 * r25921;
        double r25923 = r25919 - r25922;
        double r25924 = sqrt(r25923);
        double r25925 = r25918 - r25924;
        double r25926 = r25925 / r25920;
        return r25926;
}

double f(double a, double b_2, double c) {
        double r25927 = b_2;
        double r25928 = -5.978111652548667e+136;
        bool r25929 = r25927 <= r25928;
        double r25930 = -0.5;
        double r25931 = c;
        double r25932 = r25931 / r25927;
        double r25933 = r25930 * r25932;
        double r25934 = 1.626652957185991e-213;
        bool r25935 = r25927 <= r25934;
        double r25936 = 1.0;
        double r25937 = cbrt(r25936);
        double r25938 = r25937 * r25937;
        double r25939 = 2.0;
        double r25940 = pow(r25927, r25939);
        double r25941 = r25940 - r25940;
        double r25942 = a;
        double r25943 = r25942 * r25931;
        double r25944 = r25941 + r25943;
        double r25945 = r25944 * r25937;
        double r25946 = r25945 / r25942;
        double r25947 = -r25927;
        double r25948 = r25927 * r25927;
        double r25949 = r25948 - r25943;
        double r25950 = sqrt(r25949);
        double r25951 = r25947 + r25950;
        double r25952 = r25946 / r25951;
        double r25953 = r25938 * r25952;
        double r25954 = 3.1300482469197902e+128;
        bool r25955 = r25927 <= r25954;
        double r25956 = r25937 / r25942;
        double r25957 = r25947 - r25950;
        double r25958 = r25956 * r25957;
        double r25959 = r25938 * r25958;
        double r25960 = 0.5;
        double r25961 = r25960 * r25932;
        double r25962 = r25927 / r25942;
        double r25963 = r25939 * r25962;
        double r25964 = r25961 - r25963;
        double r25965 = r25955 ? r25959 : r25964;
        double r25966 = r25935 ? r25953 : r25965;
        double r25967 = r25929 ? r25933 : r25966;
        return r25967;
}

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 < -5.978111652548667e+136

    1. Initial program 61.8

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

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

    if -5.978111652548667e+136 < b_2 < 1.626652957185991e-213

    1. Initial program 30.9

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    4. Using strategy rm
    5. Applied div-inv30.9

      \[\leadsto \frac{1}{\color{blue}{a \cdot \frac{1}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    6. Applied associate-/r*30.9

      \[\leadsto \color{blue}{\frac{\frac{1}{a}}{\frac{1}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    7. Using strategy rm
    8. Applied *-un-lft-identity30.9

      \[\leadsto \frac{\frac{1}{a}}{\frac{1}{\color{blue}{1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}}\]
    9. Applied add-sqr-sqrt30.9

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

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

      \[\leadsto \frac{\frac{1}{\color{blue}{1 \cdot a}}}{\frac{\sqrt{1}}{1} \cdot \frac{\sqrt{1}}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\]
    12. Applied add-cube-cbrt30.9

      \[\leadsto \frac{\frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{1 \cdot a}}{\frac{\sqrt{1}}{1} \cdot \frac{\sqrt{1}}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\]
    13. Applied times-frac30.9

      \[\leadsto \frac{\color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\sqrt[3]{1}}{a}}}{\frac{\sqrt{1}}{1} \cdot \frac{\sqrt{1}}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\]
    14. Applied times-frac30.9

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

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

      \[\leadsto \left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \color{blue}{\left(\frac{\sqrt[3]{1}}{a} \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)\right)}\]
    17. Using strategy rm
    18. Applied flip--31.0

      \[\leadsto \left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \left(\frac{\sqrt[3]{1}}{a} \cdot \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}}}\right)\]
    19. Applied associate-*r/31.0

      \[\leadsto \left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \color{blue}{\frac{\frac{\sqrt[3]{1}}{a} \cdot \left(\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}\right)}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}\]
    20. Simplified14.2

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

    if 1.626652957185991e-213 < b_2 < 3.1300482469197902e+128

    1. Initial program 7.5

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    4. Using strategy rm
    5. Applied div-inv7.8

      \[\leadsto \frac{1}{\color{blue}{a \cdot \frac{1}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    6. Applied associate-/r*7.8

      \[\leadsto \color{blue}{\frac{\frac{1}{a}}{\frac{1}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    7. Using strategy rm
    8. Applied *-un-lft-identity7.8

      \[\leadsto \frac{\frac{1}{a}}{\frac{1}{\color{blue}{1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}}\]
    9. Applied add-sqr-sqrt7.8

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

      \[\leadsto \frac{\frac{1}{a}}{\color{blue}{\frac{\sqrt{1}}{1} \cdot \frac{\sqrt{1}}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    11. Applied *-un-lft-identity7.8

      \[\leadsto \frac{\frac{1}{\color{blue}{1 \cdot a}}}{\frac{\sqrt{1}}{1} \cdot \frac{\sqrt{1}}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\]
    12. Applied add-cube-cbrt7.8

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

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

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

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

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

    if 3.1300482469197902e+128 < b_2

    1. Initial program 54.2

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

      \[\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 simplification8.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -5.9781116525486667988079736143201932298 \cdot 10^{136}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.626652957185991075321821178076734677364 \cdot 10^{-213}:\\ \;\;\;\;\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \frac{\frac{\left(\left({b_2}^{2} - {b_2}^{2}\right) + a \cdot c\right) \cdot \sqrt[3]{1}}{a}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\\ \mathbf{elif}\;b_2 \le 3.130048246919790211040224873353462903248 \cdot 10^{128}:\\ \;\;\;\;\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \left(\frac{\sqrt[3]{1}}{a} \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \end{array}\]

Reproduce

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