Average Error: 33.1 → 9.1
Time: 1.2m
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.6124744946043857 \cdot 10^{+143}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \mathbf{elif}\;b_2 \le 3.3843940179135867 \cdot 10^{-248}:\\ \;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}{a}\\ \mathbf{elif}\;b_2 \le 9.494042583021857 \cdot 10^{+36}:\\ \;\;\;\;\frac{-\frac{c \cdot a}{a}}{\sqrt{b_2 \cdot b_2 - c \cdot a} + b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b_2} \cdot \frac{-1}{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.6124744946043857 \cdot 10^{+143}:\\
\;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\

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

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

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

\end{array}
double f(double a, double b_2, double c) {
        double r2816835 = b_2;
        double r2816836 = -r2816835;
        double r2816837 = r2816835 * r2816835;
        double r2816838 = a;
        double r2816839 = c;
        double r2816840 = r2816838 * r2816839;
        double r2816841 = r2816837 - r2816840;
        double r2816842 = sqrt(r2816841);
        double r2816843 = r2816836 + r2816842;
        double r2816844 = r2816843 / r2816838;
        return r2816844;
}

double f(double a, double b_2, double c) {
        double r2816845 = b_2;
        double r2816846 = -1.6124744946043857e+143;
        bool r2816847 = r2816845 <= r2816846;
        double r2816848 = 0.5;
        double r2816849 = c;
        double r2816850 = r2816849 / r2816845;
        double r2816851 = r2816848 * r2816850;
        double r2816852 = a;
        double r2816853 = r2816845 / r2816852;
        double r2816854 = 2.0;
        double r2816855 = r2816853 * r2816854;
        double r2816856 = r2816851 - r2816855;
        double r2816857 = 3.3843940179135867e-248;
        bool r2816858 = r2816845 <= r2816857;
        double r2816859 = r2816845 * r2816845;
        double r2816860 = r2816849 * r2816852;
        double r2816861 = r2816859 - r2816860;
        double r2816862 = sqrt(r2816861);
        double r2816863 = r2816862 - r2816845;
        double r2816864 = r2816863 / r2816852;
        double r2816865 = 9.494042583021857e+36;
        bool r2816866 = r2816845 <= r2816865;
        double r2816867 = r2816860 / r2816852;
        double r2816868 = -r2816867;
        double r2816869 = r2816862 + r2816845;
        double r2816870 = r2816868 / r2816869;
        double r2816871 = -0.5;
        double r2816872 = r2816850 * r2816871;
        double r2816873 = r2816866 ? r2816870 : r2816872;
        double r2816874 = r2816858 ? r2816864 : r2816873;
        double r2816875 = r2816847 ? r2816856 : r2816874;
        return r2816875;
}

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.6124744946043857e+143

    1. Initial program 57.1

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

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

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

    if -1.6124744946043857e+143 < b_2 < 3.3843940179135867e-248

    1. Initial program 9.4

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity9.5

      \[\leadsto \frac{1}{\color{blue}{1 \cdot \frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}\]
    7. Applied *-un-lft-identity9.5

      \[\leadsto \frac{\color{blue}{1 \cdot 1}}{1 \cdot \frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}\]
    8. Applied times-frac9.5

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

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

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

    if 3.3843940179135867e-248 < b_2 < 9.494042583021857e+36

    1. Initial program 31.1

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

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

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

      \[\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/31.2

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

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

    if 9.494042583021857e+36 < b_2

    1. Initial program 55.2

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.6124744946043857 \cdot 10^{+143}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \mathbf{elif}\;b_2 \le 3.3843940179135867 \cdot 10^{-248}:\\ \;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}{a}\\ \mathbf{elif}\;b_2 \le 9.494042583021857 \cdot 10^{+36}:\\ \;\;\;\;\frac{-\frac{c \cdot a}{a}}{\sqrt{b_2 \cdot b_2 - c \cdot a} + b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b_2} \cdot \frac{-1}{2}\\ \end{array}\]

Reproduce

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