Average Error: 30.2 → 0.6
Time: 29.5s
Precision: 64
\[\sqrt[3]{x + 1} - \sqrt[3]{x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -936.9569164197162:\\ \;\;\;\;\mathsf{expm1}\left(\left(\mathsf{log1p}\left(\left(\frac{\mathsf{fma}\left(\left(\sqrt[3]{\frac{\frac{\frac{1}{x}}{x}}{x \cdot x}}\right), \frac{-1}{9}, \left(\mathsf{fma}\left(\frac{2}{3}, \left(\sqrt[3]{\frac{1}{x}}\right), \left(\sqrt[3]{\frac{1}{{x}^{7}}} \cdot \frac{4}{81}\right)\right)\right)\right)}{\sqrt[3]{x} + \sqrt[3]{1 + x}}\right)\right)\right)\right)\\ \mathbf{elif}\;x \le 3534.5334182162437:\\ \;\;\;\;\mathsf{fma}\left(\left(\sqrt[3]{\sqrt[3]{1 + x} \cdot \sqrt[3]{1 + x}}\right), \left(\sqrt[3]{\mathsf{log1p}\left(\left(\mathsf{expm1}\left(\left(\sqrt[3]{1 + x}\right)\right)\right)\right)}\right), \left(-\sqrt[3]{x}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{expm1}\left(\left(\mathsf{log1p}\left(\left(\frac{\mathsf{fma}\left(\left(\sqrt[3]{\frac{\frac{\frac{1}{x}}{x}}{x \cdot x}}\right), \frac{-1}{9}, \left(\mathsf{fma}\left(\frac{2}{3}, \left(\sqrt[3]{\frac{1}{x}}\right), \left(\sqrt[3]{\frac{1}{{x}^{7}}} \cdot \frac{4}{81}\right)\right)\right)\right)}{\sqrt[3]{x} + \sqrt[3]{1 + x}}\right)\right)\right)\right)\\ \end{array}\]
\sqrt[3]{x + 1} - \sqrt[3]{x}
\begin{array}{l}
\mathbf{if}\;x \le -936.9569164197162:\\
\;\;\;\;\mathsf{expm1}\left(\left(\mathsf{log1p}\left(\left(\frac{\mathsf{fma}\left(\left(\sqrt[3]{\frac{\frac{\frac{1}{x}}{x}}{x \cdot x}}\right), \frac{-1}{9}, \left(\mathsf{fma}\left(\frac{2}{3}, \left(\sqrt[3]{\frac{1}{x}}\right), \left(\sqrt[3]{\frac{1}{{x}^{7}}} \cdot \frac{4}{81}\right)\right)\right)\right)}{\sqrt[3]{x} + \sqrt[3]{1 + x}}\right)\right)\right)\right)\\

\mathbf{elif}\;x \le 3534.5334182162437:\\
\;\;\;\;\mathsf{fma}\left(\left(\sqrt[3]{\sqrt[3]{1 + x} \cdot \sqrt[3]{1 + x}}\right), \left(\sqrt[3]{\mathsf{log1p}\left(\left(\mathsf{expm1}\left(\left(\sqrt[3]{1 + x}\right)\right)\right)\right)}\right), \left(-\sqrt[3]{x}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{expm1}\left(\left(\mathsf{log1p}\left(\left(\frac{\mathsf{fma}\left(\left(\sqrt[3]{\frac{\frac{\frac{1}{x}}{x}}{x \cdot x}}\right), \frac{-1}{9}, \left(\mathsf{fma}\left(\frac{2}{3}, \left(\sqrt[3]{\frac{1}{x}}\right), \left(\sqrt[3]{\frac{1}{{x}^{7}}} \cdot \frac{4}{81}\right)\right)\right)\right)}{\sqrt[3]{x} + \sqrt[3]{1 + x}}\right)\right)\right)\right)\\

\end{array}
double f(double x) {
        double r4758385 = x;
        double r4758386 = 1.0;
        double r4758387 = r4758385 + r4758386;
        double r4758388 = cbrt(r4758387);
        double r4758389 = cbrt(r4758385);
        double r4758390 = r4758388 - r4758389;
        return r4758390;
}

double f(double x) {
        double r4758391 = x;
        double r4758392 = -936.9569164197162;
        bool r4758393 = r4758391 <= r4758392;
        double r4758394 = 1.0;
        double r4758395 = r4758394 / r4758391;
        double r4758396 = r4758395 / r4758391;
        double r4758397 = r4758391 * r4758391;
        double r4758398 = r4758396 / r4758397;
        double r4758399 = cbrt(r4758398);
        double r4758400 = -0.1111111111111111;
        double r4758401 = 0.6666666666666666;
        double r4758402 = cbrt(r4758395);
        double r4758403 = 7.0;
        double r4758404 = pow(r4758391, r4758403);
        double r4758405 = r4758394 / r4758404;
        double r4758406 = cbrt(r4758405);
        double r4758407 = 0.04938271604938271;
        double r4758408 = r4758406 * r4758407;
        double r4758409 = fma(r4758401, r4758402, r4758408);
        double r4758410 = fma(r4758399, r4758400, r4758409);
        double r4758411 = cbrt(r4758391);
        double r4758412 = r4758394 + r4758391;
        double r4758413 = cbrt(r4758412);
        double r4758414 = r4758411 + r4758413;
        double r4758415 = r4758410 / r4758414;
        double r4758416 = log1p(r4758415);
        double r4758417 = expm1(r4758416);
        double r4758418 = 3534.5334182162437;
        bool r4758419 = r4758391 <= r4758418;
        double r4758420 = r4758413 * r4758413;
        double r4758421 = cbrt(r4758420);
        double r4758422 = expm1(r4758413);
        double r4758423 = log1p(r4758422);
        double r4758424 = cbrt(r4758423);
        double r4758425 = -r4758411;
        double r4758426 = fma(r4758421, r4758424, r4758425);
        double r4758427 = r4758419 ? r4758426 : r4758417;
        double r4758428 = r4758393 ? r4758417 : r4758427;
        return r4758428;
}

Error

Bits error versus x

Derivation

  1. Split input into 2 regimes
  2. if x < -936.9569164197162 or 3534.5334182162437 < x

    1. Initial program 60.1

      \[\sqrt[3]{x + 1} - \sqrt[3]{x}\]
    2. Using strategy rm
    3. Applied expm1-log1p-u60.1

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\left(\mathsf{log1p}\left(\left(\sqrt[3]{x + 1} - \sqrt[3]{x}\right)\right)\right)\right)}\]
    4. Using strategy rm
    5. Applied flip--60.1

      \[\leadsto \mathsf{expm1}\left(\left(\mathsf{log1p}\left(\color{blue}{\left(\frac{\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1} - \sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{x + 1} + \sqrt[3]{x}}\right)}\right)\right)\right)\]
    6. Taylor expanded around inf 33.2

      \[\leadsto \mathsf{expm1}\left(\left(\mathsf{log1p}\left(\left(\frac{\color{blue}{\left(\frac{4}{81} \cdot {\left(\frac{1}{{x}^{7}}\right)}^{\frac{1}{3}} + \frac{2}{3} \cdot {\left(\frac{1}{x}\right)}^{\frac{1}{3}}\right) - \frac{1}{9} \cdot {\left(\frac{1}{{x}^{4}}\right)}^{\frac{1}{3}}}}{\sqrt[3]{x + 1} + \sqrt[3]{x}}\right)\right)\right)\right)\]
    7. Simplified1.0

      \[\leadsto \mathsf{expm1}\left(\left(\mathsf{log1p}\left(\left(\frac{\color{blue}{\mathsf{fma}\left(\left(\sqrt[3]{\frac{\frac{\frac{1}{x}}{x}}{x \cdot x}}\right), \frac{-1}{9}, \left(\mathsf{fma}\left(\frac{2}{3}, \left(\sqrt[3]{\frac{1}{x}}\right), \left(\sqrt[3]{\frac{1}{{x}^{7}}} \cdot \frac{4}{81}\right)\right)\right)\right)}}{\sqrt[3]{x + 1} + \sqrt[3]{x}}\right)\right)\right)\right)\]

    if -936.9569164197162 < x < 3534.5334182162437

    1. Initial program 0.1

      \[\sqrt[3]{x + 1} - \sqrt[3]{x}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt0.1

      \[\leadsto \sqrt[3]{\color{blue}{\left(\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}\right) \cdot \sqrt[3]{x + 1}}} - \sqrt[3]{x}\]
    4. Applied cbrt-prod0.1

      \[\leadsto \color{blue}{\sqrt[3]{\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}} \cdot \sqrt[3]{\sqrt[3]{x + 1}}} - \sqrt[3]{x}\]
    5. Applied fma-neg0.1

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\sqrt[3]{\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}}\right), \left(\sqrt[3]{\sqrt[3]{x + 1}}\right), \left(-\sqrt[3]{x}\right)\right)}\]
    6. Using strategy rm
    7. Applied log1p-expm1-u0.1

      \[\leadsto \mathsf{fma}\left(\left(\sqrt[3]{\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}}\right), \left(\sqrt[3]{\color{blue}{\mathsf{log1p}\left(\left(\mathsf{expm1}\left(\left(\sqrt[3]{x + 1}\right)\right)\right)\right)}}\right), \left(-\sqrt[3]{x}\right)\right)\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -936.9569164197162:\\ \;\;\;\;\mathsf{expm1}\left(\left(\mathsf{log1p}\left(\left(\frac{\mathsf{fma}\left(\left(\sqrt[3]{\frac{\frac{\frac{1}{x}}{x}}{x \cdot x}}\right), \frac{-1}{9}, \left(\mathsf{fma}\left(\frac{2}{3}, \left(\sqrt[3]{\frac{1}{x}}\right), \left(\sqrt[3]{\frac{1}{{x}^{7}}} \cdot \frac{4}{81}\right)\right)\right)\right)}{\sqrt[3]{x} + \sqrt[3]{1 + x}}\right)\right)\right)\right)\\ \mathbf{elif}\;x \le 3534.5334182162437:\\ \;\;\;\;\mathsf{fma}\left(\left(\sqrt[3]{\sqrt[3]{1 + x} \cdot \sqrt[3]{1 + x}}\right), \left(\sqrt[3]{\mathsf{log1p}\left(\left(\mathsf{expm1}\left(\left(\sqrt[3]{1 + x}\right)\right)\right)\right)}\right), \left(-\sqrt[3]{x}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{expm1}\left(\left(\mathsf{log1p}\left(\left(\frac{\mathsf{fma}\left(\left(\sqrt[3]{\frac{\frac{\frac{1}{x}}{x}}{x \cdot x}}\right), \frac{-1}{9}, \left(\mathsf{fma}\left(\frac{2}{3}, \left(\sqrt[3]{\frac{1}{x}}\right), \left(\sqrt[3]{\frac{1}{{x}^{7}}} \cdot \frac{4}{81}\right)\right)\right)\right)}{\sqrt[3]{x} + \sqrt[3]{1 + x}}\right)\right)\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019120 +o rules:numerics
(FPCore (x)
  :name "2cbrt (problem 3.3.4)"
  (- (cbrt (+ x 1)) (cbrt x)))