Average Error: 33.2 → 10.5
Time: 20.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 -1.3735480881409494 \cdot 10^{+97}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \mathbf{elif}\;b_2 \le 7.189328114522003 \cdot 10^{-21}:\\ \;\;\;\;\frac{\sqrt{\sqrt{b_2 \cdot b_2 - c \cdot a}} \cdot \sqrt{\left|\sqrt[3]{b_2 \cdot b_2 - c \cdot a}\right| \cdot \sqrt{\sqrt[3]{b_2 \cdot b_2 - c \cdot a}}} - b_2}{a}\\ \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.3735480881409494 \cdot 10^{+97}:\\
\;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\

\mathbf{elif}\;b_2 \le 7.189328114522003 \cdot 10^{-21}:\\
\;\;\;\;\frac{\sqrt{\sqrt{b_2 \cdot b_2 - c \cdot a}} \cdot \sqrt{\left|\sqrt[3]{b_2 \cdot b_2 - c \cdot a}\right| \cdot \sqrt{\sqrt[3]{b_2 \cdot b_2 - c \cdot a}}} - b_2}{a}\\

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

\end{array}
double f(double a, double b_2, double c) {
        double r588254 = b_2;
        double r588255 = -r588254;
        double r588256 = r588254 * r588254;
        double r588257 = a;
        double r588258 = c;
        double r588259 = r588257 * r588258;
        double r588260 = r588256 - r588259;
        double r588261 = sqrt(r588260);
        double r588262 = r588255 + r588261;
        double r588263 = r588262 / r588257;
        return r588263;
}

double f(double a, double b_2, double c) {
        double r588264 = b_2;
        double r588265 = -1.3735480881409494e+97;
        bool r588266 = r588264 <= r588265;
        double r588267 = 0.5;
        double r588268 = c;
        double r588269 = r588268 / r588264;
        double r588270 = r588267 * r588269;
        double r588271 = a;
        double r588272 = r588264 / r588271;
        double r588273 = 2.0;
        double r588274 = r588272 * r588273;
        double r588275 = r588270 - r588274;
        double r588276 = 7.189328114522003e-21;
        bool r588277 = r588264 <= r588276;
        double r588278 = r588264 * r588264;
        double r588279 = r588268 * r588271;
        double r588280 = r588278 - r588279;
        double r588281 = sqrt(r588280);
        double r588282 = sqrt(r588281);
        double r588283 = cbrt(r588280);
        double r588284 = fabs(r588283);
        double r588285 = sqrt(r588283);
        double r588286 = r588284 * r588285;
        double r588287 = sqrt(r588286);
        double r588288 = r588282 * r588287;
        double r588289 = r588288 - r588264;
        double r588290 = r588289 / r588271;
        double r588291 = -0.5;
        double r588292 = r588291 * r588269;
        double r588293 = r588277 ? r588290 : r588292;
        double r588294 = r588266 ? r588275 : r588293;
        return r588294;
}

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 3 regimes
  2. if b_2 < -1.3735480881409494e+97

    1. Initial program 44.3

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

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

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

    if -1.3735480881409494e+97 < b_2 < 7.189328114522003e-21

    1. Initial program 14.9

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

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

      \[\leadsto \frac{\color{blue}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}} - b_2}{a}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt15.1

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

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

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

    if 7.189328114522003e-21 < b_2

    1. Initial program 54.7

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.3735480881409494 \cdot 10^{+97}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \mathbf{elif}\;b_2 \le 7.189328114522003 \cdot 10^{-21}:\\ \;\;\;\;\frac{\sqrt{\sqrt{b_2 \cdot b_2 - c \cdot a}} \cdot \sqrt{\left|\sqrt[3]{b_2 \cdot b_2 - c \cdot a}\right| \cdot \sqrt{\sqrt[3]{b_2 \cdot b_2 - c \cdot a}}} - b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \end{array}\]

Reproduce

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