Average Error: 33.5 → 9.8
Time: 20.7s
Precision: 64
$\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}$
$\begin{array}{l} \mathbf{if}\;b \le -2.9400015506354064 \cdot 10^{+93}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \le 2.5928684081554055 \cdot 10^{-64}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;-\frac{c}{b}\\ \end{array}$
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\begin{array}{l}
\mathbf{if}\;b \le -2.9400015506354064 \cdot 10^{+93}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\

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

\mathbf{else}:\\
\;\;\;\;-\frac{c}{b}\\

\end{array}
double f(double b, double a, double c) {
double r41373707 = b;
double r41373708 = -r41373707;
double r41373709 = r41373707 * r41373707;
double r41373710 = 4.0;
double r41373711 = a;
double r41373712 = r41373710 * r41373711;
double r41373713 = c;
double r41373714 = r41373712 * r41373713;
double r41373715 = r41373709 - r41373714;
double r41373716 = sqrt(r41373715);
double r41373717 = r41373708 + r41373716;
double r41373718 = 2.0;
double r41373719 = r41373718 * r41373711;
double r41373720 = r41373717 / r41373719;
return r41373720;
}


double f(double b, double a, double c) {
double r41373721 = b;
double r41373722 = -2.9400015506354064e+93;
bool r41373723 = r41373721 <= r41373722;
double r41373724 = c;
double r41373725 = r41373724 / r41373721;
double r41373726 = a;
double r41373727 = r41373721 / r41373726;
double r41373728 = r41373725 - r41373727;
double r41373729 = 2.5928684081554055e-64;
bool r41373730 = r41373721 <= r41373729;
double r41373731 = r41373721 * r41373721;
double r41373732 = 4.0;
double r41373733 = r41373732 * r41373726;
double r41373734 = r41373724 * r41373733;
double r41373735 = r41373731 - r41373734;
double r41373736 = sqrt(r41373735);
double r41373737 = r41373736 - r41373721;
double r41373738 = 2.0;
double r41373739 = r41373726 * r41373738;
double r41373740 = r41373737 / r41373739;
double r41373741 = -r41373725;
double r41373742 = r41373730 ? r41373740 : r41373741;
double r41373743 = r41373723 ? r41373728 : r41373742;
return r41373743;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 3 regimes
2. ## if b < -2.9400015506354064e+93

1. Initial program 43.7

$\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}$
2. Simplified43.7

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

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

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

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

## if -2.9400015506354064e+93 < b < 2.5928684081554055e-64

1. Initial program 12.8

$\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}$
2. Simplified12.8

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

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

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

## if 2.5928684081554055e-64 < b

1. Initial program 53.0

$\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}$
2. Simplified53.0

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

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

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

$\leadsto \color{blue}{-1 \cdot \frac{c}{b}}$
6. Simplified9.2

$\leadsto \color{blue}{\frac{-c}{b}}$
3. Recombined 3 regimes into one program.
4. Final simplification9.8

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

# Reproduce

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