Average Error: 33.9 → 9.3
Time: 34.7s
Precision: 64
Internal Precision: 3392
\[\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;b \le -6.826205091476792 \cdot 10^{+149}:\\ \;\;\;\;\frac{\frac{a \cdot c}{b} \cdot -2}{a \cdot 2}\\ \mathbf{elif}\;b \le -1.1602021087089593 \cdot 10^{-212}:\\ \;\;\;\;\frac{4}{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - b} \cdot \frac{c}{2}\\ \mathbf{elif}\;b \le 2.1655982362047897 \cdot 10^{+91}:\\ \;\;\;\;\frac{-b}{a \cdot 2} - \frac{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;-\frac{b}{a}\\ \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 4 regimes
  2. if b < -6.826205091476792e+149

    1. Initial program 62.3

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
    2. Initial simplification62.3

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

      \[\leadsto \frac{\color{blue}{-2 \cdot \frac{a \cdot c}{b}}}{2 \cdot a}\]

    if -6.826205091476792e+149 < b < -1.1602021087089593e-212

    1. Initial program 38.7

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
    2. Initial simplification38.7

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

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

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

      \[\leadsto \frac{\color{blue}{\left(c \cdot a\right) \cdot 4}}{\left(2 \cdot a\right) \cdot \left(\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}\right)}\]
    7. Using strategy rm
    8. Applied times-frac14.2

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

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

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

    if -1.1602021087089593e-212 < b < 2.1655982362047897e+91

    1. Initial program 10.7

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
    2. Initial simplification10.7

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

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

    if 2.1655982362047897e+91 < b

    1. Initial program 42.5

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
    2. Initial simplification42.5

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{b}{a}}\]
    8. Simplified4.6

      \[\leadsto \color{blue}{-\frac{b}{a}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification9.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -6.826205091476792 \cdot 10^{+149}:\\ \;\;\;\;\frac{\frac{a \cdot c}{b} \cdot -2}{a \cdot 2}\\ \mathbf{elif}\;b \le -1.1602021087089593 \cdot 10^{-212}:\\ \;\;\;\;\frac{4}{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - b} \cdot \frac{c}{2}\\ \mathbf{elif}\;b \le 2.1655982362047897 \cdot 10^{+91}:\\ \;\;\;\;\frac{-b}{a \cdot 2} - \frac{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;-\frac{b}{a}\\ \end{array}\]

Runtime

Time bar (total: 34.7s)Debug log

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