Average Error: 33.8 → 6.6
Time: 20.7s
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 -4.6218828469248316 \cdot 10^{82}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.3959529492205615 \cdot 10^{-308}:\\ \;\;\;\;\frac{c}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\\ \mathbf{elif}\;b_2 \le 1.2307425160882177 \cdot 10^{80}:\\ \;\;\;\;\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;-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 -4.6218828469248316 \cdot 10^{82}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

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

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

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

\end{array}
double f(double a, double b_2, double c) {
        double r55183 = b_2;
        double r55184 = -r55183;
        double r55185 = r55183 * r55183;
        double r55186 = a;
        double r55187 = c;
        double r55188 = r55186 * r55187;
        double r55189 = r55185 - r55188;
        double r55190 = sqrt(r55189);
        double r55191 = r55184 - r55190;
        double r55192 = r55191 / r55186;
        return r55192;
}

double f(double a, double b_2, double c) {
        double r55193 = b_2;
        double r55194 = -4.6218828469248316e+82;
        bool r55195 = r55193 <= r55194;
        double r55196 = -0.5;
        double r55197 = c;
        double r55198 = r55197 / r55193;
        double r55199 = r55196 * r55198;
        double r55200 = 1.3959529492205615e-308;
        bool r55201 = r55193 <= r55200;
        double r55202 = -r55193;
        double r55203 = r55193 * r55193;
        double r55204 = a;
        double r55205 = r55204 * r55197;
        double r55206 = r55203 - r55205;
        double r55207 = sqrt(r55206);
        double r55208 = r55202 + r55207;
        double r55209 = r55197 / r55208;
        double r55210 = 1.2307425160882177e+80;
        bool r55211 = r55193 <= r55210;
        double r55212 = r55202 - r55207;
        double r55213 = 1.0;
        double r55214 = r55213 / r55204;
        double r55215 = r55212 * r55214;
        double r55216 = -2.0;
        double r55217 = r55193 / r55204;
        double r55218 = r55216 * r55217;
        double r55219 = r55211 ? r55215 : r55218;
        double r55220 = r55201 ? r55209 : r55219;
        double r55221 = r55195 ? r55199 : r55220;
        return r55221;
}

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 < -4.6218828469248316e+82

    1. Initial program 58.2

      \[\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 -4.6218828469248316e+82 < b_2 < 1.3959529492205615e-308

    1. Initial program 30.4

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

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

      \[\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/30.5

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

      \[\leadsto \frac{\color{blue}{\frac{0 + a \cdot c}{a}}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\]
    8. Taylor expanded around 0 9.2

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

    if 1.3959529492205615e-308 < b_2 < 1.2307425160882177e+80

    1. Initial program 8.4

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

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

    if 1.2307425160882177e+80 < b_2

    1. Initial program 44.4

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

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

      \[\leadsto \color{blue}{-2 \cdot \frac{b_2}{a}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification6.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -4.6218828469248316 \cdot 10^{82}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.3959529492205615 \cdot 10^{-308}:\\ \;\;\;\;\frac{c}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\\ \mathbf{elif}\;b_2 \le 1.2307425160882177 \cdot 10^{80}:\\ \;\;\;\;\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array}\]

Reproduce

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