2cbrt (problem 3.3.4)

Percentage Accurate: 53.7% → 99.2%
Time: 12.2s
Alternatives: 8
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \sqrt[3]{x + 1} - \sqrt[3]{x} \end{array} \]
(FPCore (x) :precision binary64 (- (cbrt (+ x 1.0)) (cbrt x)))
double code(double x) {
	return cbrt((x + 1.0)) - cbrt(x);
}
public static double code(double x) {
	return Math.cbrt((x + 1.0)) - Math.cbrt(x);
}
function code(x)
	return Float64(cbrt(Float64(x + 1.0)) - cbrt(x))
end
code[x_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\sqrt[3]{x + 1} - \sqrt[3]{x}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 8 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 53.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \sqrt[3]{x + 1} - \sqrt[3]{x} \end{array} \]
(FPCore (x) :precision binary64 (- (cbrt (+ x 1.0)) (cbrt x)))
double code(double x) {
	return cbrt((x + 1.0)) - cbrt(x);
}
public static double code(double x) {
	return Math.cbrt((x + 1.0)) - Math.cbrt(x);
}
function code(x)
	return Float64(cbrt(Float64(x + 1.0)) - cbrt(x))
end
code[x_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\sqrt[3]{x + 1} - \sqrt[3]{x}
\end{array}

Alternative 1: 99.2% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt[3]{1 + x}\\ \frac{1 + \left(x - x\right)}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + t_0, {t_0}^{2}\right)} \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (cbrt (+ 1.0 x))))
   (/ (+ 1.0 (- x x)) (fma (cbrt x) (+ (cbrt x) t_0) (pow t_0 2.0)))))
double code(double x) {
	double t_0 = cbrt((1.0 + x));
	return (1.0 + (x - x)) / fma(cbrt(x), (cbrt(x) + t_0), pow(t_0, 2.0));
}
function code(x)
	t_0 = cbrt(Float64(1.0 + x))
	return Float64(Float64(1.0 + Float64(x - x)) / fma(cbrt(x), Float64(cbrt(x) + t_0), (t_0 ^ 2.0)))
end
code[x_] := Block[{t$95$0 = N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]}, N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + t$95$0), $MachinePrecision] + N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
\frac{1 + \left(x - x\right)}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + t_0, {t_0}^{2}\right)}
\end{array}
\end{array}
Derivation
  1. Initial program 52.5%

    \[\sqrt[3]{x + 1} - \sqrt[3]{x} \]
  2. Step-by-step derivation
    1. pow1/324.6%

      \[\leadsto \sqrt[3]{x + 1} - \color{blue}{{x}^{0.3333333333333333}} \]
  3. Applied egg-rr24.6%

    \[\leadsto \sqrt[3]{x + 1} - \color{blue}{{x}^{0.3333333333333333}} \]
  4. Applied egg-rr53.2%

    \[\leadsto \color{blue}{\left(\left(x + 1\right) - x\right) \cdot \frac{1}{{\left(\sqrt[3]{x + 1}\right)}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{x + 1} + \sqrt[3]{x}\right)}} \]
  5. Step-by-step derivation
    1. associate-*r/53.2%

      \[\leadsto \color{blue}{\frac{\left(\left(x + 1\right) - x\right) \cdot 1}{{\left(\sqrt[3]{x + 1}\right)}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{x + 1} + \sqrt[3]{x}\right)}} \]
    2. *-rgt-identity53.2%

      \[\leadsto \frac{\color{blue}{\left(x + 1\right) - x}}{{\left(\sqrt[3]{x + 1}\right)}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{x + 1} + \sqrt[3]{x}\right)} \]
    3. +-commutative53.2%

      \[\leadsto \frac{\color{blue}{\left(1 + x\right)} - x}{{\left(\sqrt[3]{x + 1}\right)}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{x + 1} + \sqrt[3]{x}\right)} \]
    4. associate--l+99.1%

      \[\leadsto \frac{\color{blue}{1 + \left(x - x\right)}}{{\left(\sqrt[3]{x + 1}\right)}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{x + 1} + \sqrt[3]{x}\right)} \]
    5. +-commutative99.1%

      \[\leadsto \frac{1 + \left(x - x\right)}{\color{blue}{\sqrt[3]{x} \cdot \left(\sqrt[3]{x + 1} + \sqrt[3]{x}\right) + {\left(\sqrt[3]{x + 1}\right)}^{2}}} \]
    6. fma-def99.1%

      \[\leadsto \frac{1 + \left(x - x\right)}{\color{blue}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, {\left(\sqrt[3]{x + 1}\right)}^{2}\right)}} \]
    7. +-commutative99.1%

      \[\leadsto \frac{1 + \left(x - x\right)}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{\color{blue}{1 + x}} + \sqrt[3]{x}, {\left(\sqrt[3]{x + 1}\right)}^{2}\right)} \]
    8. +-commutative99.1%

      \[\leadsto \frac{1 + \left(x - x\right)}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{1 + x} + \sqrt[3]{x}, {\left(\sqrt[3]{\color{blue}{1 + x}}\right)}^{2}\right)} \]
  6. Simplified99.1%

    \[\leadsto \color{blue}{\frac{1 + \left(x - x\right)}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{1 + x} + \sqrt[3]{x}, {\left(\sqrt[3]{1 + x}\right)}^{2}\right)}} \]
  7. Final simplification99.1%

    \[\leadsto \frac{1 + \left(x - x\right)}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, {\left(\sqrt[3]{1 + x}\right)}^{2}\right)} \]

