Average Error: 33.3 → 8.1
Time: 13.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 -1.2369944453048376 \cdot 10^{+89}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \mathbf{elif}\;b_2 \le -3.7384489584107623 \cdot 10^{-124}:\\ \;\;\;\;\frac{\left(b_2 \cdot b_2 - c \cdot a\right) \cdot \sqrt{b_2 \cdot b_2 - c \cdot a} - b_2 \cdot \left(b_2 \cdot b_2\right)}{b_2 \cdot b_2 + \left(b_2 \cdot \sqrt{b_2 \cdot b_2 - c \cdot a} + \left(b_2 \cdot b_2 - c \cdot a\right)\right)} \cdot \frac{1}{a}\\ \mathbf{elif}\;b_2 \le 2.0885397681754355 \cdot 10^{+151}:\\ \;\;\;\;\frac{-c}{\sqrt{b_2 \cdot b_2 - c \cdot a} + b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_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.2369944453048376 \cdot 10^{+89}:\\
\;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\

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

\mathbf{elif}\;b_2 \le 2.0885397681754355 \cdot 10^{+151}:\\
\;\;\;\;\frac{-c}{\sqrt{b_2 \cdot b_2 - c \cdot a} + b_2}\\

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

\end{array}
double f(double a, double b_2, double c) {
        double r289840 = b_2;
        double r289841 = -r289840;
        double r289842 = r289840 * r289840;
        double r289843 = a;
        double r289844 = c;
        double r289845 = r289843 * r289844;
        double r289846 = r289842 - r289845;
        double r289847 = sqrt(r289846);
        double r289848 = r289841 + r289847;
        double r289849 = r289848 / r289843;
        return r289849;
}

double f(double a, double b_2, double c) {
        double r289850 = b_2;
        double r289851 = -1.2369944453048376e+89;
        bool r289852 = r289850 <= r289851;
        double r289853 = 0.5;
        double r289854 = c;
        double r289855 = r289854 / r289850;
        double r289856 = r289853 * r289855;
        double r289857 = a;
        double r289858 = r289850 / r289857;
        double r289859 = 2.0;
        double r289860 = r289858 * r289859;
        double r289861 = r289856 - r289860;
        double r289862 = -3.7384489584107623e-124;
        bool r289863 = r289850 <= r289862;
        double r289864 = r289850 * r289850;
        double r289865 = r289854 * r289857;
        double r289866 = r289864 - r289865;
        double r289867 = sqrt(r289866);
        double r289868 = r289866 * r289867;
        double r289869 = r289850 * r289864;
        double r289870 = r289868 - r289869;
        double r289871 = r289850 * r289867;
        double r289872 = r289871 + r289866;
        double r289873 = r289864 + r289872;
        double r289874 = r289870 / r289873;
        double r289875 = 1.0;
        double r289876 = r289875 / r289857;
        double r289877 = r289874 * r289876;
        double r289878 = 2.0885397681754355e+151;
        bool r289879 = r289850 <= r289878;
        double r289880 = -r289854;
        double r289881 = r289867 + r289850;
        double r289882 = r289880 / r289881;
        double r289883 = -0.5;
        double r289884 = r289883 * r289855;
        double r289885 = r289879 ? r289882 : r289884;
        double r289886 = r289863 ? r289877 : r289885;
        double r289887 = r289852 ? r289861 : r289886;
        return r289887;
}

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.2369944453048376e+89

    1. Initial program 42.3

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Simplified42.3

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

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

    if -1.2369944453048376e+89 < b_2 < -3.7384489584107623e-124

    1. Initial program 5.8

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Simplified5.8

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}}\]
    3. Using strategy rm
    4. Applied div-inv6.0

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

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

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

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

    if -3.7384489584107623e-124 < b_2 < 2.0885397681754355e+151

    1. Initial program 29.6

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Simplified29.6

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}}\]
    3. Using strategy rm
    4. Applied div-inv29.6

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

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c} - b_2 \cdot b_2}{\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2}} \cdot \frac{1}{a}\]
    7. Applied associate-*l/30.7

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

      \[\leadsto \frac{\color{blue}{\frac{\left(b_2 \cdot b_2 - a \cdot c\right) - b_2 \cdot b_2}{a}}}{\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2}\]
    9. Taylor expanded around -inf 10.3

      \[\leadsto \frac{\color{blue}{-1 \cdot c}}{\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2}\]
    10. Simplified10.3

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

    if 2.0885397681754355e+151 < b_2

    1. Initial program 62.5

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Simplified62.5

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}}\]
    3. Using strategy rm
    4. Applied div-inv62.5

      \[\leadsto \color{blue}{\left(\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2\right) \cdot \frac{1}{a}}\]
    5. Taylor expanded around inf 1.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.2369944453048376 \cdot 10^{+89}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \mathbf{elif}\;b_2 \le -3.7384489584107623 \cdot 10^{-124}:\\ \;\;\;\;\frac{\left(b_2 \cdot b_2 - c \cdot a\right) \cdot \sqrt{b_2 \cdot b_2 - c \cdot a} - b_2 \cdot \left(b_2 \cdot b_2\right)}{b_2 \cdot b_2 + \left(b_2 \cdot \sqrt{b_2 \cdot b_2 - c \cdot a} + \left(b_2 \cdot b_2 - c \cdot a\right)\right)} \cdot \frac{1}{a}\\ \mathbf{elif}\;b_2 \le 2.0885397681754355 \cdot 10^{+151}:\\ \;\;\;\;\frac{-c}{\sqrt{b_2 \cdot b_2 - c \cdot a} + b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \end{array}\]

Reproduce

herbie shell --seed 2019128 
(FPCore (a b_2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))