Average Error: 33.5 → 10.0
Time: 15.1s
Precision: 64
$\frac{\left(-b\right) + \sqrt{b \cdot b - a \cdot c}}{a}$
$\begin{array}{l} \mathbf{if}\;b \le -1.7279872839456578 \cdot 10^{+63}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b} - \frac{b}{a} \cdot 2\\ \mathbf{elif}\;b \le 2.5928684081554055 \cdot 10^{-64}:\\ \;\;\;\;\frac{1}{\frac{a}{\sqrt{b \cdot b - a \cdot c} - b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\ \end{array}$
\frac{\left(-b\right) + \sqrt{b \cdot b - a \cdot c}}{a}
\begin{array}{l}
\mathbf{if}\;b \le -1.7279872839456578 \cdot 10^{+63}:\\
\;\;\;\;\frac{1}{2} \cdot \frac{c}{b} - \frac{b}{a} \cdot 2\\

\mathbf{elif}\;b \le 2.5928684081554055 \cdot 10^{-64}:\\
\;\;\;\;\frac{1}{\frac{a}{\sqrt{b \cdot b - a \cdot c} - b}}\\

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

\end{array}
double f(double b, double a, double c) {
double r6865745 = b;
double r6865746 = -r6865745;
double r6865747 = r6865745 * r6865745;
double r6865748 = a;
double r6865749 = c;
double r6865750 = r6865748 * r6865749;
double r6865751 = r6865747 - r6865750;
double r6865752 = sqrt(r6865751);
double r6865753 = r6865746 + r6865752;
double r6865754 = r6865753 / r6865748;
return r6865754;
}


double f(double b, double a, double c) {
double r6865755 = b;
double r6865756 = -1.7279872839456578e+63;
bool r6865757 = r6865755 <= r6865756;
double r6865758 = 0.5;
double r6865759 = c;
double r6865760 = r6865759 / r6865755;
double r6865761 = r6865758 * r6865760;
double r6865762 = a;
double r6865763 = r6865755 / r6865762;
double r6865764 = 2.0;
double r6865765 = r6865763 * r6865764;
double r6865766 = r6865761 - r6865765;
double r6865767 = 2.5928684081554055e-64;
bool r6865768 = r6865755 <= r6865767;
double r6865769 = 1.0;
double r6865770 = r6865755 * r6865755;
double r6865771 = r6865762 * r6865759;
double r6865772 = r6865770 - r6865771;
double r6865773 = sqrt(r6865772);
double r6865774 = r6865773 - r6865755;
double r6865775 = r6865762 / r6865774;
double r6865776 = r6865769 / r6865775;
double r6865777 = -0.5;
double r6865778 = r6865777 * r6865760;
double r6865779 = r6865768 ? r6865776 : r6865778;
double r6865780 = r6865757 ? r6865766 : r6865779;
return r6865780;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 3 regimes
2. ## if b < -1.7279872839456578e+63

1. Initial program 38.4

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

$\leadsto \color{blue}{\frac{\sqrt{b \cdot b - a \cdot c} - b}{a}}$
3. Taylor expanded around -inf 38.4

$\leadsto \frac{\sqrt{\color{blue}{{b}^{2} - a \cdot c}} - b}{a}$
4. Simplified38.4

$\leadsto \frac{\sqrt{\color{blue}{b \cdot b - a \cdot c}} - b}{a}$
5. Taylor expanded around -inf 4.4

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

## if -1.7279872839456578e+63 < b < 2.5928684081554055e-64

1. Initial program 13.2

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

$\leadsto \color{blue}{\frac{\sqrt{b \cdot b - a \cdot c} - b}{a}}$
3. Taylor expanded around -inf 13.2

$\leadsto \frac{\sqrt{\color{blue}{{b}^{2} - a \cdot c}} - b}{a}$
4. Simplified13.2

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

$\leadsto \frac{\sqrt{b \cdot b - a \cdot c} - \color{blue}{1 \cdot b}}{a}$
7. Applied *-un-lft-identity13.2

$\leadsto \frac{\color{blue}{1 \cdot \sqrt{b \cdot b - a \cdot c}} - 1 \cdot b}{a}$
8. Applied distribute-lft-out--13.2

$\leadsto \frac{\color{blue}{1 \cdot \left(\sqrt{b \cdot b - a \cdot c} - b\right)}}{a}$
9. Applied associate-/l*13.3

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

## if 2.5928684081554055e-64 < b

1. Initial program 52.9

$\frac{\left(-b\right) + \sqrt{b \cdot b - a \cdot c}}{a}$
2. Simplified52.9

$\leadsto \color{blue}{\frac{\sqrt{b \cdot b - a \cdot c} - b}{a}}$
3. Taylor expanded around inf 9.2

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

$\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.7279872839456578 \cdot 10^{+63}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b} - \frac{b}{a} \cdot 2\\ \mathbf{elif}\;b \le 2.5928684081554055 \cdot 10^{-64}:\\ \;\;\;\;\frac{1}{\frac{a}{\sqrt{b \cdot b - a \cdot c} - b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\ \end{array}$

# Reproduce

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