Average Error: 33.8 → 6.7
Time: 5.1s
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 -7.056049990712678229532198273137964505309 \cdot 10^{135}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 3.354512113027852840575758390208390140042 \cdot 10^{-290}:\\ \;\;\;\;1 \cdot \frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\ \mathbf{elif}\;b_2 \le 1.027121119632677421337828778787522289731 \cdot 10^{53}:\\ \;\;\;\;\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 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 -7.056049990712678229532198273137964505309 \cdot 10^{135}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

\mathbf{elif}\;b_2 \le 3.354512113027852840575758390208390140042 \cdot 10^{-290}:\\
\;\;\;\;1 \cdot \frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\

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

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

\end{array}
double f(double a, double b_2, double c) {
        double r100563 = b_2;
        double r100564 = -r100563;
        double r100565 = r100563 * r100563;
        double r100566 = a;
        double r100567 = c;
        double r100568 = r100566 * r100567;
        double r100569 = r100565 - r100568;
        double r100570 = sqrt(r100569);
        double r100571 = r100564 - r100570;
        double r100572 = r100571 / r100566;
        return r100572;
}

double f(double a, double b_2, double c) {
        double r100573 = b_2;
        double r100574 = -7.056049990712678e+135;
        bool r100575 = r100573 <= r100574;
        double r100576 = -0.5;
        double r100577 = c;
        double r100578 = r100577 / r100573;
        double r100579 = r100576 * r100578;
        double r100580 = 3.354512113027853e-290;
        bool r100581 = r100573 <= r100580;
        double r100582 = 1.0;
        double r100583 = r100573 * r100573;
        double r100584 = a;
        double r100585 = r100584 * r100577;
        double r100586 = r100583 - r100585;
        double r100587 = sqrt(r100586);
        double r100588 = r100587 - r100573;
        double r100589 = r100577 / r100588;
        double r100590 = r100582 * r100589;
        double r100591 = 1.0271211196326774e+53;
        bool r100592 = r100573 <= r100591;
        double r100593 = -r100573;
        double r100594 = r100593 - r100587;
        double r100595 = r100582 / r100584;
        double r100596 = r100594 * r100595;
        double r100597 = 0.5;
        double r100598 = r100597 * r100578;
        double r100599 = 2.0;
        double r100600 = r100573 / r100584;
        double r100601 = r100599 * r100600;
        double r100602 = r100598 - r100601;
        double r100603 = r100592 ? r100596 : r100602;
        double r100604 = r100581 ? r100590 : r100603;
        double r100605 = r100575 ? r100579 : r100604;
        return r100605;
}

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 < -7.056049990712678e+135

    1. Initial program 61.8

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

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

    if -7.056049990712678e+135 < b_2 < 3.354512113027853e-290

    1. Initial program 34.2

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

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

      \[\leadsto \frac{\frac{0 + 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-identity16.3

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

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

      \[\leadsto \frac{\color{blue}{\frac{1}{1} \cdot \frac{0 + a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    10. Simplified16.3

      \[\leadsto \frac{\color{blue}{1} \cdot \frac{0 + a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a}\]
    11. Simplified14.7

      \[\leadsto \frac{1 \cdot \color{blue}{\frac{a}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}}{a}\]
    12. Using strategy rm
    13. Applied clear-num14.7

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{1 \cdot \frac{a}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}}}\]
    14. Simplified9.3

      \[\leadsto \frac{1}{\color{blue}{\frac{1 \cdot \left(\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2\right)}{c}}}\]
    15. Using strategy rm
    16. Applied *-un-lft-identity9.3

      \[\leadsto \frac{1}{\frac{1 \cdot \left(\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2\right)}{\color{blue}{1 \cdot c}}}\]
    17. Applied times-frac9.3

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{1} \cdot \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}\]
    18. Applied add-cube-cbrt9.3

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\frac{1}{1} \cdot \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}\]
    19. Applied times-frac9.3

      \[\leadsto \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{1}{1}} \cdot \frac{\sqrt[3]{1}}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}\]
    20. Simplified9.3

      \[\leadsto \color{blue}{1} \cdot \frac{\sqrt[3]{1}}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}\]
    21. Simplified8.8

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

    if 3.354512113027853e-290 < b_2 < 1.0271211196326774e+53

    1. Initial program 8.3

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

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

    if 1.0271211196326774e+53 < b_2

    1. Initial program 38.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -7.056049990712678229532198273137964505309 \cdot 10^{135}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 3.354512113027852840575758390208390140042 \cdot 10^{-290}:\\ \;\;\;\;1 \cdot \frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\ \mathbf{elif}\;b_2 \le 1.027121119632677421337828778787522289731 \cdot 10^{53}:\\ \;\;\;\;\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \end{array}\]

Reproduce

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