Average Error: 33.6 → 6.4
Time: 16.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 r2052581 = b_2;
        double r2052582 = -r2052581;
        double r2052583 = r2052581 * r2052581;
        double r2052584 = a;
        double r2052585 = c;
        double r2052586 = r2052584 * r2052585;
        double r2052587 = r2052583 - r2052586;
        double r2052588 = sqrt(r2052587);
        double r2052589 = r2052582 - r2052588;
        double r2052590 = r2052589 / r2052584;
        return r2052590;
}

double f(double a, double b_2, double c) {
        double r2052591 = b_2;
        double r2052592 = -1.9672173170101533e+127;
        bool r2052593 = r2052591 <= r2052592;
        double r2052594 = -0.5;
        double r2052595 = c;
        double r2052596 = r2052595 / r2052591;
        double r2052597 = r2052594 * r2052596;
        double r2052598 = 4.896282005087315e-305;
        bool r2052599 = r2052591 <= r2052598;
        double r2052600 = r2052591 * r2052591;
        double r2052601 = a;
        double r2052602 = r2052601 * r2052595;
        double r2052603 = r2052600 - r2052602;
        double r2052604 = sqrt(r2052603);
        double r2052605 = -r2052591;
        double r2052606 = r2052604 + r2052605;
        double r2052607 = r2052595 / r2052606;
        double r2052608 = 9.373274758933483e+147;
        bool r2052609 = r2052591 <= r2052608;
        double r2052610 = r2052605 - r2052604;
        double r2052611 = r2052610 / r2052601;
        double r2052612 = 0.5;
        double r2052613 = r2052596 * r2052612;
        double r2052614 = r2052591 / r2052601;
        double r2052615 = 2.0;
        double r2052616 = r2052614 * r2052615;
        double r2052617 = r2052613 - r2052616;
        double r2052618 = r2052609 ? r2052611 : r2052617;
        double r2052619 = r2052599 ? r2052607 : r2052618;
        double r2052620 = r2052593 ? r2052597 : r2052619;
        return r2052620;
}

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. 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 inf 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 "NMSE problem 3.2.1"
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))