Average Error: 34.0 → 21.5
Time: 36.3s
Precision: 64
Internal Precision: 3136
$\frac{\left(-b\right) + \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}$
$\begin{array}{l} \mathbf{if}\;\frac{\sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c} + \left(-b\right)}{2 \cdot a} = -\infty:\\ \;\;\;\;\frac{4 \cdot c}{2 \cdot a} \cdot \frac{a}{\left(-b\right) - \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{elif}\;\frac{\sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c} + \left(-b\right)}{2 \cdot a} \le -1.3435509197748303 \cdot 10^{-236}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4}}{2 \cdot a}\\ \mathbf{elif}\;\frac{\sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c} + \left(-b\right)}{2 \cdot a} \le -0.0:\\ \;\;\;\;\frac{4 \cdot c}{\frac{\left(\left(-b\right) - \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}\right) \cdot \left(2 \cdot a\right)}{a}}\\ \mathbf{elif}\;\frac{\sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c} + \left(-b\right)}{2 \cdot a} \le 1.0862638443547306 \cdot 10^{+305}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}$

# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 4 regimes
2. ## if (/ (+ (- b) (sqrt (- (pow b 2) (* (* 4 a) c)))) (* 2 a)) < -inf.0

1. Initial program 62.1

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

$\leadsto \frac{\color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c} \cdot \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}{\left(-b\right) - \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}}}{2 \cdot a}$
4. Applied associate-/l/63.3

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

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

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

## if -inf.0 < (/ (+ (- b) (sqrt (- (pow b 2) (* (* 4 a) c)))) (* 2 a)) < -1.3435509197748303e-236 or -0.0 < (/ (+ (- b) (sqrt (- (pow b 2) (* (* 4 a) c)))) (* 2 a)) < 1.0862638443547306e+305

1. Initial program 4.5

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

$\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{e^{2 \cdot \left(\log -1 - \log \left(\frac{-1}{b}\right)\right)} - 4 \cdot \left(a \cdot c\right)}}}{2 \cdot a}$
3. Simplified4.5

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

## if -1.3435509197748303e-236 < (/ (+ (- b) (sqrt (- (pow b 2) (* (* 4 a) c)))) (* 2 a)) < -0.0

1. Initial program 53.0

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

$\leadsto \frac{\color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c} \cdot \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}{\left(-b\right) - \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}}}{2 \cdot a}$
4. Applied associate-/l/53.6

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

$\leadsto \frac{\color{blue}{\left(4 \cdot c\right) \cdot a}}{\left(2 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}\right)}$
6. Using strategy rm
7. Applied associate-/l*5.8

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

## if 1.0862638443547306e+305 < (/ (+ (- b) (sqrt (- (pow b 2) (* (* 4 a) c)))) (* 2 a))

1. Initial program 61.8

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

$\leadsto \frac{\color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c} \cdot \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}{\left(-b\right) - \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}}}{2 \cdot a}$
4. Applied associate-/l/62.1

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

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

$\leadsto \color{blue}{0}$
3. Recombined 4 regimes into one program.
4. Final simplification21.5

$\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c} + \left(-b\right)}{2 \cdot a} = -\infty:\\ \;\;\;\;\frac{4 \cdot c}{2 \cdot a} \cdot \frac{a}{\left(-b\right) - \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{elif}\;\frac{\sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c} + \left(-b\right)}{2 \cdot a} \le -1.3435509197748303 \cdot 10^{-236}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4}}{2 \cdot a}\\ \mathbf{elif}\;\frac{\sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c} + \left(-b\right)}{2 \cdot a} \le -0.0:\\ \;\;\;\;\frac{4 \cdot c}{\frac{\left(\left(-b\right) - \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}\right) \cdot \left(2 \cdot a\right)}{a}}\\ \mathbf{elif}\;\frac{\sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c} + \left(-b\right)}{2 \cdot a} \le 1.0862638443547306 \cdot 10^{+305}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}$

# Runtime

Time bar (total: 36.3s)Debug log

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