Average Error: 34.2 → 9.9
Time: 13.4s
Precision: 64
$\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}$
$\begin{array}{l} \mathbf{if}\;b \le -2.940001550635406357572527191036557327772 \cdot 10^{93}:\\ \;\;\;\;1 \cdot \left(\frac{c}{b} - \frac{b}{a}\right)\\ \mathbf{elif}\;b \le 2.592868408155405548302080990651854167189 \cdot 10^{-64}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}{a}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \frac{c}{b}\\ \end{array}$
\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}
\begin{array}{l}
\mathbf{if}\;b \le -2.940001550635406357572527191036557327772 \cdot 10^{93}:\\
\;\;\;\;1 \cdot \left(\frac{c}{b} - \frac{b}{a}\right)\\

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

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

\end{array}
double f(double b, double a, double c) {
double r622141 = b;
double r622142 = -r622141;
double r622143 = r622141 * r622141;
double r622144 = 4.0;
double r622145 = a;
double r622146 = c;
double r622147 = r622145 * r622146;
double r622148 = r622144 * r622147;
double r622149 = r622143 - r622148;
double r622150 = sqrt(r622149);
double r622151 = r622142 + r622150;
double r622152 = 2.0;
double r622153 = r622152 * r622145;
double r622154 = r622151 / r622153;
return r622154;
}


double f(double b, double a, double c) {
double r622155 = b;
double r622156 = -2.9400015506354064e+93;
bool r622157 = r622155 <= r622156;
double r622158 = 1.0;
double r622159 = c;
double r622160 = r622159 / r622155;
double r622161 = a;
double r622162 = r622155 / r622161;
double r622163 = r622160 - r622162;
double r622164 = r622158 * r622163;
double r622165 = 2.5928684081554055e-64;
bool r622166 = r622155 <= r622165;
double r622167 = 1.0;
double r622168 = 2.0;
double r622169 = r622167 / r622168;
double r622170 = r622155 * r622155;
double r622171 = 4.0;
double r622172 = r622161 * r622159;
double r622173 = r622171 * r622172;
double r622174 = r622170 - r622173;
double r622175 = sqrt(r622174);
double r622176 = r622175 - r622155;
double r622177 = r622176 / r622161;
double r622178 = r622169 * r622177;
double r622179 = -1.0;
double r622180 = r622179 * r622160;
double r622181 = r622166 ? r622178 : r622180;
double r622182 = r622157 ? r622164 : r622181;
return r622182;
}



# Try it out

Your Program's Arguments

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 - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}$
2. Simplified45.8

$\leadsto \color{blue}{\frac{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}{2 \cdot a}}$
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}{1 \cdot \left(\frac{c}{b} - \frac{b}{a}\right)}$

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

1. Initial program 13.0

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

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

$\leadsto \color{blue}{\frac{1}{\frac{2 \cdot a}{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}}}$
5. Using strategy rm
6. Applied *-un-lft-identity13.1

$\leadsto \frac{1}{\color{blue}{1 \cdot \frac{2 \cdot a}{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}}}$
7. Applied add-cube-cbrt13.1

$\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{1 \cdot \frac{2 \cdot a}{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}}$
8. Applied times-frac13.1

$\leadsto \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\sqrt[3]{1}}{\frac{2 \cdot a}{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}}}$
9. Simplified13.1

$\leadsto \color{blue}{1} \cdot \frac{\sqrt[3]{1}}{\frac{2 \cdot a}{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}}$
10. Simplified13.0

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

## if 2.5928684081554055e-64 < b

1. Initial program 53.6

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

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

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

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

# Reproduce

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