Average Error: 22.5 → 6.2
Time: 13.7s
Precision: 64
\[\left(-b\right) - \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;b \le -1.263957410932142930577645558732519398508 \cdot 10^{93}:\\ \;\;\;\;\left(-b\right) - \left(\frac{c}{b} \cdot 1 - 0.5 \cdot \frac{b}{a}\right)\\ \mathbf{elif}\;b \le 7.619762050606626877978744794716853910068 \cdot 10^{-19}:\\ \;\;\;\;\left(-b\right) - \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\left(-b\right) - 0.5 \cdot \frac{b}{a}\\ \end{array}\]
\left(-b\right) - \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\begin{array}{l}
\mathbf{if}\;b \le -1.263957410932142930577645558732519398508 \cdot 10^{93}:\\
\;\;\;\;\left(-b\right) - \left(\frac{c}{b} \cdot 1 - 0.5 \cdot \frac{b}{a}\right)\\

\mathbf{elif}\;b \le 7.619762050606626877978744794716853910068 \cdot 10^{-19}:\\
\;\;\;\;\left(-b\right) - \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\

\mathbf{else}:\\
\;\;\;\;\left(-b\right) - 0.5 \cdot \frac{b}{a}\\

\end{array}
double f(double b, double a, double c) {
        double r27756166 = b;
        double r27756167 = -r27756166;
        double r27756168 = r27756166 * r27756166;
        double r27756169 = 4.0;
        double r27756170 = a;
        double r27756171 = r27756169 * r27756170;
        double r27756172 = c;
        double r27756173 = r27756171 * r27756172;
        double r27756174 = r27756168 - r27756173;
        double r27756175 = sqrt(r27756174);
        double r27756176 = 2.0;
        double r27756177 = r27756176 * r27756170;
        double r27756178 = r27756175 / r27756177;
        double r27756179 = r27756167 - r27756178;
        return r27756179;
}

double f(double b, double a, double c) {
        double r27756180 = b;
        double r27756181 = -1.263957410932143e+93;
        bool r27756182 = r27756180 <= r27756181;
        double r27756183 = -r27756180;
        double r27756184 = c;
        double r27756185 = r27756184 / r27756180;
        double r27756186 = 1.0;
        double r27756187 = r27756185 * r27756186;
        double r27756188 = 0.5;
        double r27756189 = a;
        double r27756190 = r27756180 / r27756189;
        double r27756191 = r27756188 * r27756190;
        double r27756192 = r27756187 - r27756191;
        double r27756193 = r27756183 - r27756192;
        double r27756194 = 7.619762050606627e-19;
        bool r27756195 = r27756180 <= r27756194;
        double r27756196 = r27756180 * r27756180;
        double r27756197 = 4.0;
        double r27756198 = r27756197 * r27756189;
        double r27756199 = r27756198 * r27756184;
        double r27756200 = r27756196 - r27756199;
        double r27756201 = sqrt(r27756200);
        double r27756202 = 2.0;
        double r27756203 = r27756202 * r27756189;
        double r27756204 = r27756201 / r27756203;
        double r27756205 = r27756183 - r27756204;
        double r27756206 = r27756183 - r27756191;
        double r27756207 = r27756195 ? r27756205 : r27756206;
        double r27756208 = r27756182 ? r27756193 : r27756207;
        return r27756208;
}

Error

Bits error versus b

Bits error versus a

Bits error versus c

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if b < -1.263957410932143e+93

    1. Initial program 45.8

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

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

    if -1.263957410932143e+93 < b < 7.619762050606627e-19

    1. Initial program 10.1

      \[\left(-b\right) - \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]

    if 7.619762050606627e-19 < b

    1. Initial program 30.9

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

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

      \[\leadsto \left(-b\right) - \color{blue}{0.5 \cdot \frac{b}{a}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification6.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.263957410932142930577645558732519398508 \cdot 10^{93}:\\ \;\;\;\;\left(-b\right) - \left(\frac{c}{b} \cdot 1 - 0.5 \cdot \frac{b}{a}\right)\\ \mathbf{elif}\;b \le 7.619762050606626877978744794716853910068 \cdot 10^{-19}:\\ \;\;\;\;\left(-b\right) - \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\left(-b\right) - 0.5 \cdot \frac{b}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 1 
(FPCore (b a c)
  :name "-b - sqrt(b*b-4*a*c)/(2*a)"
  (- (- b) (/ (sqrt (- (* b b) (* (* 4.0 a) c))) (* 2.0 a))))