Average Error: 19.9 → 13.2
Time: 1.3m
Precision: 64
Internal Precision: 576
\[\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 -1.3988591990718065 \cdot 10^{+79}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{c \cdot \frac{a}{b} - b}\\ \end{array}\\ \mathbf{if}\;b \le -6.72181630224139 \cdot 10^{-288}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{\left(\sqrt[3]{\frac{c \cdot 2}{\frac{b}{a}}} \cdot \sqrt[3]{\frac{c \cdot 2}{\frac{b}{a}}}\right) \cdot \sqrt[3]{\frac{c \cdot 2}{\frac{b}{a}}} + \left(\left(-b\right) + \left(-b\right)\right)}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\sqrt{b \cdot b - \left(c \cdot 4\right) \cdot a} - b}\\ \end{array}\\ \mathbf{if}\;b \le 1.767513462817512 \cdot 10^{+131}:\\ \;\;\;\;\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}{\frac{c \cdot \left(a \cdot 4\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}\\ \end{array}\\ \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{c \cdot \frac{a}{b} - b}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Split input into 3 regimes
  2. if b < -1.3988591990718065e+79 or 1.767513462817512e+131 < b

    1. Initial program 37.2

      \[\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. Taylor expanded around -inf 22.5

      \[\leadsto \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}:\\ \;\;\;\;\color{blue}{\frac{2 \cdot c}{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}}\\ \end{array}\]
    3. Applied simplify20.0

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

    if -1.3988591990718065e+79 < b < -6.72181630224139e-288

    1. Initial program 8.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. Using strategy rm
    3. Applied add-sqr-sqrt8.8

      \[\leadsto \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}:\\ \;\;\;\;\color{blue}{\frac{2 \cdot c}{\sqrt{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} \cdot \sqrt{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}}\\ \end{array}\]
    4. Applied simplify8.8

      \[\leadsto \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{\color{blue}{2 \cdot c}}{\sqrt{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 4} - b} \cdot \sqrt{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}\\ \end{array}\]
    5. Applied simplify8.7

      \[\leadsto \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}{\color{blue}{\sqrt{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 4} - b} \cdot \sqrt{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 4} - b}}}\\ \end{array}\]
    6. Taylor expanded around inf 8.7

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

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

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

    if -6.72181630224139e-288 < b < 1.767513462817512e+131

    1. Initial program 9.2

      \[\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. Using strategy rm
    3. Applied flip-+9.2

      \[\leadsto \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}:\\ \;\;\;\;\color{blue}{\frac{2 \cdot c}{\frac{\left(-b\right) \cdot \left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}}\\ \end{array}\]
    4. Applied simplify9.2

      \[\leadsto \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{\color{blue}{2 \cdot c}}{\frac{c \cdot \left(a \cdot 4\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}\\ \end{array}\]
  3. Recombined 3 regimes into one program.

Runtime

Time bar (total: 1.3m)Debug logProfile

herbie shell --seed '#(1071119240 1686926585 3481876196 78132896 2080707795 3185793749)' 
(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)))))))