Average Error: 34.1 → 10.3
Time: 17.4s
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 -9.302418871660927115114698152097651540243 \cdot 10^{-50}:\\ \;\;\;\;-1 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \le 54242272278658947690605899716285359884080000:\\ \;\;\;\;\left(\left(-b\right) - \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}\right) \cdot \frac{1}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(\frac{c}{b} - \frac{b}{a}\right)\\ \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 -9.302418871660927115114698152097651540243 \cdot 10^{-50}:\\
\;\;\;\;-1 \cdot \frac{c}{b}\\

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

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

\end{array}
double f(double b, double a, double c) {
double r585614 = b;
double r585615 = -r585614;
double r585616 = 2.0;
double r585617 = pow(r585614, r585616);
double r585618 = 4.0;
double r585619 = a;
double r585620 = r585618 * r585619;
double r585621 = c;
double r585622 = r585620 * r585621;
double r585623 = r585617 - r585622;
double r585624 = sqrt(r585623);
double r585625 = r585615 - r585624;
double r585626 = r585616 * r585619;
double r585627 = r585625 / r585626;
return r585627;
}


double f(double b, double a, double c) {
double r585628 = b;
double r585629 = -9.302418871660927e-50;
bool r585630 = r585628 <= r585629;
double r585631 = -1.0;
double r585632 = c;
double r585633 = r585632 / r585628;
double r585634 = r585631 * r585633;
double r585635 = 5.424227227865895e+43;
bool r585636 = r585628 <= r585635;
double r585637 = -r585628;
double r585638 = 2.0;
double r585639 = pow(r585628, r585638);
double r585640 = 4.0;
double r585641 = a;
double r585642 = r585640 * r585641;
double r585643 = r585642 * r585632;
double r585644 = r585639 - r585643;
double r585645 = sqrt(r585644);
double r585646 = r585637 - r585645;
double r585647 = 1.0;
double r585648 = r585638 * r585641;
double r585649 = r585647 / r585648;
double r585650 = r585646 * r585649;
double r585651 = 1.0;
double r585652 = r585628 / r585641;
double r585653 = r585633 - r585652;
double r585654 = r585651 * r585653;
double r585655 = r585636 ? r585650 : r585654;
double r585656 = r585630 ? r585634 : r585655;
return r585656;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 3 regimes
2. ## if b < -9.302418871660927e-50

1. Initial program 53.9

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

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

## if -9.302418871660927e-50 < b < 5.424227227865895e+43

1. Initial program 14.8

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

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

## if 5.424227227865895e+43 < b

1. Initial program 37.2

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

$\leadsto \color{blue}{1 \cdot \frac{c}{b} - 1 \cdot \frac{b}{a}}$
3. Simplified6.2

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

$\leadsto \begin{array}{l} \mathbf{if}\;b \le -9.302418871660927115114698152097651540243 \cdot 10^{-50}:\\ \;\;\;\;-1 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \le 54242272278658947690605899716285359884080000:\\ \;\;\;\;\left(\left(-b\right) - \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}\right) \cdot \frac{1}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(\frac{c}{b} - \frac{b}{a}\right)\\ \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)))