Alternative 2: 99.1% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt[3]{1 + x}\\ \mathbf{if}\;t_0 - \sqrt[3]{x} \leq 5 \cdot 10^{-11}:\\ \;\;\;\;\frac{1}{\sqrt[3]{x} \cdot \left(t_0 + \sqrt[3]{x} \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{{\left(\sqrt[3]{x} + t_0\right)}^{2} - \sqrt[3]{x \cdot \left(1 + x\right)}}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (cbrt (+ 1.0 x))))
   (if (<= (- t_0 (cbrt x)) 5e-11)
     (/ 1.0 (* (cbrt x) (+ t_0 (* (cbrt x) 2.0))))
     (/ 1.0 (- (pow (+ (cbrt x) t_0) 2.0) (cbrt (* x (+ 1.0 x))))))))
double code(double x) {
	double t_0 = cbrt((1.0 + x));
	double tmp;
	if ((t_0 - cbrt(x)) <= 5e-11) {
		tmp = 1.0 / (cbrt(x) * (t_0 + (cbrt(x) * 2.0)));
	} else {
		tmp = 1.0 / (pow((cbrt(x) + t_0), 2.0) - cbrt((x * (1.0 + x))));
	}
	return tmp;
}
public static double code(double x) {
	double t_0 = Math.cbrt((1.0 + x));
	double tmp;
	if ((t_0 - Math.cbrt(x)) <= 5e-11) {
		tmp = 1.0 / (Math.cbrt(x) * (t_0 + (Math.cbrt(x) * 2.0)));
	} else {
		tmp = 1.0 / (Math.pow((Math.cbrt(x) + t_0), 2.0) - Math.cbrt((x * (1.0 + x))));
	}
	return tmp;
}
function code(x)
	t_0 = cbrt(Float64(1.0 + x))
	tmp = 0.0
	if (Float64(t_0 - cbrt(x)) <= 5e-11)
		tmp = Float64(1.0 / Float64(cbrt(x) * Float64(t_0 + Float64(cbrt(x) * 2.0))));
	else
		tmp = Float64(1.0 / Float64((Float64(cbrt(x) + t_0) ^ 2.0) - cbrt(Float64(x * Float64(1.0 + x)))));
	end
	return tmp
