Average Error: 19.4 → 6.7
Time: 1.6m
Precision: 64
Internal Precision: 384
\[\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.627752103991625 \cdot 10^{+129}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}{a + a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\frac{a}{b} \cdot c - b}\\ \end{array}\\ \mathbf{if}\;b \le -5.9372574616144 \cdot 10^{-311}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{\frac{4 \cdot \left(a \cdot c\right)}{\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}\\ \mathbf{if}\;b \le 7.003102408185468 \cdot 10^{+118}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}{a + a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\frac{a}{b} \cdot c - b}\\ \end{array}\\ \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{\frac{c}{b}}{1} - \frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt[3]{\frac{c + c}{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} + \left(-b\right)}} \cdot \sqrt[3]{\frac{c + c}{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} + \left(-b\right)}}\right) \cdot \sqrt[3]{\frac{c + c}{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} + \left(-b\right)}}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Split input into 4 regimes
  2. if b < -1.627752103991625e+129

    1. Initial program 32.9

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

      \[\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)}}{a + a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\frac{a}{b} \cdot c - b}\\ \end{array}}\]

    if -1.627752103991625e+129 < b < -5.9372574616144e-311

    1. Initial program 9.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. Using strategy rm
    3. Applied flip--9.3

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{\color{blue}{\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}}}}{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}\]
    4. Applied simplify9.3

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{\frac{\color{blue}{4 \cdot \left(a \cdot c\right)}}{\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}\]

    if -5.9372574616144e-311 < b < 7.003102408185468e+118

    1. Initial program 8.7

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

      \[\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)}}{a + a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\frac{a}{b} \cdot c - b}\\ \end{array}}\]

    if 7.003102408185468e+118 < b

    1. Initial program 49.5

      \[\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 9.9

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{\color{blue}{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}}{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}\]
    3. Applied simplify3.0

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

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

Runtime

Time bar (total: 1.6m)Debug logProfile

herbie shell --seed '#(1063282112 2455465480 4141627379 3773598652 1647277307 776739644)' 
(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)))))))