Average Error: 19.7 → 12.7
Time: 19.1s
Precision: 64
\[\begin{array}{l} \mathbf{if}\;b \ge 0.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 2.483761596935852604855950950638505320376 \cdot 10^{130}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \ge 0.0:\\ \;\;\;\;\frac{\mathsf{fma}\left(-\left|\sqrt[3]{\mathsf{fma}\left(4, a \cdot \left(-c\right), b \cdot b\right)}\right|, \sqrt{\sqrt[3]{\mathsf{fma}\left(4, a \cdot \left(-c\right), b \cdot b\right)}}, -b\right) + \left|\sqrt[3]{\mathsf{fma}\left(4, a \cdot \left(-c\right), b \cdot b\right)}\right| \cdot \left(\left(-\sqrt{\sqrt[3]{\mathsf{fma}\left(4, a \cdot \left(-c\right), b \cdot b\right)}}\right) + \sqrt{\sqrt[3]{\mathsf{fma}\left(4, a \cdot \left(-c\right), b \cdot b\right)}}\right)}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\sqrt{\mathsf{fma}\left(4 \cdot a, -c, b \cdot b\right)} - b}\\ \end{array}\\ \mathbf{elif}\;b \ge 0.0:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{{\left(\frac{2}{\frac{\sqrt{\mathsf{fma}\left(4 \cdot a, -c, b \cdot b\right)} - b}{c}}\right)}^{3}}\\ \end{array}\]
\begin{array}{l}
\mathbf{if}\;b \ge 0.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 2.483761596935852604855950950638505320376 \cdot 10^{130}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \ge 0.0:\\
\;\;\;\;\frac{\mathsf{fma}\left(-\left|\sqrt[3]{\mathsf{fma}\left(4, a \cdot \left(-c\right), b \cdot b\right)}\right|, \sqrt{\sqrt[3]{\mathsf{fma}\left(4, a \cdot \left(-c\right), b \cdot b\right)}}, -b\right) + \left|\sqrt[3]{\mathsf{fma}\left(4, a \cdot \left(-c\right), b \cdot b\right)}\right| \cdot \left(\left(-\sqrt{\sqrt[3]{\mathsf{fma}\left(4, a \cdot \left(-c\right), b \cdot b\right)}}\right) + \sqrt{\sqrt[3]{\mathsf{fma}\left(4, a \cdot \left(-c\right), b \cdot b\right)}}\right)}{a \cdot 2}\\

\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot c}{\sqrt{\mathsf{fma}\left(4 \cdot a, -c, b \cdot b\right)} - b}\\

\end{array}\\

\mathbf{elif}\;b \ge 0.0:\\
\;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\

\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{\left(\frac{2}{\frac{\sqrt{\mathsf{fma}\left(4 \cdot a, -c, b \cdot b\right)} - b}{c}}\right)}^{3}}\\

\end{array}
double f(double a, double b, double c) {
        double r44105 = b;
        double r44106 = 0.0;
        bool r44107 = r44105 >= r44106;
        double r44108 = -r44105;
        double r44109 = r44105 * r44105;
        double r44110 = 4.0;
        double r44111 = a;
        double r44112 = r44110 * r44111;
        double r44113 = c;
        double r44114 = r44112 * r44113;
        double r44115 = r44109 - r44114;
        double r44116 = sqrt(r44115);
        double r44117 = r44108 - r44116;
        double r44118 = 2.0;
        double r44119 = r44118 * r44111;
        double r44120 = r44117 / r44119;
        double r44121 = r44118 * r44113;
        double r44122 = r44108 + r44116;
        double r44123 = r44121 / r44122;
        double r44124 = r44107 ? r44120 : r44123;
        return r44124;
}

