Average Error: 33.6 → 9.8
Time: 2.8m
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}\;\frac{\frac{-2}{2}}{b} \le -7.223412898917059 \cdot 10^{+34}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 4} - b}{2 \cdot a}\\ \mathbf{if}\;\frac{\frac{-2}{2}}{b} \le 6.98549974141376 \cdot 10^{-310}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{if}\;\frac{\frac{-2}{2}}{b} \le 2.689539947645652 \cdot 10^{-90}:\\ \;\;\;\;-\frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 4} - b}}{a} \cdot \frac{\sqrt{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 4} - b}}{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 (/ (/ -2 2) b) < -7.223412898917059e+34

    1. Initial program 22.9

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

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

    if -7.223412898917059e+34 < (/ (/ -2 2) b) < 6.98549974141376e-310

    1. Initial program 54.2

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

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

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

      \[\leadsto \color{blue}{\frac{-c}{\frac{b}{1}}}\]

    if 6.98549974141376e-310 < (/ (/ -2 2) b) < 2.689539947645652e-90

    1. Initial program 42.9

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{b}{a}}\]
    4. Applied simplify3.5

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

    if 2.689539947645652e-90 < (/ (/ -2 2) b)

    1. Initial program 9.0

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

      \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} - b}{2 \cdot a}}\]
    3. Using strategy rm
    4. Applied add-sqr-sqrt9.3

      \[\leadsto \frac{\color{blue}{\sqrt{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} - b} \cdot \sqrt{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} - b}}}{2 \cdot a}\]
    5. Applied times-frac9.3

      \[\leadsto \color{blue}{\frac{\sqrt{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} - b}}{2} \cdot \frac{\sqrt{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} - b}}{a}}\]
  3. Recombined 4 regimes into one program.
  4. Applied simplify9.8

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;\frac{\frac{-2}{2}}{b} \le -7.223412898917059 \cdot 10^{+34}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 4} - b}{2 \cdot a}\\ \mathbf{if}\;\frac{\frac{-2}{2}}{b} \le 6.98549974141376 \cdot 10^{-310}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{if}\;\frac{\frac{-2}{2}}{b} \le 2.689539947645652 \cdot 10^{-90}:\\ \;\;\;\;-\frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 4} - b}}{a} \cdot \frac{\sqrt{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 4} - b}}{2}\\ \end{array}}\]

Runtime

Time bar (total: 2.8m)Debug logProfile

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