end
code[x_] := Block[{t$95$0 = N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]}, If[LessEqual[N[(t$95$0 - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision], 5e-11], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(t$95$0 + N[(N[Power[x, 1/3], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Power[N[(N[Power[x, 1/3], $MachinePrecision] + t$95$0), $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[(x * N[(1.0 + x), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
\mathbf{if}\;t_0 - \sqrt[3]{x} \leq 5 \cdot 10^{-11}:\\
\;\;\;\;\frac{1}{\sqrt[3]{x} \cdot \left(t_0 + \sqrt[3]{x} \cdot 2\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{{\left(\sqrt[3]{x} + t_0\right)}^{2} - \sqrt[3]{x \cdot \left(1 + x\right)}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) < 5.00000000000000018e-11

    1. Initial program 4.3%

      \[\sqrt[3]{x + 1} - \sqrt[3]{x} \]
    2. Step-by-step derivation
      1. flip3--4.3%

        \[\leadsto \color{blue}{\frac{{\left(\sqrt[3]{x + 1}\right)}^{3} - {\left(\sqrt[3]{x}\right)}^{3}}{\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1} + \left(\sqrt[3]{x} \cdot \sqrt[3]{x} + \sqrt[3]{x + 1} \cdot \sqrt[3]{x}\right)}} \]
      2. div-inv4.3%

        \[\leadsto \color{blue}{\left({\left(\sqrt[3]{x + 1}\right)}^{3} - {\left(\sqrt[3]{x}\right)}^{3}\right) \cdot \frac{1}{\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1} + \left(\sqrt[3]{x} \cdot \sqrt[3]{x} + \sqrt[3]{x + 1} \cdot \sqrt[3]{x}\right)}} \]
      3. rem-cube-cbrt3.9%

        \[\leadsto \left(\color{blue}{\left(x + 1\right)} - {\left(\sqrt[3]{x}\right)}^{3}\right) \cdot \frac{1}{\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1} + \left(\sqrt[3]{x} \cdot \sqrt[3]{x} + \sqrt[3]{x + 1} \cdot \sqrt[3]{x}\right)} \]
      4. rem-cube-cbrt4.3%

        \[\leadsto \left(\left(x + 1\right) - \color{blue}{x}\right) \cdot \frac{1}{\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1} + \left(\sqrt[3]{x} \cdot \sqrt[3]{x} + \sqrt[3]{x + 1} \cdot \sqrt[3]{x}\right)} \]
      5. +-commutative4.3%

        \[\leadsto \left(\left(x + 1\right) - x\right) \cdot \frac{1}{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x} + \sqrt[3]{x + 1} \cdot \sqrt[3]{x}\right) + \sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}}} \]
      6. distribute-rgt-out4.3%

        \[\leadsto \left(\left(x + 1\right) - x\right) \cdot \frac{1}{\color{blue}{\sqrt[3]{x} \cdot \left(\sqrt[3]{x} + \sqrt[3]{x + 1}\right)} + \sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}} \]
      7. +-commutative4.3%

        \[\leadsto \left(\left(x + 1\right) - x\right) \cdot \frac{1}{\sqrt[3]{x} \cdot \color{blue}{\left(\sqrt[3]{x + 1} + \sqrt[3]{x}\right)} + \sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}} \]
      8. fma-def4.3%

        \[\leadsto \left(\left(x + 1\right) - x\right) \cdot \frac{1}{\color{blue}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, \sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}\right)}} \]
      9. add-exp-log4.3%

        \[\leadsto \left(\left(x + 1\right) - x\right) \cdot \frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, \color{blue}{e^{\log \left(\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}\right)}}\right)} \]
    3. Applied egg-rr2.3%

      \[\leadsto \color{blue}{\left(\left(x + 1\right) - x\right) \cdot \frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)}} \]
    4. Step-by-step derivation
      1. associate-*r/2.3%

        \[\leadsto \color{blue}{\frac{\left(\left(x + 1\right) - x\right) \cdot 1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)}} \]
      2. *-rgt-identity2.3%

        \[\leadsto \frac{\color{blue}{\left(x + 1\right) - x}}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)} \]
      3. +-commutative2.3%

        \[\leadsto \frac{\color{blue}{\left(1 + x\right)} - x}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)} \]
      4. associate--l+47.8%

        \[\leadsto \frac{\color{blue}{1 + \left(x - x\right)}}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)} \]
      5. +-inverses47.8%

        \[\leadsto \frac{1 + \color{blue}{0}}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)} \]
      6. metadata-eval47.8%

        \[\leadsto \frac{\color{blue}{1}}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)} \]
      7. +-commutative47.8%

        \[\leadsto \frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{\color{blue}{1 + x}} + \sqrt[3]{x}, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)} \]
      8. exp-prod47.2%

        \[\leadsto \frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{1 + x} + \sqrt[3]{x}, \color{blue}{{\left(e^{0.6666666666666666}\right)}^{\left(\mathsf{log1p}\left(x\right)\right)}}\right)} \]
    5. Simplified47.2%

      \[\leadsto \color{blue}{\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{1 + x} + \sqrt[3]{x}, {\left(e^{0.6666666666666666}\right)}^{\left(\mathsf{log1p}\left(x\right)\right)}\right)}} \]
    6. Taylor expanded in x around inf 46.3%

      \[\leadsto \frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{1 + x} + \sqrt[3]{x}, \color{blue}{{\left({x}^{2}\right)}^{0.3333333333333333}}\right)} \]
    7. Step-by-step derivation
      1. expm1-log1p-u46.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{1 + x} + \sqrt[3]{x}, {\left({x}^{2}\right)}^{0.3333333333333333}\right)}\right)\right)} \]
      2. expm1-udef5.5%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{1 + x} + \sqrt[3]{x}, {\left({x}^{2}\right)}^{0.3333333333333333}\right)}\right)} - 1} \]
      3. +-commutative5.5%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \color{blue}{\sqrt[3]{x} + \sqrt[3]{1 + x}}, {\left({x}^{2}\right)}^{0.3333333333333333}\right)}\right)} - 1 \]
      4. unpow1/35.5%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, \color{blue}{\sqrt[3]{{x}^{2}}}\right)}\right)} - 1 \]
      5. unpow25.5%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, \sqrt[3]{\color{blue}{x \cdot x}}\right)}\right)} - 1 \]
      6. cbrt-prod5.5%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, \color{blue}{\sqrt[3]{x} \cdot \sqrt[3]{x}}\right)}\right)} - 1 \]
      7. pow25.5%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, \color{blue}{{\left(\sqrt[3]{x}\right)}^{2}}\right)}\right)} - 1 \]
    8. Applied egg-rr5.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, {\left(\sqrt[3]{x}\right)}^{2}\right)}\right)} - 1} \]
    9. Step-by-step derivation
      1. expm1-def98.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, {\left(\sqrt[3]{x}\right)}^{2}\right)}\right)\right)} \]
      2. expm1-log1p98.5%

        \[\leadsto \color{blue}{\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, {\left(\sqrt[3]{x}\right)}^{2}\right)}} \]
      3. fma-udef98.4%

        \[\leadsto \frac{1}{\color{blue}{\sqrt[3]{x} \cdot \left(\sqrt[3]{x} + \sqrt[3]{1 + x}\right) + {\left(\sqrt[3]{x}\right)}^{2}}} \]
      4. unpow298.4%

        \[\leadsto \frac{1}{\sqrt[3]{x} \cdot \left(\sqrt[3]{x} + \sqrt[3]{1 + x}\right) + \color{blue}{\sqrt[3]{x} \cdot \sqrt[3]{x}}} \]
      5. distribute-lft-out98.4%

        \[\leadsto \frac{1}{\color{blue}{\sqrt[3]{x} \cdot \left(\left(\sqrt[3]{x} + \sqrt[3]{1 + x}\right) + \sqrt[3]{x}\right)}} \]
      6. +-commutative98.4%

        \[\leadsto \frac{1}{\sqrt[3]{x} \cdot \left(\color{blue}{\left(\sqrt[3]{1 + x} + \sqrt[3]{x}\right)} + \sqrt[3]{x}\right)} \]
      7. associate-+r+98.4%

        \[\leadsto \frac{1}{\sqrt[3]{x} \cdot \color{blue}{\left(\sqrt[3]{1 + x} + \left(\sqrt[3]{x} + \sqrt[3]{x}\right)\right)}} \]
      8. count-298.4%

        \[\leadsto \frac{1}{\sqrt[3]{x} \cdot \left(\sqrt[3]{1 + x} + \color{blue}{2 \cdot \sqrt[3]{x}}\right)} \]
    10. Simplified98.4%

      \[\leadsto \color{blue}{\frac{1}{\sqrt[3]{x} \cdot \left(\sqrt[3]{1 + x} + 2 \cdot \sqrt[3]{x}\right)}} \]

    if 5.00000000000000018e-11 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x))

    1. Initial program 98.5%

      \[\sqrt[3]{x + 1} - \sqrt[3]{x} \]
    2. Step-by-step derivation
      1. pow1/397.3%

        \[\leadsto \color{blue}{{\left(x + 1\right)}^{0.3333333333333333}} - \sqrt[3]{x} \]
    3. Applied egg-rr97.3%

      \[\leadsto \color{blue}{{\left(x + 1\right)}^{0.3333333333333333}} - \sqrt[3]{x} \]
    4. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{1}{{\left(\sqrt[3]{x} + \sqrt[3]{1 + x}\right)}^{2} - \sqrt[3]{\left(1 + x\right) \cdot x}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\sqrt[3]{1 + x} - \sqrt[3]{x} \leq 5 \cdot 10^{-11}:\\ \;\;\;\;\frac{1}{\sqrt[3]{x} \cdot \left(\sqrt[3]{1 + x} + \sqrt[3]{x} \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{{\left(\sqrt[3]{x} + \sqrt[3]{1 + x}\right)}^{2} - \sqrt[3]{x \cdot \left(1 + x\right)}}\\ \end{array} \]

Alternative 3: 98.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt[3]{1 + x}\\ t_1 := t_0 - \sqrt[3]{x}\\ \mathbf{if}\;t_1 \leq 2 \cdot 10^{-6}:\\ \;\;\;\;\frac{1}{\sqrt[3]{x} \cdot \left(t_0 + \sqrt[3]{x} \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;e^{\log t_1}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (cbrt (+ 1.0 x))) (t_1 (- t_0 (cbrt x))))
   (if (<= t_1 2e-6)
     (/ 1.0 (* (cbrt x) (+ t_0 (* (cbrt x) 2.0))))
     (exp (log t_1)))))
