Average Error: 33.2 → 6.9
Time: 17.6s
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 -2.6063173736106266 \cdot 10^{+63}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -6.590101287064612 \cdot 10^{-255}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)}\\ \mathbf{elif}\;b_2 \le 5.646875521171257 \cdot 10^{+50}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b_2} \cdot \frac{1}{2} - \frac{b_2}{a} \cdot 2\\ \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 -2.6063173736106266 \cdot 10^{+63}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

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

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

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

\end{array}
double f(double a, double b_2, double c) {
        double r1454116 = b_2;
        double r1454117 = -r1454116;
        double r1454118 = r1454116 * r1454116;
        double r1454119 = a;
        double r1454120 = c;
        double r1454121 = r1454119 * r1454120;
        double r1454122 = r1454118 - r1454121;
        double r1454123 = sqrt(r1454122);
        double r1454124 = r1454117 - r1454123;
        double r1454125 = r1454124 / r1454119;
        return r1454125;
}

double f(double a, double b_2, double c) {
        double r1454126 = b_2;
        double r1454127 = -2.6063173736106266e+63;
        bool r1454128 = r1454126 <= r1454127;
        double r1454129 = -0.5;
        double r1454130 = c;
        double r1454131 = r1454130 / r1454126;
        double r1454132 = r1454129 * r1454131;
        double r1454133 = -6.590101287064612e-255;
        bool r1454134 = r1454126 <= r1454133;
        double r1454135 = r1454126 * r1454126;
        double r1454136 = a;
        double r1454137 = r1454136 * r1454130;
        double r1454138 = r1454135 - r1454137;
        double r1454139 = sqrt(r1454138);
        double r1454140 = -r1454126;
        double r1454141 = r1454139 + r1454140;
        double r1454142 = r1454130 / r1454141;
        double r1454143 = 5.646875521171257e+50;
        bool r1454144 = r1454126 <= r1454143;
        double r1454145 = r1454140 - r1454139;
        double r1454146 = r1454145 / r1454136;
        double r1454147 = 0.5;
        double r1454148 = r1454131 * r1454147;
        double r1454149 = r1454126 / r1454136;
        double r1454150 = 2.0;
        double r1454151 = r1454149 * r1454150;
        double r1454152 = r1454148 - r1454151;
        double r1454153 = r1454144 ? r1454146 : r1454152;
        double r1454154 = r1454134 ? r1454142 : r1454153;
        double r1454155 = r1454128 ? r1454132 : r1454154;
        return r1454155;
}

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 < -2.6063173736106266e+63

    1. Initial program 57.2

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

      \[\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 associate-*r/57.2

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

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

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

    if -2.6063173736106266e+63 < b_2 < -6.590101287064612e-255

    1. Initial program 31.5

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

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

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

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

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

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

    if -6.590101287064612e-255 < b_2 < 5.646875521171257e+50

    1. Initial program 9.9

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

      \[\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 associate-*r/9.9

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

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

    if 5.646875521171257e+50 < b_2

    1. Initial program 36.4

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -2.6063173736106266 \cdot 10^{+63}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -6.590101287064612 \cdot 10^{-255}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)}\\ \mathbf{elif}\;b_2 \le 5.646875521171257 \cdot 10^{+50}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b_2} \cdot \frac{1}{2} - \frac{b_2}{a} \cdot 2\\ \end{array}\]

Reproduce

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