Average Error: 34.0 → 9.1
Time: 30.2s
Precision: 64
Internal Precision: 3136
$\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 -1.8841143072599695 \cdot 10^{+143}:\\ \;\;\;\;-\frac{b}{a}\\ \mathbf{elif}\;b \le -1.99115643380109 \cdot 10^{-259}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} + \left(-b\right)}{a \cdot 2}\\ \mathbf{elif}\;b \le 8.099564696201428 \cdot 10^{+148}:\\ \;\;\;\;\frac{4}{2} \cdot \frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-2 \cdot \frac{a \cdot c}{b}}{a \cdot 2}\\ \end{array}$

# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 4 regimes
2. ## if b < -1.8841143072599695e+143

1. Initial program 57.0

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

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

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

## if -1.8841143072599695e+143 < b < -1.99115643380109e-259

1. Initial program 8.5

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

## if -1.99115643380109e-259 < b < 8.099564696201428e+148

1. Initial program 33.4

$\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-+33.5

$\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. Applied associate-/l/38.1

$\leadsto \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(2 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}$
5. Simplified20.6

$\leadsto \frac{\color{blue}{\left(4 \cdot a\right) \cdot c}}{\left(2 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}$
6. Using strategy rm
7. Applied times-frac8.9

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

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

## if 8.099564696201428e+148 < b

1. Initial program 62.1

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

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

$\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.8841143072599695 \cdot 10^{+143}:\\ \;\;\;\;-\frac{b}{a}\\ \mathbf{elif}\;b \le -1.99115643380109 \cdot 10^{-259}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} + \left(-b\right)}{a \cdot 2}\\ \mathbf{elif}\;b \le 8.099564696201428 \cdot 10^{+148}:\\ \;\;\;\;\frac{4}{2} \cdot \frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-2 \cdot \frac{a \cdot c}{b}}{a \cdot 2}\\ \end{array}$

# Runtime

Time bar (total: 30.2s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)'
(FPCore (b a c)
:name "(-b + sqrt(b*b-4*a*c))/(2*a)"
(/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))