double code(double x) {
	double t_0 = cbrt((1.0 + x));
	double t_1 = t_0 - cbrt(x);
	double tmp;
	if (t_1 <= 2e-6) {
		tmp = 1.0 / (cbrt(x) * (t_0 + (cbrt(x) * 2.0)));
	} else {
		tmp = exp(log(t_1));
	}
	return tmp;
}
public static double code(double x) {
	double t_0 = Math.cbrt((1.0 + x));
	double t_1 = t_0 - Math.cbrt(x);
	double tmp;
	if (t_1 <= 2e-6) {
		tmp = 1.0 / (Math.cbrt(x) * (t_0 + (Math.cbrt(x) * 2.0)));
	} else {
		tmp = Math.exp(Math.log(t_1));
	}
	return tmp;
}
function code(x)
	t_0 = cbrt(Float64(1.0 + x))
	t_1 = Float64(t_0 - cbrt(x))
	tmp = 0.0
	if (t_1 <= 2e-6)
		tmp = Float64(1.0 / Float64(cbrt(x) * Float64(t_0 + Float64(cbrt(x) * 2.0))));
	else
		tmp = exp(log(t_1));
	end
	return tmp
end
code[x_] := Block[{t$95$0 = N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e-6], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(t$95$0 + N[(N[Power[x, 1/3], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Exp[N[Log[t$95$1], $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
t_1 := t_0 - \sqrt[3]{x}\\
\mathbf{if}\;t_1 \leq 2 \cdot 10^{-6}:\\
\;\;\;\;\frac{1}{\sqrt[3]{x} \cdot \left(t_0 + \sqrt[3]{x} \cdot 2\right)}\\

\mathbf{else}:\\
\;\;\;\;e^{\log t_1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) < 1.99999999999999991e-6

    1. Initial program 5.1%

      \[\sqrt[3]{x + 1} - \sqrt[3]{x} \]
    2. Step-by-step derivation
      1. flip3--5.3%

        \[\leadsto \color{blue}{\frac{{\left(\sqrt[3]{x + 1}\right)}^{3} - {\left(\sqrt[3]{x}\right)}^{3}}{\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1} + \left(\sqrt[3]{x} \cdot \sqrt[3]{x} + \sqrt[3]{x + 1} \cdot \sqrt[3]{x}\right)}} \]
      2. div-inv5.3%

        \[\leadsto \color{blue}{\left({\left(\sqrt[3]{x + 1}\right)}^{3} - {\left(\sqrt[3]{x}\right)}^{3}\right) \cdot \frac{1}{\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1} + \left(\sqrt[3]{x} \cdot \sqrt[3]{x} + \sqrt[3]{x + 1} \cdot \sqrt[3]{x}\right)}} \]
      3. rem-cube-cbrt5.0%

        \[\leadsto \left(\color{blue}{\left(x + 1\right)} - {\left(\sqrt[3]{x}\right)}^{3}\right) \cdot \frac{1}{\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1} + \left(\sqrt[3]{x} \cdot \sqrt[3]{x} + \sqrt[3]{x + 1} \cdot \sqrt[3]{x}\right)} \]
      4. rem-cube-cbrt5.8%

        \[\leadsto \left(\left(x + 1\right) - \color{blue}{x}\right) \cdot \frac{1}{\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1} + \left(\sqrt[3]{x} \cdot \sqrt[3]{x} + \sqrt[3]{x + 1} \cdot \sqrt[3]{x}\right)} \]
      5. +-commutative5.8%

        \[\leadsto \left(\left(x + 1\right) - x\right) \cdot \frac{1}{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x} + \sqrt[3]{x + 1} \cdot \sqrt[3]{x}\right) + \sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}}} \]
      6. distribute-rgt-out5.8%

        \[\leadsto \left(\left(x + 1\right) - x\right) \cdot \frac{1}{\color{blue}{\sqrt[3]{x} \cdot \left(\sqrt[3]{x} + \sqrt[3]{x + 1}\right)} + \sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}} \]
      7. +-commutative5.8%

        \[\leadsto \left(\left(x + 1\right) - x\right) \cdot \frac{1}{\sqrt[3]{x} \cdot \color{blue}{\left(\sqrt[3]{x + 1} + \sqrt[3]{x}\right)} + \sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}} \]
      8. fma-def5.8%

        \[\leadsto \left(\left(x + 1\right) - x\right) \cdot \frac{1}{\color{blue}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, \sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}\right)}} \]
      9. add-exp-log5.8%

        \[\leadsto \left(\left(x + 1\right) - x\right) \cdot \frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, \color{blue}{e^{\log \left(\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}\right)}}\right)} \]
    3. Applied egg-rr3.8%

      \[\leadsto \color{blue}{\left(\left(x + 1\right) - x\right) \cdot \frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)}} \]
    4. Step-by-step derivation
      1. associate-*r/3.8%

        \[\leadsto \color{blue}{\frac{\left(\left(x + 1\right) - x\right) \cdot 1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)}} \]
      2. *-rgt-identity3.8%

        \[\leadsto \frac{\color{blue}{\left(x + 1\right) - x}}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)} \]
      3. +-commutative3.8%

        \[\leadsto \frac{\color{blue}{\left(1 + x\right)} - x}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)} \]
      4. associate--l+48.6%

        \[\leadsto \frac{\color{blue}{1 + \left(x - x\right)}}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)} \]
      5. +-inverses48.6%

        \[\leadsto \frac{1 + \color{blue}{0}}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)} \]
      6. metadata-eval48.6%

        \[\leadsto \frac{\color{blue}{1}}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)} \]
      7. +-commutative48.6%

        \[\leadsto \frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{\color{blue}{1 + x}} + \sqrt[3]{x}, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)} \]
      8. exp-prod48.0%

        \[\leadsto \frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{1 + x} + \sqrt[3]{x}, \color{blue}{{\left(e^{0.6666666666666666}\right)}^{\left(\mathsf{log1p}\left(x\right)\right)}}\right)} \]
    5. Simplified48.0%

      \[\leadsto \color{blue}{\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{1 + x} + \sqrt[3]{x}, {\left(e^{0.6666666666666666}\right)}^{\left(\mathsf{log1p}\left(x\right)\right)}\right)}} \]
    6. Taylor expanded in x around inf 46.7%

      \[\leadsto \frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{1 + x} + \sqrt[3]{x}, \color{blue}{{\left({x}^{2}\right)}^{0.3333333333333333}}\right)} \]
    7. Step-by-step derivation
      1. expm1-log1p-u46.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{1 + x} + \sqrt[3]{x}, {\left({x}^{2}\right)}^{0.3333333333333333}\right)}\right)\right)} \]
      2. expm1-udef6.4%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{1 + x} + \sqrt[3]{x}, {\left({x}^{2}\right)}^{0.3333333333333333}\right)}\right)} - 1} \]
      3. +-commutative6.4%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \color{blue}{\sqrt[3]{x} + \sqrt[3]{1 + x}}, {\left({x}^{2}\right)}^{0.3333333333333333}\right)}\right)} - 1 \]
      4. unpow1/36.4%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, \color{blue}{\sqrt[3]{{x}^{2}}}\right)}\right)} - 1 \]
      5. unpow26.4%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, \sqrt[3]{\color{blue}{x \cdot x}}\right)}\right)} - 1 \]
      6. cbrt-prod6.4%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, \color{blue}{\sqrt[3]{x} \cdot \sqrt[3]{x}}\right)}\right)} - 1 \]
      7. pow26.4%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, \color{blue}{{\left(\sqrt[3]{x}\right)}^{2}}\right)}\right)} - 1 \]
    8. Applied egg-rr6.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, {\left(\sqrt[3]{x}\right)}^{2}\right)}\right)} - 1} \]
    9. Step-by-step derivation
      1. expm1-def98.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, {\left(\sqrt[3]{x}\right)}^{2}\right)}\right)\right)} \]
      2. expm1-log1p98.0%

        \[\leadsto \color{blue}{\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, {\left(\sqrt[3]{x}\right)}^{2}\right)}} \]
      3. fma-udef98.0%

        \[\leadsto \frac{1}{\color{blue}{\sqrt[3]{x} \cdot \left(\sqrt[3]{x} + \sqrt[3]{1 + x}\right) + {\left(\sqrt[3]{x}\right)}^{2}}} \]
      4. unpow298.0%

        \[\leadsto \frac{1}{\sqrt[3]{x} \cdot \left(\sqrt[3]{x} + \sqrt[3]{1 + x}\right) + \color{blue}{\sqrt[3]{x} \cdot \sqrt[3]{x}}} \]
      5. distribute-lft-out97.9%

        \[\leadsto \frac{1}{\color{blue}{\sqrt[3]{x} \cdot \left(\left(\sqrt[3]{x} + \sqrt[3]{1 + x}\right) + \sqrt[3]{x}\right)}} \]
      6. +-commutative97.9%

        \[\leadsto \frac{1}{\sqrt[3]{x} \cdot \left(\color{blue}{\left(\sqrt[3]{1 + x} + \sqrt[3]{x}\right)} + \sqrt[3]{x}\right)} \]
      7. associate-+r+97.9%

        \[\leadsto \frac{1}{\sqrt[3]{x} \cdot \color{blue}{\left(\sqrt[3]{1 + x} + \left(\sqrt[3]{x} + \sqrt[3]{x}\right)\right)}} \]
      8. count-297.9%

        \[\leadsto \frac{1}{\sqrt[3]{x} \cdot \left(\sqrt[3]{1 + x} + \color{blue}{2 \cdot \sqrt[3]{x}}\right)} \]
    10. Simplified97.9%

      \[\leadsto \color{blue}{\frac{1}{\sqrt[3]{x} \cdot \left(\sqrt[3]{1 + x} + 2 \cdot \sqrt[3]{x}\right)}} \]

    if 1.99999999999999991e-6 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x))

    1. Initial program 99.2%

      \[\sqrt[3]{x + 1} - \sqrt[3]{x} \]
    2. Step-by-step derivation
      1. add-exp-log99.2%

        \[\leadsto \color{blue}{e^{\log \left(\sqrt[3]{x + 1} - \sqrt[3]{x}\right)}} \]
    3. Applied egg-rr99.2%

      \[\leadsto \color{blue}{e^{\log \left(\sqrt[3]{x + 1} - \sqrt[3]{x}\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\sqrt[3]{1 + x} - \sqrt[3]{x} \leq 2 \cdot 10^{-6}:\\ \;\;\;\;\frac{1}{\sqrt[3]{x} \cdot \left(\sqrt[3]{1 + x} + \sqrt[3]{x} \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;e^{\log \left(\sqrt[3]{1 + x} - \sqrt[3]{x}\right)}\\ \end{array} \]

Alternative 4: 99.2% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt[3]{1 + x}\\ \frac{1 + \left(x - x\right)}{{t_0}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{x} + t_0\right)} \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (cbrt (+ 1.0 x))))
   (/ (+ 1.0 (- x x)) (+ (pow t_0 2.0) (* (cbrt x) (+ (cbrt x) t_0))))))
