Average Error: 33.6 → 6.6
Time: 23.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 -3.5014200692921863 \cdot 10^{+151}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -1.6508238928289048 \cdot 10^{-192}:\\ \;\;\;\;\frac{1}{\left(\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2\right) \cdot \frac{1}{c}}\\ \mathbf{elif}\;b_2 \le 2.0930248844306297 \cdot 10^{+100}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-2, \frac{b_2}{a}, \frac{\frac{1}{2}}{\frac{b_2}{c}}\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 -3.5014200692921863 \cdot 10^{+151}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-2, \frac{b_2}{a}, \frac{\frac{1}{2}}{\frac{b_2}{c}}\right)\\

\end{array}
double f(double a, double b_2, double c) {
        double r1972489 = b_2;
        double r1972490 = -r1972489;
        double r1972491 = r1972489 * r1972489;
        double r1972492 = a;
        double r1972493 = c;
        double r1972494 = r1972492 * r1972493;
        double r1972495 = r1972491 - r1972494;
        double r1972496 = sqrt(r1972495);
        double r1972497 = r1972490 - r1972496;
        double r1972498 = r1972497 / r1972492;
        return r1972498;
}

double f(double a, double b_2, double c) {
        double r1972499 = b_2;
        double r1972500 = -3.5014200692921863e+151;
        bool r1972501 = r1972499 <= r1972500;
        double r1972502 = -0.5;
        double r1972503 = c;
        double r1972504 = r1972503 / r1972499;
        double r1972505 = r1972502 * r1972504;
        double r1972506 = -1.6508238928289048e-192;
        bool r1972507 = r1972499 <= r1972506;
        double r1972508 = 1.0;
        double r1972509 = r1972499 * r1972499;
        double r1972510 = a;
        double r1972511 = r1972510 * r1972503;
        double r1972512 = r1972509 - r1972511;
        double r1972513 = sqrt(r1972512);
        double r1972514 = r1972513 - r1972499;
        double r1972515 = r1972508 / r1972503;
        double r1972516 = r1972514 * r1972515;
        double r1972517 = r1972508 / r1972516;
        double r1972518 = 2.0930248844306297e+100;
        bool r1972519 = r1972499 <= r1972518;
        double r1972520 = -r1972499;
        double r1972521 = r1972520 - r1972513;
        double r1972522 = r1972521 / r1972510;
        double r1972523 = -2.0;
        double r1972524 = r1972499 / r1972510;
        double r1972525 = 0.5;
        double r1972526 = r1972499 / r1972503;
        double r1972527 = r1972525 / r1972526;
        double r1972528 = fma(r1972523, r1972524, r1972527);
        double r1972529 = r1972519 ? r1972522 : r1972528;
        double r1972530 = r1972507 ? r1972517 : r1972529;
        double r1972531 = r1972501 ? r1972505 : r1972530;
        return r1972531;
}

Error

Bits error versus a

Bits error versus b_2

Bits error versus c

Derivation

  1. Split input into 4 regimes
  2. if b_2 < -3.5014200692921863e+151

    1. Initial program 62.5

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

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

    if -3.5014200692921863e+151 < b_2 < -1.6508238928289048e-192

    1. Initial program 39.1

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

      \[\leadsto \frac{\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}}}}{a}\]
    4. Simplified15.1

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

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

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

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

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

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

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

    if -1.6508238928289048e-192 < b_2 < 2.0930248844306297e+100

    1. Initial program 10.5

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

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

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

    if 2.0930248844306297e+100 < b_2

    1. Initial program 44.2

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

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

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

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}}\]
    5. Simplified3.4

      \[\leadsto \color{blue}{\mathsf{fma}\left(-2, \frac{b_2}{a}, \frac{\frac{1}{2}}{\frac{b_2}{c}}\right)}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification6.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -3.5014200692921863 \cdot 10^{+151}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -1.6508238928289048 \cdot 10^{-192}:\\ \;\;\;\;\frac{1}{\left(\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2\right) \cdot \frac{1}{c}}\\ \mathbf{elif}\;b_2 \le 2.0930248844306297 \cdot 10^{+100}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-2, \frac{b_2}{a}, \frac{\frac{1}{2}}{\frac{b_2}{c}}\right)\\ \end{array}\]

Reproduce

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