Average Error: 34.2 → 9.1
Time: 4.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 -1.850740894150185 \cdot 10^{20}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -6.1806208921043762 \cdot 10^{-95}:\\ \;\;\;\;\frac{1 \cdot \left(\left({b_2}^{2} - {b_2}^{2}\right) + a \cdot c\right)}{a} \cdot \frac{1}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\\ \mathbf{elif}\;b_2 \le -2.125553485370055 \cdot 10^{-113}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 6.29361288009581358 \cdot 10^{112}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\\ \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 -1.850740894150185 \cdot 10^{20}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

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

\mathbf{elif}\;b_2 \le -2.125553485370055 \cdot 10^{-113}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

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

\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 r15279 = b_2;
        double r15280 = -r15279;
        double r15281 = r15279 * r15279;
        double r15282 = a;
        double r15283 = c;
        double r15284 = r15282 * r15283;
        double r15285 = r15281 - r15284;
        double r15286 = sqrt(r15285);
        double r15287 = r15280 - r15286;
        double r15288 = r15287 / r15282;
        return r15288;
}

double f(double a, double b_2, double c) {
        double r15289 = b_2;
        double r15290 = -1.8507408941501855e+20;
        bool r15291 = r15289 <= r15290;
        double r15292 = -0.5;
        double r15293 = c;
        double r15294 = r15293 / r15289;
        double r15295 = r15292 * r15294;
        double r15296 = -6.180620892104376e-95;
        bool r15297 = r15289 <= r15296;
        double r15298 = 1.0;
        double r15299 = 2.0;
        double r15300 = pow(r15289, r15299);
        double r15301 = r15300 - r15300;
        double r15302 = a;
        double r15303 = r15302 * r15293;
        double r15304 = r15301 + r15303;
        double r15305 = r15298 * r15304;
        double r15306 = r15305 / r15302;
        double r15307 = -r15289;
        double r15308 = r15289 * r15289;
        double r15309 = r15308 - r15303;
        double r15310 = sqrt(r15309);
        double r15311 = r15307 + r15310;
        double r15312 = r15298 / r15311;
        double r15313 = r15306 * r15312;
        double r15314 = -2.125553485370055e-113;
        bool r15315 = r15289 <= r15314;
        double r15316 = 6.293612880095814e+112;
        bool r15317 = r15289 <= r15316;
        double r15318 = r15307 - r15310;
        double r15319 = r15302 / r15318;
        double r15320 = r15298 / r15319;
        double r15321 = 0.5;
        double r15322 = r15321 * r15294;
        double r15323 = r15289 / r15302;
        double r15324 = r15299 * r15323;
        double r15325 = r15322 - r15324;
        double r15326 = r15317 ? r15320 : r15325;
        double r15327 = r15315 ? r15295 : r15326;
        double r15328 = r15297 ? r15313 : r15327;
        double r15329 = r15291 ? r15295 : r15328;
        return r15329;
}

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.8507408941501855e+20 or -6.180620892104376e-95 < b_2 < -2.125553485370055e-113

    1. Initial program 54.9

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

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

    if -1.8507408941501855e+20 < b_2 < -6.180620892104376e-95

    1. Initial program 39.2

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

      \[\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 flip--39.2

      \[\leadsto \frac{1}{\frac{a}{\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}}}}}\]
    6. Applied associate-/r/39.3

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

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

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

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

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

    if -2.125553485370055e-113 < b_2 < 6.293612880095814e+112

    1. Initial program 12.1

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

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

    if 6.293612880095814e+112 < b_2

    1. Initial program 49.8

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

      \[\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 simplification9.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.850740894150185 \cdot 10^{20}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -6.1806208921043762 \cdot 10^{-95}:\\ \;\;\;\;\frac{1 \cdot \left(\left({b_2}^{2} - {b_2}^{2}\right) + a \cdot c\right)}{a} \cdot \frac{1}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\\ \mathbf{elif}\;b_2 \le -2.125553485370055 \cdot 10^{-113}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 6.29361288009581358 \cdot 10^{112}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \end{array}\]

Reproduce

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