double code(double x) {
	double t_0 = cbrt((1.0 + x));
	return (1.0 + (x - x)) / (pow(t_0, 2.0) + (cbrt(x) * (cbrt(x) + t_0)));
}
public static double code(double x) {
	double t_0 = Math.cbrt((1.0 + x));
	return (1.0 + (x - x)) / (Math.pow(t_0, 2.0) + (Math.cbrt(x) * (Math.cbrt(x) + t_0)));
}
function code(x)
	t_0 = cbrt(Float64(1.0 + x))
	return Float64(Float64(1.0 + Float64(x - x)) / Float64((t_0 ^ 2.0) + Float64(cbrt(x) * Float64(cbrt(x) + t_0))))
end
code[x_] := Block[{t$95$0 = N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]}, N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Power[t$95$0, 2.0], $MachinePrecision] + N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
\frac{1 + \left(x - x\right)}{{t_0}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{x} + t_0\right)}
\end{array}
\end{array}
Derivation
  1. Initial program 52.5%

    \[\sqrt[3]{x + 1} - \sqrt[3]{x} \]
  2. Step-by-step derivation
    1. pow1/324.6%

      \[\leadsto \sqrt[3]{x + 1} - \color{blue}{{x}^{0.3333333333333333}} \]
  3. Applied egg-rr24.6%

    \[\leadsto \sqrt[3]{x + 1} - \color{blue}{{x}^{0.3333333333333333}} \]
  4. Applied egg-rr53.2%

    \[\leadsto \color{blue}{\frac{\left(x + 1\right) - x}{{\left(\sqrt[3]{x + 1}\right)}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{x + 1} + \sqrt[3]{x}\right)}} \]
  5. Step-by-step derivation
    1. +-commutative53.2%

      \[\leadsto \frac{\color{blue}{\left(1 + x\right)} - x}{{\left(\sqrt[3]{x + 1}\right)}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{x + 1} + \sqrt[3]{x}\right)} \]
    2. associate--l+99.1%

      \[\leadsto \frac{\color{blue}{1 + \left(x - x\right)}}{{\left(\sqrt[3]{x + 1}\right)}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{x + 1} + \sqrt[3]{x}\right)} \]
  6. Applied egg-rr99.1%

    \[\leadsto \frac{\color{blue}{1 + \left(x - x\right)}}{{\left(\sqrt[3]{x + 1}\right)}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{x + 1} + \sqrt[3]{x}\right)} \]
  7. Final simplification99.1%

    \[\leadsto \frac{1 + \left(x - x\right)}{{\left(\sqrt[3]{1 + x}\right)}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{x} + \sqrt[3]{1 + x}\right)} \]

