Average Error: 33.9 → 10.4
Time: 20.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.5961406266953245 \cdot 10^{-58}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 3.1115579814291686 \cdot 10^{+29}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\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.5961406266953245 \cdot 10^{-58}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

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

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

\end{array}
double f(double a, double b_2, double c) {
        double r2463270 = b_2;
        double r2463271 = -r2463270;
        double r2463272 = r2463270 * r2463270;
        double r2463273 = a;
        double r2463274 = c;
        double r2463275 = r2463273 * r2463274;
        double r2463276 = r2463272 - r2463275;
        double r2463277 = sqrt(r2463276);
        double r2463278 = r2463271 - r2463277;
        double r2463279 = r2463278 / r2463273;
        return r2463279;
}

double f(double a, double b_2, double c) {
        double r2463280 = b_2;
        double r2463281 = -1.5961406266953245e-58;
        bool r2463282 = r2463280 <= r2463281;
        double r2463283 = -0.5;
        double r2463284 = c;
        double r2463285 = r2463284 / r2463280;
        double r2463286 = r2463283 * r2463285;
        double r2463287 = 3.1115579814291686e+29;
        bool r2463288 = r2463280 <= r2463287;
        double r2463289 = -r2463280;
        double r2463290 = r2463280 * r2463280;
        double r2463291 = a;
        double r2463292 = r2463291 * r2463284;
        double r2463293 = r2463290 - r2463292;
        double r2463294 = sqrt(r2463293);
        double r2463295 = r2463289 - r2463294;
        double r2463296 = r2463295 / r2463291;
        double r2463297 = r2463280 / r2463291;
        double r2463298 = -2.0;
        double r2463299 = r2463297 * r2463298;
        double r2463300 = r2463288 ? r2463296 : r2463299;
        double r2463301 = r2463282 ? r2463286 : r2463300;
        return r2463301;
}

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.5961406266953245e-58

    1. Initial program 53.4

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

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

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

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

    if -1.5961406266953245e-58 < b_2 < 3.1115579814291686e+29

    1. Initial program 14.7

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

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

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

      \[\leadsto \frac{\left(-b_2\right) - \color{blue}{1 \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}\]
    6. Applied *-un-lft-identity14.7

      \[\leadsto \frac{\color{blue}{1 \cdot \left(-b_2\right)} - 1 \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    7. Applied distribute-lft-out--14.7

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    9. Using strategy rm
    10. Applied associate-/r/14.8

      \[\leadsto \color{blue}{\frac{1}{a} \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}\]
    11. Using strategy rm
    12. Applied associate-*l/14.7

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

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

    if 3.1115579814291686e+29 < b_2

    1. Initial program 34.4

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

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

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{b_2 \cdot b_2 - a \cdot c}}}{a}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity34.4

      \[\leadsto \frac{\left(-b_2\right) - \color{blue}{1 \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}\]
    6. Applied *-un-lft-identity34.4

      \[\leadsto \frac{\color{blue}{1 \cdot \left(-b_2\right)} - 1 \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    7. Applied distribute-lft-out--34.4

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    9. Using strategy rm
    10. Applied associate-/r/34.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.5961406266953245 \cdot 10^{-58}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 3.1115579814291686 \cdot 10^{+29}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b_2}{a} \cdot -2\\ \end{array}\]

Reproduce

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