Average Error: 33.1 → 6.9
Time: 50.5s
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.76223481168814 \cdot 10^{+153}:\\ \;\;\;\;-\frac{b}{a}\\ \mathbf{elif}\;b \le -2.1097631082543147 \cdot 10^{-305}:\\ \;\;\;\;\frac{1}{\frac{a \cdot 2}{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}}\\ \mathbf{elif}\;b \le 4.903777908804514 \cdot 10^{+154}:\\ \;\;\;\;\frac{4}{2} \cdot \frac{-c}{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{4}{2} \cdot \frac{1}{\frac{b}{c} \cdot -2}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b

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.76223481168814e+153

    1. Initial program 60.7

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

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

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

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

    if -6.76223481168814e+153 < b < -2.1097631082543147e-305

    1. Initial program 8.8

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

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

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

    if -2.1097631082543147e-305 < b < 4.903777908804514e+154

    1. Initial program 34.0

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

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

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

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

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

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

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

    if 4.903777908804514e+154 < b

    1. Initial program 62.9

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{4}{2}} \cdot \frac{-c}{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} + b}\]
    10. Using strategy rm
    11. Applied clear-num38.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -6.76223481168814 \cdot 10^{+153}:\\ \;\;\;\;-\frac{b}{a}\\ \mathbf{elif}\;b \le -2.1097631082543147 \cdot 10^{-305}:\\ \;\;\;\;\frac{1}{\frac{a \cdot 2}{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}}\\ \mathbf{elif}\;b \le 4.903777908804514 \cdot 10^{+154}:\\ \;\;\;\;\frac{4}{2} \cdot \frac{-c}{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{4}{2} \cdot \frac{1}{\frac{b}{c} \cdot -2}\\ \end{array}\]

Runtime

Time bar (total: 50.5s)Debug logProfile

herbie shell --seed 2018219 
(FPCore (a b c)
  :name "Quadratic roots, full range"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))