Average Error: 19.5 → 13.1
Time: 40.9s
Precision: 64
Internal Precision: 128
\[\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \end{array}\]
\[\begin{array}{l} \mathbf{if}\;b \le 7.001124544380498 \cdot 10^{+142}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{\left(-b\right) - \left|\sqrt[3]{b \cdot b + \left(c \cdot a\right) \cdot -4}\right| \cdot \sqrt{\sqrt[3]{\sqrt[3]{b \cdot b + \left(a \cdot -4\right) \cdot c} \cdot \sqrt[3]{b \cdot b + \left(a \cdot -4\right) \cdot c}} \cdot \sqrt[3]{\sqrt[3]{b \cdot b + \left(a \cdot -4\right) \cdot c}}}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\sqrt{b \cdot b + \left(a \cdot -4\right) \cdot c} - b}\\ \end{array}\\ \mathbf{elif}\;b \ge 0:\\ \;\;\;\;\frac{\left(-b\right) - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\sqrt{b \cdot b + \left(a \cdot -4\right) \cdot c} - b}\\ \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 2 regimes
  2. if b < 7.001124544380498e+142

    1. Initial program 14.3

      \[\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \end{array}\]
    2. Initial simplification14.3

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{\left(-4 \cdot a\right) \cdot c + b \cdot b}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\sqrt{\left(-4 \cdot a\right) \cdot c + b \cdot b} - b}\\ \end{array}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt14.5

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{\color{blue}{\left(\sqrt[3]{\left(-4 \cdot a\right) \cdot c + b \cdot b} \cdot \sqrt[3]{\left(-4 \cdot a\right) \cdot c + b \cdot b}\right) \cdot \sqrt[3]{\left(-4 \cdot a\right) \cdot c + b \cdot b}}}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\sqrt{\left(-4 \cdot a\right) \cdot c + b \cdot b} - b}\\ \end{array}\]
    5. Applied sqrt-prod14.5

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{\left(-b\right) - \color{blue}{\sqrt{\sqrt[3]{\left(-4 \cdot a\right) \cdot c + b \cdot b} \cdot \sqrt[3]{\left(-4 \cdot a\right) \cdot c + b \cdot b}} \cdot \sqrt{\sqrt[3]{\left(-4 \cdot a\right) \cdot c + b \cdot b}}}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\sqrt{\left(-4 \cdot a\right) \cdot c + b \cdot b} - b}\\ \end{array}\]
    6. Simplified14.5

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{\left(-b\right) - \color{blue}{\left|\sqrt[3]{b \cdot b + \left(c \cdot a\right) \cdot -4}\right|} \cdot \sqrt{\sqrt[3]{\left(-4 \cdot a\right) \cdot c + b \cdot b}}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\sqrt{\left(-4 \cdot a\right) \cdot c + b \cdot b} - b}\\ \end{array}\]
    7. Using strategy rm
    8. Applied add-cube-cbrt14.5

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{\left(-b\right) - \left|\sqrt[3]{b \cdot b + \left(c \cdot a\right) \cdot -4}\right| \cdot \sqrt{\sqrt[3]{\color{blue}{\left(\sqrt[3]{\left(-4 \cdot a\right) \cdot c + b \cdot b} \cdot \sqrt[3]{\left(-4 \cdot a\right) \cdot c + b \cdot b}\right) \cdot \sqrt[3]{\left(-4 \cdot a\right) \cdot c + b \cdot b}}}}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\sqrt{\left(-4 \cdot a\right) \cdot c + b \cdot b} - b}\\ \end{array}\]
    9. Applied cbrt-prod14.5

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{\left(-b\right) - \left|\sqrt[3]{b \cdot b + \left(c \cdot a\right) \cdot -4}\right| \cdot \sqrt{\color{blue}{\sqrt[3]{\sqrt[3]{\left(-4 \cdot a\right) \cdot c + b \cdot b} \cdot \sqrt[3]{\left(-4 \cdot a\right) \cdot c + b \cdot b}} \cdot \sqrt[3]{\sqrt[3]{\left(-4 \cdot a\right) \cdot c + b \cdot b}}}}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\sqrt{\left(-4 \cdot a\right) \cdot c + b \cdot b} - b}\\ \end{array}\]

    if 7.001124544380498e+142 < b

    1. Initial program 56.4

      \[\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \end{array}\]
    2. Initial simplification56.4

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{\left(-4 \cdot a\right) \cdot c + b \cdot b}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\sqrt{\left(-4 \cdot a\right) \cdot c + b \cdot b} - b}\\ \end{array}\]
    3. Taylor expanded around 0 3.0

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{\left(-b\right) - \color{blue}{b}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\sqrt{\left(-4 \cdot a\right) \cdot c + b \cdot b} - b}\\ \end{array}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification13.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 7.001124544380498 \cdot 10^{+142}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{\left(-b\right) - \left|\sqrt[3]{b \cdot b + \left(c \cdot a\right) \cdot -4}\right| \cdot \sqrt{\sqrt[3]{\sqrt[3]{b \cdot b + \left(a \cdot -4\right) \cdot c} \cdot \sqrt[3]{b \cdot b + \left(a \cdot -4\right) \cdot c}} \cdot \sqrt[3]{\sqrt[3]{b \cdot b + \left(a \cdot -4\right) \cdot c}}}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\sqrt{b \cdot b + \left(a \cdot -4\right) \cdot c} - b}\\ \end{array}\\ \mathbf{elif}\;b \ge 0:\\ \;\;\;\;\frac{\left(-b\right) - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\sqrt{b \cdot b + \left(a \cdot -4\right) \cdot c} - b}\\ \end{array}\]

Runtime

Time bar (total: 40.9s)Debug logProfile

herbie shell --seed 2018346 
(FPCore (a b c)
  :name "jeff quadratic root 1"
  (if (>= b 0) (/ (- (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)) (/ (* 2 c) (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))))))