Average Error: 34.2 → 9.1
Time: 4.2s
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.850740894150185 \cdot 10^{20}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -6.1806208921043762 \cdot 10^{-95}:\\ \;\;\;\;\frac{1 \cdot \left(\left({b_2}^{2} - {b_2}^{2}\right) + a \cdot c\right)}{a} \cdot \frac{1}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\\ \mathbf{elif}\;b_2 \le -2.125553485370055 \cdot 10^{-113}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 6.29361288009581358 \cdot 10^{112}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\\ \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.850740894150185 \cdot 10^{20}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

\mathbf{elif}\;b_2 \le -6.1806208921043762 \cdot 10^{-95}:\\
\;\;\;\;\frac{1 \cdot \left(\left({b_2}^{2} - {b_2}^{2}\right) + a \cdot c\right)}{a} \cdot \frac{1}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\\

\mathbf{elif}\;b_2 \le -2.125553485370055 \cdot 10^{-113}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

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

\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 r79214 = b_2;
        double r79215 = -r79214;
        double r79216 = r79214 * r79214;
        double r79217 = a;
        double r79218 = c;
        double r79219 = r79217 * r79218;
        double r79220 = r79216 - r79219;
        double r79221 = sqrt(r79220);
        double r79222 = r79215 - r79221;
        double r79223 = r79222 / r79217;
        return r79223;
}

double f(double a, double b_2, double c) {
        double r79224 = b_2;
        double r79225 = -1.8507408941501855e+20;
        bool r79226 = r79224 <= r79225;
        double r79227 = -0.5;
        double r79228 = c;
        double r79229 = r79228 / r79224;
        double r79230 = r79227 * r79229;
        double r79231 = -6.180620892104376e-95;
        bool r79232 = r79224 <= r79231;
        double r79233 = 1.0;
        double r79234 = 2.0;
        double r79235 = pow(r79224, r79234);
        double r79236 = r79235 - r79235;
        double r79237 = a;
        double r79238 = r79237 * r79228;
        double r79239 = r79236 + r79238;
        double r79240 = r79233 * r79239;
        double r79241 = r79240 / r79237;
        double r79242 = -r79224;
        double r79243 = r79224 * r79224;
        double r79244 = r79243 - r79238;
        double r79245 = sqrt(r79244);
        double r79246 = r79242 + r79245;
        double r79247 = r79233 / r79246;
        double r79248 = r79241 * r79247;
        double r79249 = -2.125553485370055e-113;
        bool r79250 = r79224 <= r79249;
        double r79251 = 6.293612880095814e+112;
        bool r79252 = r79224 <= r79251;
        double r79253 = r79242 - r79245;
        double r79254 = r79237 / r79253;
        double r79255 = r79233 / r79254;
        double r79256 = 0.5;
        double r79257 = r79256 * r79229;
        double r79258 = r79224 / r79237;
        double r79259 = r79234 * r79258;
        double r79260 = r79257 - r79259;
        double r79261 = r79252 ? r79255 : r79260;
        double r79262 = r79250 ? r79230 : r79261;
        double r79263 = r79232 ? r79248 : r79262;
        double r79264 = r79226 ? r79230 : r79263;
        return r79264;
}

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.8507408941501855e+20 or -6.180620892104376e-95 < b_2 < -2.125553485370055e-113

    1. Initial program 54.9

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

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

    if -1.8507408941501855e+20 < b_2 < -6.180620892104376e-95

    1. Initial program 39.2

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    4. Using strategy rm
    5. Applied flip--39.2

      \[\leadsto \frac{1}{\frac{a}{\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}}}}}\]
    6. Applied associate-/r/39.3

      \[\leadsto \frac{1}{\color{blue}{\frac{a}{\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}} \cdot \left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}\]
    7. Applied add-cube-cbrt39.3

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\frac{a}{\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}} \cdot \left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}\]
    8. Applied times-frac39.3

      \[\leadsto \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{a}{\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}}} \cdot \frac{\sqrt[3]{1}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}\]
    9. Simplified14.4

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

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

    if -2.125553485370055e-113 < b_2 < 6.293612880095814e+112

    1. Initial program 12.1

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

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

    if 6.293612880095814e+112 < b_2

    1. Initial program 49.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.850740894150185 \cdot 10^{20}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -6.1806208921043762 \cdot 10^{-95}:\\ \;\;\;\;\frac{1 \cdot \left(\left({b_2}^{2} - {b_2}^{2}\right) + a \cdot c\right)}{a} \cdot \frac{1}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\\ \mathbf{elif}\;b_2 \le -2.125553485370055 \cdot 10^{-113}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 6.29361288009581358 \cdot 10^{112}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \end{array}\]

Reproduce

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