Average Error: 16.0 → 0.2
Time: 20.1s
Precision: 64
Internal Precision: 320
$\left(-b\right) + \frac{\sqrt{b \cdot b - 4 \cdot ac}}{2 \cdot a}$
$\begin{array}{l} \mathbf{if}\;b \le -1.3313615435915737 \cdot 10^{+154}:\\ \;\;\;\;\frac{b}{a} \cdot \frac{-1}{2} - b\\ \mathbf{elif}\;b \le 1.8937566532977978 \cdot 10^{+96}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 4 \cdot ac}}{a \cdot 2} - b\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{a} \cdot \frac{1}{2} - b\\ \end{array}$

# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 3 regimes
2. ## if b < -1.3313615435915737e+154

1. Initial program 61.2

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

$\leadsto \frac{\sqrt{b \cdot b - 4 \cdot ac}}{a \cdot 2} - b$
3. Using strategy rm
4. Applied *-un-lft-identity61.2

$\leadsto \frac{\color{blue}{1 \cdot \sqrt{b \cdot b - 4 \cdot ac}}}{a \cdot 2} - b$
5. Applied associate-/l*61.2

$\leadsto \color{blue}{\frac{1}{\frac{a \cdot 2}{\sqrt{b \cdot b - 4 \cdot ac}}}} - b$
6. Taylor expanded around -inf 0.1

$\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{b}{a}} - b$

## if -1.3313615435915737e+154 < b < 1.8937566532977978e+96

1. Initial program 0.2

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

$\leadsto \frac{\sqrt{b \cdot b - 4 \cdot ac}}{a \cdot 2} - b$

## if 1.8937566532977978e+96 < b

1. Initial program 41.5

$\left(-b\right) + \frac{\sqrt{b \cdot b - 4 \cdot ac}}{2 \cdot a}$
2. Initial simplification41.5

$\leadsto \frac{\sqrt{b \cdot b - 4 \cdot ac}}{a \cdot 2} - b$
3. Taylor expanded around inf 0.7

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

$\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.3313615435915737 \cdot 10^{+154}:\\ \;\;\;\;\frac{b}{a} \cdot \frac{-1}{2} - b\\ \mathbf{elif}\;b \le 1.8937566532977978 \cdot 10^{+96}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 4 \cdot ac}}{a \cdot 2} - b\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{a} \cdot \frac{1}{2} - b\\ \end{array}$

# Runtime

Time bar (total: 20.1s)Debug log

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