Average Error: 6.6 → 6.6
Time: 14.4s
Precision: 64
$\frac{\left(-b\right) - \sqrt{{b}^{2} - 4 \cdot ac}}{2 \cdot a}$
$\begin{array}{l} \mathbf{if}\;b = -\infty:\\ \;\;\;\;\frac{-2 \cdot \frac{ac}{b}}{2 \cdot a}\\ \mathbf{elif}\;b \le +\infty:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{{b}^{2} - 4 \cdot ac}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot \frac{ac}{b} - 2 \cdot b}{2 \cdot a}\\ \end{array}$
\frac{\left(-b\right) - \sqrt{{b}^{2} - 4 \cdot ac}}{2 \cdot a}
\begin{array}{l}
\mathbf{if}\;b = -\infty:\\
\;\;\;\;\frac{-2 \cdot \frac{ac}{b}}{2 \cdot a}\\

\mathbf{elif}\;b \le +\infty:\\
\;\;\;\;\frac{\left(-b\right) - \sqrt{{b}^{2} - 4 \cdot ac}}{2 \cdot a}\\

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

\end{array}
double f(double b, double ac, double a) {
double r3557424 = b;
double r3557425 = -r3557424;
double r3557426 = 2.0;
double r3557427 = pow(r3557424, r3557426);
double r3557428 = 4.0;
double r3557429 = ac;
double r3557430 = r3557428 * r3557429;
double r3557431 = r3557427 - r3557430;
double r3557432 = sqrt(r3557431);
double r3557433 = r3557425 - r3557432;
double r3557434 = a;
double r3557435 = r3557426 * r3557434;
double r3557436 = r3557433 / r3557435;
return r3557436;
}


double f(double b, double ac, double a) {
double r3557437 = b;
double r3557438 = -inf.0;
bool r3557439 = r3557437 <= r3557438;
double r3557440 = -2.0;
double r3557441 = ac;
double r3557442 = r3557441 / r3557437;
double r3557443 = r3557440 * r3557442;
double r3557444 = 2.0;
double r3557445 = a;
double r3557446 = r3557444 * r3557445;
double r3557447 = r3557443 / r3557446;
double r3557448 = +inf.0;
bool r3557449 = r3557437 <= r3557448;
double r3557450 = -r3557437;
double r3557451 = pow(r3557437, r3557444);
double r3557452 = 4.0;
double r3557453 = r3557452 * r3557441;
double r3557454 = r3557451 - r3557453;
double r3557455 = sqrt(r3557454);
double r3557456 = r3557450 - r3557455;
double r3557457 = r3557456 / r3557446;
double r3557458 = r3557444 * r3557442;
double r3557459 = 2.0;
double r3557460 = r3557459 * r3557437;
double r3557461 = r3557458 - r3557460;
double r3557462 = r3557461 / r3557446;
double r3557463 = r3557449 ? r3557457 : r3557462;
double r3557464 = r3557439 ? r3557447 : r3557463;
return r3557464;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

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

1. Initial program 6.6

$\frac{\left(-b\right) - \sqrt{{b}^{2} - 4 \cdot ac}}{2 \cdot a}$
2. Taylor expanded around -inf 15.7

$\leadsto \frac{\color{blue}{-2 \cdot \frac{ac}{b}}}{2 \cdot a}$

## if -inf.0 < b < +inf.0

1. Initial program 6.6

$\frac{\left(-b\right) - \sqrt{{b}^{2} - 4 \cdot ac}}{2 \cdot a}$

## if +inf.0 < b

1. Initial program 6.6

$\frac{\left(-b\right) - \sqrt{{b}^{2} - 4 \cdot ac}}{2 \cdot a}$
2. Taylor expanded around inf 21.3

$\leadsto \frac{\color{blue}{2 \cdot \frac{ac}{b} - 2 \cdot b}}{2 \cdot a}$
3. Recombined 3 regimes into one program.
4. Final simplification6.6

$\leadsto \begin{array}{l} \mathbf{if}\;b = -\infty:\\ \;\;\;\;\frac{-2 \cdot \frac{ac}{b}}{2 \cdot a}\\ \mathbf{elif}\;b \le +\infty:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{{b}^{2} - 4 \cdot ac}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot \frac{ac}{b} - 2 \cdot b}{2 \cdot a}\\ \end{array}$

# Reproduce

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