Average Error: 19.5 → 13.1
Time: 51.1s
Precision: 64
Internal Precision: 576
\[\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array}\]
\[\begin{array}{l} \mathbf{if}\;\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\frac{a \cdot \left(c \cdot 4\right)}{\sqrt{(\left(-c\right) \cdot \left(a \cdot 4\right) + \left(b \cdot b\right))_*} - b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{(\left(a \cdot 4\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{a \cdot 2}\\ \end{array} \le -2.1205622766064206 \cdot 10^{+225} \lor \neg \left(\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\frac{a \cdot \left(c \cdot 4\right)}{\sqrt{(\left(-c\right) \cdot \left(a \cdot 4\right) + \left(b \cdot b\right))_*} - b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{(\left(a \cdot 4\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{a \cdot 2}\\ \end{array} \le 8.835097148549356 \cdot 10^{+217}\right):\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{(\left(a \cdot 4\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{a \cdot 2}\\ \end{array}\\ \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{(\left(a \cdot 4\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\sqrt{(\left(a \cdot 4\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}} \cdot \sqrt{\left|\sqrt[3]{(\left(-c\right) \cdot \left(a \cdot 4\right) + \left(b \cdot b\right))_*}\right| \cdot \sqrt{\sqrt[3]{(\left(a \cdot 4\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}} - b}{a \cdot 2}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Split input into 2 regimes
  2. if (if (>= b 0) (/ (* 2 c) (/ (* (* 4 c) a) (- (sqrt (fma (- c) (* 4 a) (* b b))) b))) (/ (- (sqrt (fma (* 4 a) (- c) (* b b))) b) (* a 2))) < -2.1205622766064206e+225 or 8.835097148549356e+217 < (if (>= b 0) (/ (* 2 c) (/ (* (* 4 c) a) (- (sqrt (fma (- c) (* 4 a) (* b b))) b))) (/ (- (sqrt (fma (* 4 a) (- c) (* b b))) b) (* a 2)))

    1. Initial program 40.5

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

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

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

    if -2.1205622766064206e+225 < (if (>= b 0) (/ (* 2 c) (/ (* (* 4 c) a) (- (sqrt (fma (- c) (* 4 a) (* b b))) b))) (/ (- (sqrt (fma (* 4 a) (- c) (* b b))) b) (* a 2))) < 8.835097148549356e+217

    1. Initial program 1.7

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\sqrt{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}} \cdot \sqrt{\sqrt{\sqrt[3]{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} \cdot \sqrt[3]{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}} \cdot \sqrt{\sqrt[3]{(\left(4 \cdot a\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}} - b}{a \cdot 2}\\ \end{array}\]
    9. Applied simplify1.8

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

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\frac{a \cdot \left(c \cdot 4\right)}{\sqrt{(\left(-c\right) \cdot \left(a \cdot 4\right) + \left(b \cdot b\right))_*} - b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{(\left(a \cdot 4\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{a \cdot 2}\\ \end{array} \le -2.1205622766064206 \cdot 10^{+225} \lor \neg \left(\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\frac{a \cdot \left(c \cdot 4\right)}{\sqrt{(\left(-c\right) \cdot \left(a \cdot 4\right) + \left(b \cdot b\right))_*} - b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{(\left(a \cdot 4\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{a \cdot 2}\\ \end{array} \le 8.835097148549356 \cdot 10^{+217}\right):\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{(\left(a \cdot 4\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*} - b}{a \cdot 2}\\ \end{array}\\ \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{(\left(a \cdot 4\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\sqrt{(\left(a \cdot 4\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}} \cdot \sqrt{\left|\sqrt[3]{(\left(-c\right) \cdot \left(a \cdot 4\right) + \left(b \cdot b\right))_*}\right| \cdot \sqrt{\sqrt[3]{(\left(a \cdot 4\right) \cdot \left(-c\right) + \left(b \cdot b\right))_*}}} - b}{a \cdot 2}\\ \end{array}}\]

Runtime

Time bar (total: 51.1s)Debug logProfile

herbie shell --seed '#(1072840222 1305617769 1692503039 1353360431 4178980589 1488672652)' +o rules:numerics
(FPCore (a b c)
  :name "jeff quadratic root 2"
  (if (>= b 0) (/ (* 2 c) (- (- b) (sqrt (- (* b b) (* (* 4 a) c))))) (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a))))