Average Error: 9.2 → 9.2
Time: 17.7s
Precision: 64
\[\frac{1}{2 \cdot a} \cdot \left(\left(-b\right) - \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}\right)\]
\[\begin{array}{l} \mathbf{if}\;b = -\infty:\\ \;\;\;\;\frac{1}{2 \cdot a} \cdot \left(-2 \cdot \frac{a \cdot c}{b}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2 \cdot a} \cdot \left(\left(-b\right) - \sqrt{{b}^{2} - \left(a \cdot c\right) \cdot 4}\right)\\ \end{array}\]
\frac{1}{2 \cdot a} \cdot \left(\left(-b\right) - \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}\right)
\begin{array}{l}
\mathbf{if}\;b = -\infty:\\
\;\;\;\;\frac{1}{2 \cdot a} \cdot \left(-2 \cdot \frac{a \cdot c}{b}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{2 \cdot a} \cdot \left(\left(-b\right) - \sqrt{{b}^{2} - \left(a \cdot c\right) \cdot 4}\right)\\

\end{array}
double f(double a, double b, double c) {
        double r612347 = 1.0;
        double r612348 = 2.0;
        double r612349 = a;
        double r612350 = r612348 * r612349;
        double r612351 = r612347 / r612350;
        double r612352 = b;
        double r612353 = -r612352;
        double r612354 = pow(r612352, r612348);
        double r612355 = 4.0;
        double r612356 = r612355 * r612349;
        double r612357 = c;
        double r612358 = r612356 * r612357;
        double r612359 = r612354 - r612358;
        double r612360 = sqrt(r612359);
        double r612361 = r612353 - r612360;
        double r612362 = r612351 * r612361;
        return r612362;
}

double f(double a, double b, double c) {
        double r612363 = b;
        double r612364 = -inf.0;
        bool r612365 = r612363 <= r612364;
        double r612366 = 1.0;
        double r612367 = 2.0;
        double r612368 = a;
        double r612369 = r612367 * r612368;
        double r612370 = r612366 / r612369;
        double r612371 = -2.0;
        double r612372 = c;
        double r612373 = r612368 * r612372;
        double r612374 = r612373 / r612363;
        double r612375 = r612371 * r612374;
        double r612376 = r612370 * r612375;
        double r612377 = -r612363;
        double r612378 = pow(r612363, r612367);
        double r612379 = 4.0;
        double r612380 = r612373 * r612379;
        double r612381 = r612378 - r612380;
        double r612382 = sqrt(r612381);
        double r612383 = r612377 - r612382;
        double r612384 = r612370 * r612383;
        double r612385 = r612365 ? r612376 : r612384;
        return r612385;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if b < -inf.0

    1. Initial program 9.2

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

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

    if -inf.0 < b

    1. Initial program 9.2

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

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

      \[\leadsto \frac{1}{2 \cdot a} \cdot \left(\left(-b\right) - \sqrt{{b}^{2} - \color{blue}{\left(a \cdot c\right) \cdot 4}}\right)\]
  3. Recombined 2 regimes into one program.
  4. Final simplification9.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;b = -\infty:\\ \;\;\;\;\frac{1}{2 \cdot a} \cdot \left(-2 \cdot \frac{a \cdot c}{b}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2 \cdot a} \cdot \left(\left(-b\right) - \sqrt{{b}^{2} - \left(a \cdot c\right) \cdot 4}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 1 
(FPCore (a b c)
  :name "1/(2*a)*(-b-sqrt(b^2-4*a*c))"
  :precision binary32
  (* (/ 1 (* 2 a)) (- (- b) (sqrt (- (pow b 2) (* (* 4 a) c))))))