Average Error: 34.0 → 9.5
Time: 17.3s
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.113821654949688919486578053270333252641 \cdot 10^{81}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 9.282718576312558283749529381981667422729 \cdot 10^{-291}:\\ \;\;\;\;\frac{1}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{\frac{a}{\sqrt{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}} \cdot \frac{c}{\sqrt{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}{a}\\ \mathbf{elif}\;b_2 \le 2098867031.934578418731689453125:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{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 -1.113821654949688919486578053270333252641 \cdot 10^{81}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

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

\mathbf{elif}\;b_2 \le 2098867031.934578418731689453125:\\
\;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{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 r71977 = b_2;
        double r71978 = -r71977;
        double r71979 = r71977 * r71977;
        double r71980 = a;
        double r71981 = c;
        double r71982 = r71980 * r71981;
        double r71983 = r71979 - r71982;
        double r71984 = sqrt(r71983);
        double r71985 = r71978 - r71984;
        double r71986 = r71985 / r71980;
        return r71986;
}

double f(double a, double b_2, double c) {
        double r71987 = b_2;
        double r71988 = -1.113821654949689e+81;
        bool r71989 = r71987 <= r71988;
        double r71990 = -0.5;
        double r71991 = c;
        double r71992 = r71991 / r71987;
        double r71993 = r71990 * r71992;
        double r71994 = 9.282718576312558e-291;
        bool r71995 = r71987 <= r71994;
        double r71996 = 1.0;
        double r71997 = r71987 * r71987;
        double r71998 = a;
        double r71999 = r71998 * r71991;
        double r72000 = r71997 - r71999;
        double r72001 = sqrt(r72000);
        double r72002 = r72001 - r71987;
        double r72003 = sqrt(r72002);
        double r72004 = r71996 / r72003;
        double r72005 = sqrt(r72003);
        double r72006 = r71998 / r72005;
        double r72007 = r71991 / r72005;
        double r72008 = r72006 * r72007;
        double r72009 = r72008 / r71998;
        double r72010 = r72004 * r72009;
        double r72011 = 2098867031.9345784;
        bool r72012 = r71987 <= r72011;
        double r72013 = -r71987;
        double r72014 = r72013 - r72001;
        double r72015 = r72014 / r71998;
        double r72016 = 0.5;
        double r72017 = r72016 * r71992;
        double r72018 = 2.0;
        double r72019 = r71987 / r71998;
        double r72020 = r72018 * r72019;
        double r72021 = r72017 - r72020;
        double r72022 = r72012 ? r72015 : r72021;
        double r72023 = r71995 ? r72010 : r72022;
        double r72024 = r71989 ? r71993 : r72023;
        return r72024;
}

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.113821654949689e+81

    1. Initial program 58.1

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

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

    if -1.113821654949689e+81 < b_2 < 9.282718576312558e-291

    1. Initial program 32.3

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

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

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

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

      \[\leadsto \frac{\frac{0 + a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{\color{blue}{1 \cdot a}}\]
    8. Applied add-sqr-sqrt17.6

      \[\leadsto \frac{\frac{0 + a \cdot c}{\color{blue}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}{1 \cdot a}\]
    9. Applied *-un-lft-identity17.6

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

      \[\leadsto \frac{\color{blue}{\frac{1}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{0 + a \cdot c}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}{1 \cdot a}\]
    11. Applied times-frac17.4

      \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{1} \cdot \frac{\frac{0 + a \cdot c}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}}\]
    12. Simplified17.4

      \[\leadsto \color{blue}{\frac{1}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}} \cdot \frac{\frac{0 + a \cdot c}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    13. Simplified17.4

      \[\leadsto \frac{1}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \color{blue}{\frac{\frac{a \cdot c}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}}\]
    14. Using strategy rm
    15. Applied add-sqr-sqrt17.4

      \[\leadsto \frac{1}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{\frac{a \cdot c}{\sqrt{\color{blue}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}}{a}\]
    16. Applied sqrt-prod17.4

      \[\leadsto \frac{1}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{\frac{a \cdot c}{\color{blue}{\sqrt{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \sqrt{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}}{a}\]
    17. Applied times-frac16.0

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

    if 9.282718576312558e-291 < b_2 < 2098867031.9345784

    1. Initial program 10.5

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

    if 2098867031.9345784 < b_2

    1. Initial program 32.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.113821654949688919486578053270333252641 \cdot 10^{81}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 9.282718576312558283749529381981667422729 \cdot 10^{-291}:\\ \;\;\;\;\frac{1}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{\frac{a}{\sqrt{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}} \cdot \frac{c}{\sqrt{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}{a}\\ \mathbf{elif}\;b_2 \le 2098867031.934578418731689453125:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \end{array}\]

Reproduce

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