Average Error: 33.6 → 6.4
Time: 17.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.9672173170101533 \cdot 10^{+127}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 4.896282005087315 \cdot 10^{-305}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)}\\ \mathbf{elif}\;b_2 \le 9.373274758933483 \cdot 10^{+147}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b_2} \cdot \frac{1}{2} - \frac{b_2}{a} \cdot 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.9672173170101533 \cdot 10^{+127}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

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

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

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

\end{array}
double f(double a, double b_2, double c) {
        double r549214 = b_2;
        double r549215 = -r549214;
        double r549216 = r549214 * r549214;
        double r549217 = a;
        double r549218 = c;
        double r549219 = r549217 * r549218;
        double r549220 = r549216 - r549219;
        double r549221 = sqrt(r549220);
        double r549222 = r549215 - r549221;
        double r549223 = r549222 / r549217;
        return r549223;
}

double f(double a, double b_2, double c) {
        double r549224 = b_2;
        double r549225 = -1.9672173170101533e+127;
        bool r549226 = r549224 <= r549225;
        double r549227 = -0.5;
        double r549228 = c;
        double r549229 = r549228 / r549224;
        double r549230 = r549227 * r549229;
        double r549231 = 4.896282005087315e-305;
        bool r549232 = r549224 <= r549231;
        double r549233 = r549224 * r549224;
        double r549234 = a;
        double r549235 = r549234 * r549228;
        double r549236 = r549233 - r549235;
        double r549237 = sqrt(r549236);
        double r549238 = -r549224;
        double r549239 = r549237 + r549238;
        double r549240 = r549228 / r549239;
        double r549241 = 9.373274758933483e+147;
        bool r549242 = r549224 <= r549241;
        double r549243 = r549238 - r549237;
        double r549244 = r549243 / r549234;
        double r549245 = 0.5;
        double r549246 = r549229 * r549245;
        double r549247 = r549224 / r549234;
        double r549248 = 2.0;
        double r549249 = r549247 * r549248;
        double r549250 = r549246 - r549249;
        double r549251 = r549242 ? r549244 : r549250;
        double r549252 = r549232 ? r549240 : r549251;
        double r549253 = r549226 ? r549230 : r549252;
        return r549253;
}

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.9672173170101533e+127

    1. Initial program 60.7

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

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

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

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

    if -1.9672173170101533e+127 < b_2 < 4.896282005087315e-305

    1. Initial program 33.7

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

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

      \[\leadsto \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}}} \cdot \frac{1}{a}\]
    6. Applied associate-*l/33.8

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

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

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

    if 4.896282005087315e-305 < b_2 < 9.373274758933483e+147

    1. Initial program 8.9

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

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

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

    if 9.373274758933483e+147 < b_2

    1. Initial program 58.9

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.9672173170101533 \cdot 10^{+127}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 4.896282005087315 \cdot 10^{-305}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)}\\ \mathbf{elif}\;b_2 \le 9.373274758933483 \cdot 10^{+147}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b_2} \cdot \frac{1}{2} - \frac{b_2}{a} \cdot 2\\ \end{array}\]

Reproduce

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