Average Error: 34.0 → 9.1
Time: 31.3s
Precision: 64
Internal Precision: 3136
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4.0 \cdot a\right) \cdot c}}{2.0 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;b \le -1.6542749383198656 \cdot 10^{+143}:\\ \;\;\;\;\frac{b}{a} \cdot -1.0\\ \mathbf{elif}\;b \le -7.231414510710038 \cdot 10^{-215}:\\ \;\;\;\;\frac{1}{\frac{a \cdot 2.0}{\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(4.0 \cdot a\right)}}}\\ \mathbf{elif}\;b \le 8.099564696201428 \cdot 10^{+148}:\\ \;\;\;\;\frac{4.0}{2.0} \cdot \frac{c}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(4.0 \cdot a\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a \cdot c}{b} \cdot -2.0}{a \cdot 2.0}\\ \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 < -1.6542749383198656e+143

    1. Initial program 57.0

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

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

    if -1.6542749383198656e+143 < b < -7.231414510710038e-215

    1. Initial program 7.7

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4.0 \cdot a\right) \cdot c}}{2.0 \cdot a}\]
    2. Using strategy rm
    3. Applied clear-num7.8

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

    if -7.231414510710038e-215 < b < 8.099564696201428e+148

    1. Initial program 32.3

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4.0 \cdot a\right) \cdot c}}{2.0 \cdot a}\]
    2. Using strategy rm
    3. Applied flip-+32.5

      \[\leadsto \frac{\color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \sqrt{b \cdot b - \left(4.0 \cdot a\right) \cdot c} \cdot \sqrt{b \cdot b - \left(4.0 \cdot a\right) \cdot c}}{\left(-b\right) - \sqrt{b \cdot b - \left(4.0 \cdot a\right) \cdot c}}}}{2.0 \cdot a}\]
    4. Applied associate-/l/37.3

      \[\leadsto \color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \sqrt{b \cdot b - \left(4.0 \cdot a\right) \cdot c} \cdot \sqrt{b \cdot b - \left(4.0 \cdot a\right) \cdot c}}{\left(2.0 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4.0 \cdot a\right) \cdot c}\right)}}\]
    5. Simplified20.9

      \[\leadsto \frac{\color{blue}{\left(4.0 \cdot a\right) \cdot c}}{\left(2.0 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4.0 \cdot a\right) \cdot c}\right)}\]
    6. Using strategy rm
    7. Applied times-frac9.5

      \[\leadsto \color{blue}{\frac{4.0 \cdot a}{2.0 \cdot a} \cdot \frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(4.0 \cdot a\right) \cdot c}}}\]
    8. Simplified9.5

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

    if 8.099564696201428e+148 < b

    1. Initial program 62.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.6542749383198656 \cdot 10^{+143}:\\ \;\;\;\;\frac{b}{a} \cdot -1.0\\ \mathbf{elif}\;b \le -7.231414510710038 \cdot 10^{-215}:\\ \;\;\;\;\frac{1}{\frac{a \cdot 2.0}{\left(-b\right) + \sqrt{b \cdot b - c \cdot \left(4.0 \cdot a\right)}}}\\ \mathbf{elif}\;b \le 8.099564696201428 \cdot 10^{+148}:\\ \;\;\;\;\frac{4.0}{2.0} \cdot \frac{c}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(4.0 \cdot a\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{a \cdot c}{b} \cdot -2.0}{a \cdot 2.0}\\ \end{array}\]

Runtime

Time bar (total: 31.3s)Debug log

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