Average Error: 21.7 → 6.7
Time: 27.9s
Precision: 64
Internal Precision: 320
\[\left(-b\right) + \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;b \le -1.046160955513184 \cdot 10^{+143}:\\ \;\;\;\;\frac{c}{b} - \left(b + \frac{b}{a} \cdot \frac{1}{2}\right)\\ \mathbf{elif}\;b \le 6.465689128044041 \cdot 10^{+67}:\\ \;\;\;\;\left(-b\right) + \frac{1}{a \cdot 2} \cdot \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{a} \cdot \frac{1}{2} - b\\ \end{array}\]

Error

Bits error versus b

Bits error versus a

Bits error versus c

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if b < -1.046160955513184e+143

    1. Initial program 57.1

      \[\left(-b\right) + \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
    2. Using strategy rm
    3. Applied div-inv57.2

      \[\leadsto \left(-b\right) + \color{blue}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \frac{1}{2 \cdot a}}\]
    4. Taylor expanded around -inf 0.1

      \[\leadsto \color{blue}{\frac{c}{b} - \left(b + \frac{1}{2} \cdot \frac{b}{a}\right)}\]

    if -1.046160955513184e+143 < b < 6.465689128044041e+67

    1. Initial program 9.6

      \[\left(-b\right) + \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
    2. Using strategy rm
    3. Applied div-inv9.8

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

    if 6.465689128044041e+67 < b

    1. Initial program 38.8

      \[\left(-b\right) + \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
    2. Taylor expanded around inf 0.5

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{b}{a} - b}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification6.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.046160955513184 \cdot 10^{+143}:\\ \;\;\;\;\frac{c}{b} - \left(b + \frac{b}{a} \cdot \frac{1}{2}\right)\\ \mathbf{elif}\;b \le 6.465689128044041 \cdot 10^{+67}:\\ \;\;\;\;\left(-b\right) + \frac{1}{a \cdot 2} \cdot \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{a} \cdot \frac{1}{2} - b\\ \end{array}\]

Runtime

Time bar (total: 27.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))))