Average Error: 29.8 → 3.6
Time: 13.9s
Precision: 64
Internal Precision: 2368
$\frac{b + \sqrt{b \cdot b - 4 \cdot c}}{2}$
$\begin{array}{l} \mathbf{if}\;b \le -2.2869001147814792 \cdot 10^{-45}:\\ \;\;\;\;\frac{\frac{c}{b} \cdot 2}{2}\\ \mathbf{elif}\;b \le 4.412319935246271 \cdot 10^{+79}:\\ \;\;\;\;\frac{b + \sqrt{b \cdot b - 4 \cdot c}}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot \left(b - \frac{c}{b}\right)}{2}\\ \end{array}$

# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 3 regimes
2. ## if b < -2.2869001147814792e-45

1. Initial program 52.7

$\frac{b + \sqrt{b \cdot b - 4 \cdot c}}{2}$
2. Initial simplification52.7

$\leadsto \frac{\sqrt{b \cdot b - 4 \cdot c} + b}{2}$
3. Taylor expanded around -inf 5.6

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

## if -2.2869001147814792e-45 < b < 4.412319935246271e+79

1. Initial program 3.0

$\frac{b + \sqrt{b \cdot b - 4 \cdot c}}{2}$
2. Initial simplification3.0

$\leadsto \frac{\sqrt{b \cdot b - 4 \cdot c} + b}{2}$

## if 4.412319935246271e+79 < b

1. Initial program 41.1

$\frac{b + \sqrt{b \cdot b - 4 \cdot c}}{2}$
2. Initial simplification41.1

$\leadsto \frac{\sqrt{b \cdot b - 4 \cdot c} + b}{2}$
3. Taylor expanded around inf 1.7

$\leadsto \frac{\color{blue}{2 \cdot b - 2 \cdot \frac{c}{b}}}{2}$
4. Simplified1.7

$\leadsto \frac{\color{blue}{\left(b - \frac{c}{b}\right) \cdot 2}}{2}$
3. Recombined 3 regimes into one program.
4. Final simplification3.6

$\leadsto \begin{array}{l} \mathbf{if}\;b \le -2.2869001147814792 \cdot 10^{-45}:\\ \;\;\;\;\frac{\frac{c}{b} \cdot 2}{2}\\ \mathbf{elif}\;b \le 4.412319935246271 \cdot 10^{+79}:\\ \;\;\;\;\frac{b + \sqrt{b \cdot b - 4 \cdot c}}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot \left(b - \frac{c}{b}\right)}{2}\\ \end{array}$

# Runtime

Time bar (total: 13.9s)Debug log

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