Alternative 5: 98.7% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt[3]{1 + x}\\ t_1 := t_0 - \sqrt[3]{x}\\ \mathbf{if}\;t_1 \leq 2 \cdot 10^{-6}:\\ \;\;\;\;\frac{1}{\sqrt[3]{x} \cdot \left(t_0 + \sqrt[3]{x} \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (cbrt (+ 1.0 x))) (t_1 (- t_0 (cbrt x))))
   (if (<= t_1 2e-6) (/ 1.0 (* (cbrt x) (+ t_0 (* (cbrt x) 2.0)))) t_1)))
double code(double x) {
	double t_0 = cbrt((1.0 + x));
	double t_1 = t_0 - cbrt(x);
	double tmp;
	if (t_1 <= 2e-6) {
		tmp = 1.0 / (cbrt(x) * (t_0 + (cbrt(x) * 2.0)));
	} else {
		tmp = t_1;
	}
	return tmp;
}
public static double code(double x) {
	double t_0 = Math.cbrt((1.0 + x));
	double t_1 = t_0 - Math.cbrt(x);
	double tmp;
	if (t_1 <= 2e-6) {
		tmp = 1.0 / (Math.cbrt(x) * (t_0 + (Math.cbrt(x) * 2.0)));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x)
	t_0 = cbrt(Float64(1.0 + x))
	t_1 = Float64(t_0 - cbrt(x))
	tmp = 0.0
	if (t_1 <= 2e-6)
		tmp = Float64(1.0 / Float64(cbrt(x) * Float64(t_0 + Float64(cbrt(x) * 2.0))));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_] := Block[{t$95$0 = N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e-6], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(t$95$0 + N[(N[Power[x, 1/3], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
t_1 := t_0 - \sqrt[3]{x}\\
\mathbf{if}\;t_1 \leq 2 \cdot 10^{-6}:\\
\;\;\;\;\frac{1}{\sqrt[3]{x} \cdot \left(t_0 + \sqrt[3]{x} \cdot 2\right)}\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) < 1.99999999999999991e-6

    1. Initial program 5.1%

      \[\sqrt[3]{x + 1} - \sqrt[3]{x} \]
    2. Step-by-step derivation
      1. flip3--5.3%

        \[\leadsto \color{blue}{\frac{{\left(\sqrt[3]{x + 1}\right)}^{3} - {\left(\sqrt[3]{x}\right)}^{3}}{\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1} + \left(\sqrt[3]{x} \cdot \sqrt[3]{x} + \sqrt[3]{x + 1} \cdot \sqrt[3]{x}\right)}} \]
      2. div-inv5.3%

        \[\leadsto \color{blue}{\left({\left(\sqrt[3]{x + 1}\right)}^{3} - {\left(\sqrt[3]{x}\right)}^{3}\right) \cdot \frac{1}{\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1} + \left(\sqrt[3]{x} \cdot \sqrt[3]{x} + \sqrt[3]{x + 1} \cdot \sqrt[3]{x}\right)}} \]
      3. rem-cube-cbrt5.0%

        \[\leadsto \left(\color{blue}{\left(x + 1\right)} - {\left(\sqrt[3]{x}\right)}^{3}\right) \cdot \frac{1}{\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1} + \left(\sqrt[3]{x} \cdot \sqrt[3]{x} + \sqrt[3]{x + 1} \cdot \sqrt[3]{x}\right)} \]
      4. rem-cube-cbrt5.8%

        \[\leadsto \left(\left(x + 1\right) - \color{blue}{x}\right) \cdot \frac{1}{\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1} + \left(\sqrt[3]{x} \cdot \sqrt[3]{x} + \sqrt[3]{x + 1} \cdot \sqrt[3]{x}\right)} \]
      5. +-commutative5.8%

        \[\leadsto \left(\left(x + 1\right) - x\right) \cdot \frac{1}{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x} + \sqrt[3]{x + 1} \cdot \sqrt[3]{x}\right) + \sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}}} \]
      6. distribute-rgt-out5.8%

        \[\leadsto \left(\left(x + 1\right) - x\right) \cdot \frac{1}{\color{blue}{\sqrt[3]{x} \cdot \left(\sqrt[3]{x} + \sqrt[3]{x + 1}\right)} + \sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}} \]
      7. +-commutative5.8%

        \[\leadsto \left(\left(x + 1\right) - x\right) \cdot \frac{1}{\sqrt[3]{x} \cdot \color{blue}{\left(\sqrt[3]{x + 1} + \sqrt[3]{x}\right)} + \sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}} \]
      8. fma-def5.8%

        \[\leadsto \left(\left(x + 1\right) - x\right) \cdot \frac{1}{\color{blue}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, \sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}\right)}} \]
      9. add-exp-log5.8%

        \[\leadsto \left(\left(x + 1\right) - x\right) \cdot \frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, \color{blue}{e^{\log \left(\sqrt[3]{x + 1} \cdot \sqrt[3]{x + 1}\right)}}\right)} \]
    3. Applied egg-rr3.8%

      \[\leadsto \color{blue}{\left(\left(x + 1\right) - x\right) \cdot \frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)}} \]
    4. Step-by-step derivation
      1. associate-*r/3.8%

        \[\leadsto \color{blue}{\frac{\left(\left(x + 1\right) - x\right) \cdot 1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)}} \]
      2. *-rgt-identity3.8%

        \[\leadsto \frac{\color{blue}{\left(x + 1\right) - x}}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)} \]
      3. +-commutative3.8%

        \[\leadsto \frac{\color{blue}{\left(1 + x\right)} - x}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)} \]
      4. associate--l+48.6%

        \[\leadsto \frac{\color{blue}{1 + \left(x - x\right)}}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)} \]
      5. +-inverses48.6%

        \[\leadsto \frac{1 + \color{blue}{0}}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)} \]
      6. metadata-eval48.6%

        \[\leadsto \frac{\color{blue}{1}}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x + 1} + \sqrt[3]{x}, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)} \]
      7. +-commutative48.6%

        \[\leadsto \frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{\color{blue}{1 + x}} + \sqrt[3]{x}, e^{0.6666666666666666 \cdot \mathsf{log1p}\left(x\right)}\right)} \]
      8. exp-prod48.0%

        \[\leadsto \frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{1 + x} + \sqrt[3]{x}, \color{blue}{{\left(e^{0.6666666666666666}\right)}^{\left(\mathsf{log1p}\left(x\right)\right)}}\right)} \]
    5. Simplified48.0%

      \[\leadsto \color{blue}{\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{1 + x} + \sqrt[3]{x}, {\left(e^{0.6666666666666666}\right)}^{\left(\mathsf{log1p}\left(x\right)\right)}\right)}} \]
    6. Taylor expanded in x around inf 46.7%

      \[\leadsto \frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{1 + x} + \sqrt[3]{x}, \color{blue}{{\left({x}^{2}\right)}^{0.3333333333333333}}\right)} \]
    7. Step-by-step derivation
      1. expm1-log1p-u46.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{1 + x} + \sqrt[3]{x}, {\left({x}^{2}\right)}^{0.3333333333333333}\right)}\right)\right)} \]
      2. expm1-udef6.4%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{1 + x} + \sqrt[3]{x}, {\left({x}^{2}\right)}^{0.3333333333333333}\right)}\right)} - 1} \]
      3. +-commutative6.4%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \color{blue}{\sqrt[3]{x} + \sqrt[3]{1 + x}}, {\left({x}^{2}\right)}^{0.3333333333333333}\right)}\right)} - 1 \]
      4. unpow1/36.4%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, \color{blue}{\sqrt[3]{{x}^{2}}}\right)}\right)} - 1 \]
      5. unpow26.4%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, \sqrt[3]{\color{blue}{x \cdot x}}\right)}\right)} - 1 \]
      6. cbrt-prod6.4%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, \color{blue}{\sqrt[3]{x} \cdot \sqrt[3]{x}}\right)}\right)} - 1 \]
      7. pow26.4%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, \color{blue}{{\left(\sqrt[3]{x}\right)}^{2}}\right)}\right)} - 1 \]
    8. Applied egg-rr6.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, {\left(\sqrt[3]{x}\right)}^{2}\right)}\right)} - 1} \]
    9. Step-by-step derivation
      1. expm1-def98.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, {\left(\sqrt[3]{x}\right)}^{2}\right)}\right)\right)} \]
      2. expm1-log1p98.0%

        \[\leadsto \color{blue}{\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, {\left(\sqrt[3]{x}\right)}^{2}\right)}} \]
      3. fma-udef98.0%

        \[\leadsto \frac{1}{\color{blue}{\sqrt[3]{x} \cdot \left(\sqrt[3]{x} + \sqrt[3]{1 + x}\right) + {\left(\sqrt[3]{x}\right)}^{2}}} \]
      4. unpow298.0%

        \[\leadsto \frac{1}{\sqrt[3]{x} \cdot \left(\sqrt[3]{x} + \sqrt[3]{1 + x}\right) + \color{blue}{\sqrt[3]{x} \cdot \sqrt[3]{x}}} \]
      5. distribute-lft-out97.9%

        \[\leadsto \frac{1}{\color{blue}{\sqrt[3]{x} \cdot \left(\left(\sqrt[3]{x} + \sqrt[3]{1 + x}\right) + \sqrt[3]{x}\right)}} \]
      6. +-commutative97.9%

        \[\leadsto \frac{1}{\sqrt[3]{x} \cdot \left(\color{blue}{\left(\sqrt[3]{1 + x} + \sqrt[3]{x}\right)} + \sqrt[3]{x}\right)} \]
      7. associate-+r+97.9%

        \[\leadsto \frac{1}{\sqrt[3]{x} \cdot \color{blue}{\left(\sqrt[3]{1 + x} + \left(\sqrt[3]{x} + \sqrt[3]{x}\right)\right)}} \]
      8. count-297.9%

        \[\leadsto \frac{1}{\sqrt[3]{x} \cdot \left(\sqrt[3]{1 + x} + \color{blue}{2 \cdot \sqrt[3]{x}}\right)} \]
    10. Simplified97.9%

      \[\leadsto \color{blue}{\frac{1}{\sqrt[3]{x} \cdot \left(\sqrt[3]{1 + x} + 2 \cdot \sqrt[3]{x}\right)}} \]

    if 1.99999999999999991e-6 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x))

    1. Initial program 99.2%

      \[\sqrt[3]{x + 1} - \sqrt[3]{x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\sqrt[3]{1 + x} - \sqrt[3]{x} \leq 2 \cdot 10^{-6}:\\ \;\;\;\;\frac{1}{\sqrt[3]{x} \cdot \left(\sqrt[3]{1 + x} + \sqrt[3]{x} \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{1 + x} - \sqrt[3]{x}\\ \end{array} \]

Alternative 6: 53.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \sqrt[3]{1 + x} - \sqrt[3]{x} \end{array} \]
(FPCore (x) :precision binary64 (- (cbrt (+ 1.0 x)) (cbrt x)))
double code(double x) {
	return cbrt((1.0 + x)) - cbrt(x);
}
public static double code(double x) {
	return Math.cbrt((1.0 + x)) - Math.cbrt(x);
}
function code(x)
	return Float64(cbrt(Float64(1.0 + x)) - cbrt(x))
end
code[x_] := N[(N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\sqrt[3]{1 + x} - \sqrt[3]{x}
\end{array}
Derivation
  1. Initial program 52.5%

    \[\sqrt[3]{x + 1} - \sqrt[3]{x} \]
  2. Final simplification52.5%

    \[\leadsto \sqrt[3]{1 + x} - \sqrt[3]{x} \]

Alternative 7: 3.6% accurate, 205.0× speedup?

\[\begin{array}{l} \\ 0 \end{array} \]
(FPCore (x) :precision binary64 0.0)
double code(double x) {
	return 0.0;
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = 0.0d0
end function
public static double code(double x) {
	return 0.0;
}
def code(x):
	return 0.0
function code(x)
	return 0.0
end
function tmp = code(x)
	tmp = 0.0;
end
code[x_] := 0.0
\begin{array}{l}

\\
0
\end{array}
Derivation
  1. Initial program 52.5%

    \[\sqrt[3]{x + 1} - \sqrt[3]{x} \]
  2. Taylor expanded in x around inf 3.7%

    \[\leadsto \color{blue}{0} \]
  3. Final simplification3.7%

    \[\leadsto 0 \]

Alternative 8: 50.0% accurate, 205.0× speedup?

\[\begin{array}{l} \\ 1 \end{array} \]
(FPCore (x) :precision binary64 1.0)
double code(double x) {
	return 1.0;
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = 1.0d0
end function
public static double code(double x) {
	return 1.0;
}
def code(x):
	return 1.0
function code(x)
	return 1.0
end
function tmp = code(x)
	tmp = 1.0;
end
code[x_] := 1.0
\begin{array}{l}

\\
1
\end{array}
Derivation
  1. Initial program 52.5%

    \[\sqrt[3]{x + 1} - \sqrt[3]{x} \]
  2. Taylor expanded in x around 0 49.8%

    \[\leadsto \color{blue}{1} \]
  3. Final simplification49.8%

    \[\leadsto 1 \]

Reproduce

?
herbie shell --seed 2023306 
(FPCore (x)
  :name "2cbrt (problem 3.3.4)"
  :precision binary64
  (- (cbrt (+ x 1.0)) (cbrt x)))