double f(double a, double b, double c) {
        double r44125 = b;
        double r44126 = 2.4837615969358526e+130;
        bool r44127 = r44125 <= r44126;
        double r44128 = 0.0;
        bool r44129 = r44125 >= r44128;
        double r44130 = 4.0;
        double r44131 = a;
        double r44132 = c;
        double r44133 = -r44132;
        double r44134 = r44131 * r44133;
        double r44135 = r44125 * r44125;
        double r44136 = fma(r44130, r44134, r44135);
        double r44137 = cbrt(r44136);
        double r44138 = fabs(r44137);
        double r44139 = -r44138;
        double r44140 = sqrt(r44137);
        double r44141 = -r44125;
        double r44142 = fma(r44139, r44140, r44141);
        double r44143 = -r44140;
        double r44144 = r44143 + r44140;
        double r44145 = r44138 * r44144;
        double r44146 = r44142 + r44145;
        double r44147 = 2.0;
        double r44148 = r44131 * r44147;
        double r44149 = r44146 / r44148;
        double r44150 = r44147 * r44132;
        double r44151 = r44130 * r44131;
        double r44152 = fma(r44151, r44133, r44135);
        double r44153 = sqrt(r44152);
        double r44154 = r44153 - r44125;
        double r44155 = r44150 / r44154;
        double r44156 = r44129 ? r44149 : r44155;
        double r44157 = r44141 - r44125;
        double r44158 = r44157 / r44148;
        double r44159 = r44154 / r44132;
        double r44160 = r44147 / r44159;
        double r44161 = 3.0;
        double r44162 = pow(r44160, r44161);
        double r44163 = cbrt(r44162);
        double r44164 = r44129 ? r44158 : r44163;
        double r44165 = r44127 ? r44156 : r44164;
        return r44165;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Split input into 2 regimes
  2. if b < 2.4837615969358526e+130

    1. Initial program 14.1

      \[\begin{array}{l} \mathbf{if}\;b \ge 0.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. Simplified14.1

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0.0:\\ \;\;\;\;\frac{\left(-b\right) - \color{blue}{\sqrt{\sqrt[3]{\mathsf{fma}\left(4 \cdot a, -c, b \cdot b\right)} \cdot \sqrt[3]{\mathsf{fma}\left(4 \cdot a, -c, b \cdot b\right)}} \cdot \sqrt{\sqrt[3]{\mathsf{fma}\left(4 \cdot a, -c, b \cdot b\right)}}}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\sqrt{\mathsf{fma}\left(4 \cdot a, -c, b \cdot b\right)} - b}\\ \end{array}\]
    6. Applied add-sqr-sqrt35.0

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

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

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

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

    if 2.4837615969358526e+130 < b

    1. Initial program 56.2

      \[\begin{array}{l} \mathbf{if}\;b \ge 0.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. Simplified56.2

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0.0:\\ \;\;\;\;\frac{\left(-b\right) - \color{blue}{b}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\sqrt{\mathsf{fma}\left(4 \cdot a, -c, b \cdot b\right)} - b}\\ \end{array}\]
    4. Using strategy rm
    5. Applied add-cbrt-cube2.6

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0.0:\\ \;\;\;\;\frac{\left(-b\right) - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\color{blue}{\frac{2 \cdot c}{\sqrt[3]{\left(\left(\sqrt{\mathsf{fma}\left(4 \cdot a, -c, b \cdot b\right)} - b\right) \cdot \left(\sqrt{\mathsf{fma}\left(4 \cdot a, -c, b \cdot b\right)} - b\right)\right) \cdot \left(\sqrt{\mathsf{fma}\left(4 \cdot a, -c, b \cdot b\right)} - b\right)}}}\\ \end{array}\]
    6. Applied add-cbrt-cube2.6

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0.0:\\ \;\;\;\;\frac{\left(-b\right) - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot \sqrt[3]{\left(c \cdot c\right) \cdot c}}{\sqrt[3]{\left(\left(\sqrt{\mathsf{fma}\left(4 \cdot a, -c, b \cdot b\right)} - b\right) \cdot \left(\sqrt{\mathsf{fma}\left(4 \cdot a, -c, b \cdot b\right)} - b\right)\right) \cdot \left(\sqrt{\mathsf{fma}\left(4 \cdot a, -c, b \cdot b\right)} - b\right)}}\\ \end{array}\]
    7. Applied add-cbrt-cube2.6

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0.0:\\ \;\;\;\;\frac{\left(-b\right) - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{\left(2 \cdot 2\right) \cdot 2} \cdot \sqrt[3]{\left(c \cdot c\right) \cdot c}}{\sqrt[3]{\left(\left(\sqrt{\mathsf{fma}\left(4 \cdot a, -c, b \cdot b\right)} - b\right) \cdot \left(\sqrt{\mathsf{fma}\left(4 \cdot a, -c, b \cdot b\right)} - b\right)\right) \cdot \left(\sqrt{\mathsf{fma}\left(4 \cdot a, -c, b \cdot b\right)} - b\right)}}\\ \end{array}\]
    8. Applied cbrt-unprod2.6

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0.0:\\ \;\;\;\;\frac{\left(-b\right) - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{\left(\left(2 \cdot 2\right) \cdot 2\right) \cdot \left(\left(c \cdot c\right) \cdot c\right)}}{\sqrt[3]{\left(\left(\sqrt{\mathsf{fma}\left(4 \cdot a, -c, b \cdot b\right)} - b\right) \cdot \left(\sqrt{\mathsf{fma}\left(4 \cdot a, -c, b \cdot b\right)} - b\right)\right) \cdot \left(\sqrt{\mathsf{fma}\left(4 \cdot a, -c, b \cdot b\right)} - b\right)}}\\ \end{array}\]
    9. Applied cbrt-undiv2.6

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0.0:\\ \;\;\;\;\frac{\left(-b\right) - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\frac{\left(\left(2 \cdot 2\right) \cdot 2\right) \cdot \left(\left(c \cdot c\right) \cdot c\right)}{\left(\left(\sqrt{\mathsf{fma}\left(4 \cdot a, -c, b \cdot b\right)} - b\right) \cdot \left(\sqrt{\mathsf{fma}\left(4 \cdot a, -c, b \cdot b\right)} - b\right)\right) \cdot \left(\sqrt{\mathsf{fma}\left(4 \cdot a, -c, b \cdot b\right)} - b\right)}}\\ \end{array}\]
    10. Simplified2.6

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0.0:\\ \;\;\;\;\frac{\left(-b\right) - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{{\left(\frac{2}{\frac{\sqrt{\mathsf{fma}\left(a \cdot 4, -c, b \cdot b\right)} - b}{c}}\right)}^{3}}\\ \end{array}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification12.7

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

Reproduce

herbie shell --seed 2019174 +o rules:numerics
(FPCore (a b c)
  :name "jeff quadratic root 1"
  (if (>= b 0.0) (/ (- (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)) (/ (* 2.0 c) (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))))))