Average Error: 9.3 → 9.3
Time: 17.1s
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 = -\infty:\\ \;\;\;\;\frac{-2 \cdot \frac{a \cdot c}{b}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{{b}^{2} - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\\ \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 = -\infty:\\
\;\;\;\;\frac{-2 \cdot \frac{a \cdot c}{b}}{2 \cdot a}\\

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

\end{array}
double f(double b, double a, double c) {
double r564282 = b;
double r564283 = -r564282;
double r564284 = 2.0;
double r564285 = pow(r564282, r564284);
double r564286 = 4.0;
double r564287 = a;
double r564288 = r564286 * r564287;
double r564289 = c;
double r564290 = r564288 * r564289;
double r564291 = r564285 - r564290;
double r564292 = sqrt(r564291);
double r564293 = r564283 - r564292;
double r564294 = r564284 * r564287;
double r564295 = r564293 / r564294;
return r564295;
}


double f(double b, double a, double c) {
double r564296 = b;
double r564297 = -inf.0;
bool r564298 = r564296 <= r564297;
double r564299 = -2.0;
double r564300 = a;
double r564301 = c;
double r564302 = r564300 * r564301;
double r564303 = r564302 / r564296;
double r564304 = r564299 * r564303;
double r564305 = 2.0;
double r564306 = r564305 * r564300;
double r564307 = r564304 / r564306;
double r564308 = -r564296;
double r564309 = 2.0;
double r564310 = pow(r564296, r564309);
double r564311 = 4.0;
double r564312 = r564311 * r564302;
double r564313 = r564310 - r564312;
double r564314 = sqrt(r564313);
double r564315 = r564308 - r564314;
double r564316 = r564315 / r564306;
double r564317 = r564298 ? r564307 : r564316;
return r564317;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

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

1. Initial program 9.3

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

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

## if -inf.0 < b

1. Initial program 9.3

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

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

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

# Reproduce

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