Average Error: 26.5 → 4.6
Time: 16.0s
Precision: 64
$\frac{\left(-b\right) + \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}{2} \cdot a$
$\begin{array}{l} \mathbf{if}\;b \le -1.348495931813199651380956550510723066785 \cdot 10^{154}:\\ \;\;\;\;-1 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;b \le 578925038994981359076265559618224128:\\ \;\;\;\;a \cdot \frac{\left(-b\right) + \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}{2}\\ \mathbf{else}:\\ \;\;\;\;a \cdot \frac{-2 \cdot \frac{a \cdot c}{b}}{2}\\ \end{array}$
\frac{\left(-b\right) + \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}{2} \cdot a
\begin{array}{l}
\mathbf{if}\;b \le -1.348495931813199651380956550510723066785 \cdot 10^{154}:\\
\;\;\;\;-1 \cdot \left(a \cdot b\right)\\

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

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

\end{array}
double f(double b, double a, double c) {
double r2141386 = b;
double r2141387 = -r2141386;
double r2141388 = 2.0;
double r2141389 = pow(r2141386, r2141388);
double r2141390 = 4.0;
double r2141391 = a;
double r2141392 = r2141390 * r2141391;
double r2141393 = c;
double r2141394 = r2141392 * r2141393;
double r2141395 = r2141389 - r2141394;
double r2141396 = sqrt(r2141395);
double r2141397 = r2141387 + r2141396;
double r2141398 = r2141397 / r2141388;
double r2141399 = r2141398 * r2141391;
return r2141399;
}


double f(double b, double a, double c) {
double r2141400 = b;
double r2141401 = -1.3484959318131997e+154;
bool r2141402 = r2141400 <= r2141401;
double r2141403 = -1.0;
double r2141404 = a;
double r2141405 = r2141404 * r2141400;
double r2141406 = r2141403 * r2141405;
double r2141407 = 5.7892503899498136e+35;
bool r2141408 = r2141400 <= r2141407;
double r2141409 = -r2141400;
double r2141410 = 2.0;
double r2141411 = pow(r2141400, r2141410);
double r2141412 = 4.0;
double r2141413 = r2141412 * r2141404;
double r2141414 = c;
double r2141415 = r2141413 * r2141414;
double r2141416 = r2141411 - r2141415;
double r2141417 = sqrt(r2141416);
double r2141418 = r2141409 + r2141417;
double r2141419 = r2141418 / r2141410;
double r2141420 = r2141404 * r2141419;
double r2141421 = -2.0;
double r2141422 = r2141404 * r2141414;
double r2141423 = r2141422 / r2141400;
double r2141424 = r2141421 * r2141423;
double r2141425 = r2141424 / r2141410;
double r2141426 = r2141404 * r2141425;
double r2141427 = r2141408 ? r2141420 : r2141426;
double r2141428 = r2141402 ? r2141406 : r2141427;
return r2141428;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 3 regimes
2. ## if b < -1.3484959318131997e+154

1. Initial program 64.0

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

$\leadsto \color{blue}{-1 \cdot \left(a \cdot b\right)}$

## if -1.3484959318131997e+154 < b < 5.7892503899498136e+35

1. Initial program 5.2

$\frac{\left(-b\right) + \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}{2} \cdot a$
2. Using strategy rm
3. Applied *-commutative5.2

$\leadsto \color{blue}{a \cdot \frac{\left(-b\right) + \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}{2}}$

## if 5.7892503899498136e+35 < b

1. Initial program 51.6

$\frac{\left(-b\right) + \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}{2} \cdot a$
2. Using strategy rm
3. Applied *-commutative51.6

$\leadsto \color{blue}{a \cdot \frac{\left(-b\right) + \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}{2}}$
4. Taylor expanded around inf 5.3

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

$\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.348495931813199651380956550510723066785 \cdot 10^{154}:\\ \;\;\;\;-1 \cdot \left(a \cdot b\right)\\ \mathbf{elif}\;b \le 578925038994981359076265559618224128:\\ \;\;\;\;a \cdot \frac{\left(-b\right) + \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}{2}\\ \mathbf{else}:\\ \;\;\;\;a \cdot \frac{-2 \cdot \frac{a \cdot c}{b}}{2}\\ \end{array}$

# Reproduce

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