Average Error: 34.1 → 10.4
Time: 12.1s
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 -9.49737499068338874170202339475148683659 \cdot 10^{62}:\\ \;\;\;\;-1 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \le -9280942802423784669184:\\ \;\;\;\;\frac{\frac{\left(c \cdot 4\right) \cdot a}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}}{2 \cdot a}\\ \mathbf{elif}\;b \le -2.681359924170041582063143841454222537261 \cdot 10^{-50}:\\ \;\;\;\;-1 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \le 2.012486287363746365734009384581404883243 \cdot 10^{45}:\\ \;\;\;\;\frac{1}{2 \cdot a} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(\frac{c}{b} - \frac{b}{a}\right)\\ \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 -9.49737499068338874170202339475148683659 \cdot 10^{62}:\\
\;\;\;\;-1 \cdot \frac{c}{b}\\

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

\mathbf{elif}\;b \le -2.681359924170041582063143841454222537261 \cdot 10^{-50}:\\
\;\;\;\;-1 \cdot \frac{c}{b}\\

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

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

\end{array}
double f(double b, double a, double c) {
double r3507109 = b;
double r3507110 = -r3507109;
double r3507111 = r3507109 * r3507109;
double r3507112 = 4.0;
double r3507113 = a;
double r3507114 = r3507112 * r3507113;
double r3507115 = c;
double r3507116 = r3507114 * r3507115;
double r3507117 = r3507111 - r3507116;
double r3507118 = sqrt(r3507117);
double r3507119 = r3507110 - r3507118;
double r3507120 = 2.0;
double r3507121 = r3507120 * r3507113;
double r3507122 = r3507119 / r3507121;
return r3507122;
}

double f(double b, double a, double c) {
double r3507123 = b;
double r3507124 = -9.497374990683389e+62;
bool r3507125 = r3507123 <= r3507124;
double r3507126 = -1.0;
double r3507127 = c;
double r3507128 = r3507127 / r3507123;
double r3507129 = r3507126 * r3507128;
double r3507130 = -9.280942802423785e+21;
bool r3507131 = r3507123 <= r3507130;
double r3507132 = 4.0;
double r3507133 = r3507127 * r3507132;
double r3507134 = a;
double r3507135 = r3507133 * r3507134;
double r3507136 = r3507123 * r3507123;
double r3507137 = r3507132 * r3507134;
double r3507138 = r3507137 * r3507127;
double r3507139 = r3507136 - r3507138;
double r3507140 = sqrt(r3507139);
double r3507141 = r3507140 - r3507123;
double r3507142 = r3507135 / r3507141;
double r3507143 = 2.0;
double r3507144 = r3507143 * r3507134;
double r3507145 = r3507142 / r3507144;
double r3507146 = -2.6813599241700416e-50;
bool r3507147 = r3507123 <= r3507146;
double r3507148 = 2.0124862873637464e+45;
bool r3507149 = r3507123 <= r3507148;
double r3507150 = 1.0;
double r3507151 = r3507150 / r3507144;
double r3507152 = -r3507123;
double r3507153 = r3507152 - r3507140;
double r3507154 = r3507151 * r3507153;
double r3507155 = 1.0;
double r3507156 = r3507123 / r3507134;
double r3507157 = r3507128 - r3507156;
double r3507158 = r3507155 * r3507157;
double r3507159 = r3507149 ? r3507154 : r3507158;
double r3507160 = r3507147 ? r3507129 : r3507159;
double r3507161 = r3507131 ? r3507145 : r3507160;
double r3507162 = r3507125 ? r3507129 : r3507161;
return r3507162;
}

# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 4 regimes
2. ## if b < -9.497374990683389e+62 or -9.280942802423785e+21 < b < -2.6813599241700416e-50

1. Initial program 54.6

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

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

## if -9.497374990683389e+62 < b < -9.280942802423785e+21

1. Initial program 47.0

$\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}$
2. Using strategy rm
3. Applied flip--47.0

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

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

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

## if -2.6813599241700416e-50 < b < 2.0124862873637464e+45

1. Initial program 14.8

$\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}$
2. Using strategy rm
3. Applied clear-num14.9

$\leadsto \color{blue}{\frac{1}{\frac{2 \cdot a}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}}$
4. Using strategy rm
5. Applied div-inv15.0

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

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

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

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

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

## if 2.0124862873637464e+45 < b

1. Initial program 37.3

$\frac{\left(-b\right) - \sqrt{b \cdot b - \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 4 regimes into one program.
4. Final simplification10.4

$\leadsto \begin{array}{l} \mathbf{if}\;b \le -9.49737499068338874170202339475148683659 \cdot 10^{62}:\\ \;\;\;\;-1 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \le -9280942802423784669184:\\ \;\;\;\;\frac{\frac{\left(c \cdot 4\right) \cdot a}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}}{2 \cdot a}\\ \mathbf{elif}\;b \le -2.681359924170041582063143841454222537261 \cdot 10^{-50}:\\ \;\;\;\;-1 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \le 2.012486287363746365734009384581404883243 \cdot 10^{45}:\\ \;\;\;\;\frac{1}{2 \cdot a} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)\\ \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*b-4*a*c))/(2*a)"
:precision binary64
(/ (- (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))