Average Error: 33.9 → 11.0
Time: 4.8s
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 -524848456042.22467:\\ \;\;\;\;1 \cdot \left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)\\ \mathbf{elif}\;b_2 \le -2.374474662067348 \cdot 10^{-33}:\\ \;\;\;\;\frac{\frac{{b_2}^{2}}{a} - \frac{b_2 \cdot b_2 - a \cdot c}{a}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\\ \mathbf{elif}\;b_2 \le -8.63724924767252634 \cdot 10^{-116}:\\ \;\;\;\;1 \cdot \left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)\\ \mathbf{elif}\;b_2 \le 5.57925007375450966 \cdot 10^{51}:\\ \;\;\;\;1 \cdot \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(-2 \cdot \frac{b_2}{a}\right)\\ \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 -524848456042.22467:\\
\;\;\;\;1 \cdot \left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)\\

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

\mathbf{elif}\;b_2 \le -8.63724924767252634 \cdot 10^{-116}:\\
\;\;\;\;1 \cdot \left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)\\

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

\mathbf{else}:\\
\;\;\;\;1 \cdot \left(-2 \cdot \frac{b_2}{a}\right)\\

\end{array}
double f(double a, double b_2, double c) {
        double r68226 = b_2;
        double r68227 = -r68226;
        double r68228 = r68226 * r68226;
        double r68229 = a;
        double r68230 = c;
        double r68231 = r68229 * r68230;
        double r68232 = r68228 - r68231;
        double r68233 = sqrt(r68232);
        double r68234 = r68227 - r68233;
        double r68235 = r68234 / r68229;
        return r68235;
}

double f(double a, double b_2, double c) {
        double r68236 = b_2;
        double r68237 = -524848456042.2247;
        bool r68238 = r68236 <= r68237;
        double r68239 = 1.0;
        double r68240 = -0.5;
        double r68241 = c;
        double r68242 = r68241 / r68236;
        double r68243 = r68240 * r68242;
        double r68244 = r68239 * r68243;
        double r68245 = -2.374474662067348e-33;
        bool r68246 = r68236 <= r68245;
        double r68247 = 2.0;
        double r68248 = pow(r68236, r68247);
        double r68249 = a;
        double r68250 = r68248 / r68249;
        double r68251 = r68236 * r68236;
        double r68252 = r68249 * r68241;
        double r68253 = r68251 - r68252;
        double r68254 = r68253 / r68249;
        double r68255 = r68250 - r68254;
        double r68256 = -r68236;
        double r68257 = sqrt(r68253);
        double r68258 = r68256 + r68257;
        double r68259 = r68255 / r68258;
        double r68260 = -8.637249247672526e-116;
        bool r68261 = r68236 <= r68260;
        double r68262 = 5.5792500737545097e+51;
        bool r68263 = r68236 <= r68262;
        double r68264 = r68256 - r68257;
        double r68265 = r68264 / r68249;
        double r68266 = r68239 * r68265;
        double r68267 = -2.0;
        double r68268 = r68236 / r68249;
        double r68269 = r68267 * r68268;
        double r68270 = r68239 * r68269;
        double r68271 = r68263 ? r68266 : r68270;
        double r68272 = r68261 ? r68244 : r68271;
        double r68273 = r68246 ? r68259 : r68272;
        double r68274 = r68238 ? r68244 : r68273;
        return r68274;
}

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 < -524848456042.2247 or -2.374474662067348e-33 < b_2 < -8.637249247672526e-116

    1. Initial program 52.4

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

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

      \[\leadsto \color{blue}{\left(1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)\right)} \cdot \frac{1}{a}\]
    6. Applied associate-*l*52.4

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

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

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

    if -524848456042.2247 < b_2 < -2.374474662067348e-33

    1. Initial program 40.3

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

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

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

      \[\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. Simplified40.3

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

    if -8.637249247672526e-116 < b_2 < 5.5792500737545097e+51

    1. Initial program 12.3

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

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

      \[\leadsto \color{blue}{\left(1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)\right)} \cdot \frac{1}{a}\]
    6. Applied associate-*l*12.4

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

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

    if 5.5792500737545097e+51 < b_2

    1. Initial program 38.1

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

      \[\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-lft-identity38.2

      \[\leadsto \color{blue}{\left(1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)\right)} \cdot \frac{1}{a}\]
    6. Applied associate-*l*38.2

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

      \[\leadsto 1 \cdot \color{blue}{\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}}\]
    8. Using strategy rm
    9. Applied clear-num38.2

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

      \[\leadsto 1 \cdot \color{blue}{\left(-2 \cdot \frac{b_2}{a}\right)}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification11.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -524848456042.22467:\\ \;\;\;\;1 \cdot \left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)\\ \mathbf{elif}\;b_2 \le -2.374474662067348 \cdot 10^{-33}:\\ \;\;\;\;\frac{\frac{{b_2}^{2}}{a} - \frac{b_2 \cdot b_2 - a \cdot c}{a}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\\ \mathbf{elif}\;b_2 \le -8.63724924767252634 \cdot 10^{-116}:\\ \;\;\;\;1 \cdot \left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)\\ \mathbf{elif}\;b_2 \le 5.57925007375450966 \cdot 10^{51}:\\ \;\;\;\;1 \cdot \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(-2 \cdot \frac{b_2}{a}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020018 +o rules:numerics
(FPCore (a b_2 c)
  :name "NMSE problem 3.2.1"
  :precision binary64
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))