Average Error: 34.1 → 5.9
Time: 16.9s
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 -2.303779241097880191978502132703296326983 \cdot 10^{138}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -8.315573719317121505976170608246968591153 \cdot 10^{-293}:\\ \;\;\;\;\frac{\frac{c}{\frac{a}{a}}}{\sqrt{b_2 \cdot b_2 - c \cdot a} + \left(-b_2\right)}\\ \mathbf{elif}\;b_2 \le 3.873872856767694950212899819321000474899 \cdot 10^{129}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;-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 -2.303779241097880191978502132703296326983 \cdot 10^{138}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

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

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

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

\end{array}
double f(double a, double b_2, double c) {
        double r70337 = b_2;
        double r70338 = -r70337;
        double r70339 = r70337 * r70337;
        double r70340 = a;
        double r70341 = c;
        double r70342 = r70340 * r70341;
        double r70343 = r70339 - r70342;
        double r70344 = sqrt(r70343);
        double r70345 = r70338 - r70344;
        double r70346 = r70345 / r70340;
        return r70346;
}

double f(double a, double b_2, double c) {
        double r70347 = b_2;
        double r70348 = -2.3037792410978802e+138;
        bool r70349 = r70347 <= r70348;
        double r70350 = -0.5;
        double r70351 = c;
        double r70352 = r70351 / r70347;
        double r70353 = r70350 * r70352;
        double r70354 = -8.315573719317122e-293;
        bool r70355 = r70347 <= r70354;
        double r70356 = a;
        double r70357 = r70356 / r70356;
        double r70358 = r70351 / r70357;
        double r70359 = r70347 * r70347;
        double r70360 = r70351 * r70356;
        double r70361 = r70359 - r70360;
        double r70362 = sqrt(r70361);
        double r70363 = -r70347;
        double r70364 = r70362 + r70363;
        double r70365 = r70358 / r70364;
        double r70366 = 3.873872856767695e+129;
        bool r70367 = r70347 <= r70366;
        double r70368 = r70363 - r70362;
        double r70369 = r70368 / r70356;
        double r70370 = -2.0;
        double r70371 = r70347 / r70356;
        double r70372 = r70370 * r70371;
        double r70373 = r70367 ? r70369 : r70372;
        double r70374 = r70355 ? r70365 : r70373;
        double r70375 = r70349 ? r70353 : r70374;
        return r70375;
}

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 < -2.3037792410978802e+138

    1. Initial program 62.4

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

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

    if -2.3037792410978802e+138 < b_2 < -8.315573719317122e-293

    1. Initial program 34.3

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied div-inv34.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--34.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/34.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. Simplified13.9

      \[\leadsto \frac{\color{blue}{\frac{0 + a \cdot c}{a}}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\]
    8. Using strategy rm
    9. Applied *-un-lft-identity13.9

      \[\leadsto \frac{\frac{0 + a \cdot c}{\color{blue}{1 \cdot a}}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\]
    10. Applied *-un-lft-identity13.9

      \[\leadsto \frac{\frac{\color{blue}{1 \cdot \left(0 + a \cdot c\right)}}{1 \cdot a}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\]
    11. Applied times-frac13.9

      \[\leadsto \frac{\color{blue}{\frac{1}{1} \cdot \frac{0 + a \cdot c}{a}}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\]
    12. Simplified13.9

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

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

    if -8.315573719317122e-293 < b_2 < 3.873872856767695e+129

    1. Initial program 8.8

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

      \[\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 pow19.0

      \[\leadsto \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \color{blue}{{\left(\frac{1}{a}\right)}^{1}}\]
    6. Applied pow19.0

      \[\leadsto \color{blue}{{\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}^{1}} \cdot {\left(\frac{1}{a}\right)}^{1}\]
    7. Applied pow-prod-down9.0

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

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

    if 3.873872856767695e+129 < b_2

    1. Initial program 55.8

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

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

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

      \[\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. Simplified62.8

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

      \[\leadsto \color{blue}{-2 \cdot \frac{b_2}{a}}\]
    9. Simplified2.5

      \[\leadsto \color{blue}{\frac{b_2}{a} \cdot -2}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification5.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -2.303779241097880191978502132703296326983 \cdot 10^{138}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -8.315573719317121505976170608246968591153 \cdot 10^{-293}:\\ \;\;\;\;\frac{\frac{c}{\frac{a}{a}}}{\sqrt{b_2 \cdot b_2 - c \cdot a} + \left(-b_2\right)}\\ \mathbf{elif}\;b_2 \le 3.873872856767694950212899819321000474899 \cdot 10^{129}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2019174 
(FPCore (a b_2 c)
  :name "NMSE problem 3.2.1"
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))