Average Error: 25.9 → 2.0
Time: 30.9s
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}:\\ \;\;\;\;b \cdot \left(-a\right)\\ \mathbf{elif}\;b \le 9.256536467642609 \cdot 10^{-141}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - b}{2} \cdot a\\ \mathbf{elif}\;b \le 2.7512793042658205 \cdot 10^{+92}:\\ \;\;\;\;\frac{\left(a \cdot 4\right) \cdot \left(-c\right)}{\frac{2}{a} \cdot \left(b + \sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c}\right)}\\ \mathbf{else}:\\ \;\;\;\;a \cdot \frac{\frac{a \cdot c}{b} \cdot -2}{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.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. Taylor expanded around -inf 0.1

$\leadsto \color{blue}{-1 \cdot \left(a \cdot b\right)}$
3. Simplified0.1

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

## if -1.3720909126072433e+154 < b < 9.256536467642609e-141

1. Initial program 1.9

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

$\leadsto \frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b}{\frac{2}{a}}$
3. Using strategy rm
4. Applied associate-/r/1.9

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

## if 9.256536467642609e-141 < b < 2.7512793042658205e+92

1. Initial program 20.4

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

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

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

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

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

## if 2.7512793042658205e+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. Taylor expanded around inf 3.7

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

$\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.3720909126072433 \cdot 10^{+154}:\\ \;\;\;\;b \cdot \left(-a\right)\\ \mathbf{elif}\;b \le 9.256536467642609 \cdot 10^{-141}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - b}{2} \cdot a\\ \mathbf{elif}\;b \le 2.7512793042658205 \cdot 10^{+92}:\\ \;\;\;\;\frac{\left(a \cdot 4\right) \cdot \left(-c\right)}{\frac{2}{a} \cdot \left(b + \sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c}\right)}\\ \mathbf{else}:\\ \;\;\;\;a \cdot \frac{\frac{a \cdot c}{b} \cdot -2}{2}\\ \end{array}$

# Runtime

Time bar (total: 30.9s)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))