Average Error: 34.2 → 10.0
Time: 16.4s
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.940001550635406357572527191036557327772 \cdot 10^{93}:\\ \;\;\;\;\left(\frac{c}{b} - \frac{b}{a}\right) \cdot 1\\ \mathbf{elif}\;b \le 2.592868408155405548302080990651854167189 \cdot 10^{-64}:\\ \;\;\;\;\left(\sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)} - b\right) \cdot \frac{1}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -1\\ \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.940001550635406357572527191036557327772 \cdot 10^{93}:\\
\;\;\;\;\left(\frac{c}{b} - \frac{b}{a}\right) \cdot 1\\

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

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

\end{array}
double f(double b, double a, double c) {
double r23227984 = b;
double r23227985 = -r23227984;
double r23227986 = r23227984 * r23227984;
double r23227987 = 4.0;
double r23227988 = a;
double r23227989 = r23227987 * r23227988;
double r23227990 = c;
double r23227991 = r23227989 * r23227990;
double r23227992 = r23227986 - r23227991;
double r23227993 = sqrt(r23227992);
double r23227994 = r23227985 + r23227993;
double r23227995 = 2.0;
double r23227996 = r23227995 * r23227988;
double r23227997 = r23227994 / r23227996;
return r23227997;
}


double f(double b, double a, double c) {
double r23227998 = b;
double r23227999 = -2.9400015506354064e+93;
bool r23228000 = r23227998 <= r23227999;
double r23228001 = c;
double r23228002 = r23228001 / r23227998;
double r23228003 = a;
double r23228004 = r23227998 / r23228003;
double r23228005 = r23228002 - r23228004;
double r23228006 = 1.0;
double r23228007 = r23228005 * r23228006;
double r23228008 = 2.5928684081554055e-64;
bool r23228009 = r23227998 <= r23228008;
double r23228010 = r23227998 * r23227998;
double r23228011 = 4.0;
double r23228012 = r23228001 * r23228003;
double r23228013 = r23228011 * r23228012;
double r23228014 = r23228010 - r23228013;
double r23228015 = sqrt(r23228014);
double r23228016 = r23228015 - r23227998;
double r23228017 = 1.0;
double r23228018 = 2.0;
double r23228019 = r23228003 * r23228018;
double r23228020 = r23228017 / r23228019;
double r23228021 = r23228016 * r23228020;
double r23228022 = -1.0;
double r23228023 = r23228002 * r23228022;
double r23228024 = r23228009 ? r23228021 : r23228023;
double r23228025 = r23228000 ? r23228007 : r23228024;
return r23228025;
}



# 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 45.8

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

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

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

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

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

1. Initial program 13.0

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

$\leadsto \color{blue}{\frac{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} - b}{a \cdot 2}}$
3. Using strategy rm
4. Applied clear-num13.1

$\leadsto \color{blue}{\frac{1}{\frac{a \cdot 2}{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} - b}}}$
5. Using strategy rm
6. Applied associate-/r/13.1

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

## if 2.5928684081554055e-64 < b

1. Initial program 53.6

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

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

$\leadsto \color{blue}{-1 \cdot \frac{c}{b}}$
3. Recombined 3 regimes into one program.
4. Final simplification10.0

$\leadsto \begin{array}{l} \mathbf{if}\;b \le -2.940001550635406357572527191036557327772 \cdot 10^{93}:\\ \;\;\;\;\left(\frac{c}{b} - \frac{b}{a}\right) \cdot 1\\ \mathbf{elif}\;b \le 2.592868408155405548302080990651854167189 \cdot 10^{-64}:\\ \;\;\;\;\left(\sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)} - b\right) \cdot \frac{1}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -1\\ \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.0 a) c)))) (* 2.0 a)))