Average Error: 25.9 → 2.1
Time: 1.5m
Precision: 64
Internal Precision: 2880
$\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 -1.3720909126072433 \cdot 10^{+154}:\\ \;\;\;\;\frac{a}{2} \cdot \left(\left(2 \cdot \frac{a \cdot c}{b} - b\right) - b\right)\\ \mathbf{if}\;b \le 7.975363662087551 \cdot 10^{-259}:\\ \;\;\;\;\frac{a}{2} \cdot \left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b\right)\\ \mathbf{if}\;b \le 4.180094940320339 \cdot 10^{+92}:\\ \;\;\;\;\frac{a}{2} \cdot \frac{\left(a \cdot c\right) \cdot \left(-4\right)}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{2} \cdot \left(-2 \cdot \frac{a \cdot c}{b}\right)\\ \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.3720909126072433e+154

1. Initial program 60.9

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

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

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

## if -1.3720909126072433e+154 < b < 7.975363662087551e-259

1. Initial program 1.6

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

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

## if 7.975363662087551e-259 < b < 4.180094940320339e+92

1. Initial program 16.0

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

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

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

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

## if 4.180094940320339e+92 < b

1. Initial program 55.3

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

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

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

# Runtime

Time bar (total: 1.5m)Debug log

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