Average Error: 30.1 → 0.5
Time: 8.0s
Precision: binary64
Cost: 46084
\[\sqrt[3]{x + 1} - \sqrt[3]{x} \]
\[\begin{array}{l} t_0 := \sqrt[3]{1 + x}\\ \mathbf{if}\;t_0 - \sqrt[3]{x} \leq 3 \cdot 10^{-9}:\\ \;\;\;\;\mathsf{fma}\left(0.3333333333333333, \frac{\sqrt[3]{\frac{-1}{x}}}{\sqrt[3]{-x}}, \sqrt[3]{\frac{1}{{x}^{5}}} \cdot -0.1111111111111111\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt[3]{x} \cdot \left(t_0 + \sqrt[3]{x}\right) + \sqrt[3]{{\left(1 + x\right)}^{2}}}\\ \end{array} \]
(FPCore (x) :precision binary64 (- (cbrt (+ x 1.0)) (cbrt x)))
(FPCore (x)
 :precision binary64
 (let* ((t_0 (cbrt (+ 1.0 x))))
   (if (<= (- t_0 (cbrt x)) 3e-9)
     (fma
      0.3333333333333333
      (/ (cbrt (/ -1.0 x)) (cbrt (- x)))
      (* (cbrt (/ 1.0 (pow x 5.0))) -0.1111111111111111))
     (/ 1.0 (+ (* (cbrt x) (+ t_0 (cbrt x))) (cbrt (pow (+ 1.0 x) 2.0)))))))
double code(double x) {
	return cbrt((x + 1.0)) - cbrt(x);
}
double code(double x) {
	double t_0 = cbrt((1.0 + x));
	double tmp;
	if ((t_0 - cbrt(x)) <= 3e-9) {
		tmp = fma(0.3333333333333333, (cbrt((-1.0 / x)) / cbrt(-x)), (cbrt((1.0 / pow(x, 5.0))) * -0.1111111111111111));
	} else {
		tmp = 1.0 / ((cbrt(x) * (t_0 + cbrt(x))) + cbrt(pow((1.0 + x), 2.0)));
	}
	return tmp;
}
function code(x)
	return Float64(cbrt(Float64(x + 1.0)) - cbrt(x))
end
function code(x)
	t_0 = cbrt(Float64(1.0 + x))
	tmp = 0.0
	if (Float64(t_0 - cbrt(x)) <= 3e-9)
		tmp = fma(0.3333333333333333, Float64(cbrt(Float64(-1.0 / x)) / cbrt(Float64(-x))), Float64(cbrt(Float64(1.0 / (x ^ 5.0))) * -0.1111111111111111));
	else
		tmp = Float64(1.0 / Float64(Float64(cbrt(x) * Float64(t_0 + cbrt(x))) + cbrt((Float64(1.0 + x) ^ 2.0))));
	end
	return tmp
end
code[x_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], 1/3], $MachinePrecision] - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]
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], 3e-9], N[(0.3333333333333333 * N[(N[Power[N[(-1.0 / x), $MachinePrecision], 1/3], $MachinePrecision] / N[Power[(-x), 1/3], $MachinePrecision]), $MachinePrecision] + N[(N[Power[N[(1.0 / N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] * -0.1111111111111111), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(N[Power[x, 1/3], $MachinePrecision] * N[(t$95$0 + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[N[Power[N[(1.0 + x), $MachinePrecision], 2.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\sqrt[3]{x + 1} - \sqrt[3]{x}
\begin{array}{l}
t_0 := \sqrt[3]{1 + x}\\
\mathbf{if}\;t_0 - \sqrt[3]{x} \leq 3 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(0.3333333333333333, \frac{\sqrt[3]{\frac{-1}{x}}}{\sqrt[3]{-x}}, \sqrt[3]{\frac{1}{{x}^{5}}} \cdot -0.1111111111111111\right)\\

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


\end{array}

Error

Derivation

  1. Split input into 2 regimes
  2. if (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) < 2.99999999999999998e-9

    1. Initial program 61.1

      \[\sqrt[3]{x + 1} - \sqrt[3]{x} \]
    2. Applied egg-rr62.6

      \[\leadsto \color{blue}{\left({\left(x + 1\right)}^{0.16666666666666666} + {x}^{0.16666666666666666}\right) \cdot \left({\left(x + 1\right)}^{0.16666666666666666} - {x}^{0.16666666666666666}\right)} \]
    3. Taylor expanded in x around inf 38.9

      \[\leadsto \color{blue}{-0.1388888888888889 \cdot {\left(\frac{1}{{x}^{5}}\right)}^{0.3333333333333333} + \left(0.3333333333333333 \cdot {\left(\frac{1}{{x}^{2}}\right)}^{0.3333333333333333} + 0.027777777777777776 \cdot {\left(\frac{1}{{x}^{5}}\right)}^{0.3333333333333333}\right)} \]
    4. Simplified31.0

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.3333333333333333, \sqrt[3]{\frac{\frac{1}{x}}{x}}, \sqrt[3]{\frac{1}{{x}^{5}}} \cdot -0.1111111111111111\right)} \]
      Proof
      (fma.f64 1/3 (cbrt.f64 (/.f64 (/.f64 1 x) x)) (*.f64 (cbrt.f64 (/.f64 1 (pow.f64 x 5))) -1/9)): 0 points increase in error, 0 points decrease in error
      (fma.f64 1/3 (cbrt.f64 (Rewrite<= associate-/r*_binary64 (/.f64 1 (*.f64 x x)))) (*.f64 (cbrt.f64 (/.f64 1 (pow.f64 x 5))) -1/9)): 9 points increase in error, 5 points decrease in error
      (fma.f64 1/3 (cbrt.f64 (/.f64 1 (Rewrite<= unpow2_binary64 (pow.f64 x 2)))) (*.f64 (cbrt.f64 (/.f64 1 (pow.f64 x 5))) -1/9)): 0 points increase in error, 0 points decrease in error
      (fma.f64 1/3 (Rewrite<= unpow1/3_binary64 (pow.f64 (/.f64 1 (pow.f64 x 2)) 1/3)) (*.f64 (cbrt.f64 (/.f64 1 (pow.f64 x 5))) -1/9)): 67 points increase in error, 4 points decrease in error
      (fma.f64 1/3 (pow.f64 (/.f64 1 (pow.f64 x 2)) 1/3) (*.f64 (Rewrite<= unpow1/3_binary64 (pow.f64 (/.f64 1 (pow.f64 x 5)) 1/3)) -1/9)): 26 points increase in error, 15 points decrease in error
      (fma.f64 1/3 (pow.f64 (/.f64 1 (pow.f64 x 2)) 1/3) (*.f64 (pow.f64 (/.f64 1 (pow.f64 x 5)) 1/3) (Rewrite<= metadata-eval (+.f64 1/36 -5/36)))): 12 points increase in error, 0 points decrease in error
      (fma.f64 1/3 (pow.f64 (/.f64 1 (pow.f64 x 2)) 1/3) (Rewrite<= distribute-rgt-out_binary64 (+.f64 (*.f64 1/36 (pow.f64 (/.f64 1 (pow.f64 x 5)) 1/3)) (*.f64 -5/36 (pow.f64 (/.f64 1 (pow.f64 x 5)) 1/3))))): 3 points increase in error, 5 points decrease in error
      (Rewrite<= fma-def_binary64 (+.f64 (*.f64 1/3 (pow.f64 (/.f64 1 (pow.f64 x 2)) 1/3)) (+.f64 (*.f64 1/36 (pow.f64 (/.f64 1 (pow.f64 x 5)) 1/3)) (*.f64 -5/36 (pow.f64 (/.f64 1 (pow.f64 x 5)) 1/3))))): 1 points increase in error, 0 points decrease in error
      (Rewrite<= associate-+l+_binary64 (+.f64 (+.f64 (*.f64 1/3 (pow.f64 (/.f64 1 (pow.f64 x 2)) 1/3)) (*.f64 1/36 (pow.f64 (/.f64 1 (pow.f64 x 5)) 1/3))) (*.f64 -5/36 (pow.f64 (/.f64 1 (pow.f64 x 5)) 1/3)))): 1 points increase in error, 1 points decrease in error
      (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 -5/36 (pow.f64 (/.f64 1 (pow.f64 x 5)) 1/3)) (+.f64 (*.f64 1/3 (pow.f64 (/.f64 1 (pow.f64 x 2)) 1/3)) (*.f64 1/36 (pow.f64 (/.f64 1 (pow.f64 x 5)) 1/3))))): 0 points increase in error, 0 points decrease in error
    5. Applied egg-rr1.0

      \[\leadsto \mathsf{fma}\left(0.3333333333333333, \color{blue}{\frac{\sqrt[3]{\frac{-1}{x}}}{\sqrt[3]{-x}}}, \sqrt[3]{\frac{1}{{x}^{5}}} \cdot -0.1111111111111111\right) \]

    if 2.99999999999999998e-9 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x))

    1. Initial program 1.0

      \[\sqrt[3]{x + 1} - \sqrt[3]{x} \]
    2. Applied egg-rr0.1

      \[\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)}} \]
    3. Taylor expanded in x around 0 0.1

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

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

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

Alternatives

Alternative 1
Error0.6
Cost46020
\[\begin{array}{l} t_0 := \sqrt[3]{1 + x} - \sqrt[3]{x}\\ \mathbf{if}\;t_0 \leq 0.0001:\\ \;\;\;\;\mathsf{fma}\left(0.3333333333333333, \frac{\sqrt[3]{\frac{-1}{x}}}{\sqrt[3]{-x}}, \sqrt[3]{\frac{1}{{x}^{5}}} \cdot -0.1111111111111111\right)\\ \mathbf{else}:\\ \;\;\;\;e^{\log t_0}\\ \end{array} \]
Alternative 2
Error0.6
Cost45764
\[\begin{array}{l} t_0 := \sqrt[3]{1 + x} - \sqrt[3]{x}\\ \mathbf{if}\;t_0 \leq 0.0001:\\ \;\;\;\;\mathsf{fma}\left(0.3333333333333333, {\left(\sqrt[3]{x}\right)}^{-2}, \sqrt[3]{\frac{1}{{x}^{5}}} \cdot -0.1111111111111111\right)\\ \mathbf{else}:\\ \;\;\;\;e^{\log t_0}\\ \end{array} \]
Alternative 3
Error0.8
Cost33032
\[\begin{array}{l} t_0 := \sqrt[3]{1 + x}\\ \mathbf{if}\;x \leq -5329.454564788931:\\ \;\;\;\;\mathsf{fma}\left(0.3333333333333333, \frac{1}{{\left(\sqrt[3]{x}\right)}^{2}}, \sqrt[3]{\frac{1}{{x}^{5}}} \cdot -0.1111111111111111\right)\\ \mathbf{elif}\;x \leq 1386709208860.7458:\\ \;\;\;\;\frac{\left(1 + x\right) - x}{\sqrt[3]{x} \cdot \left(t_0 + \sqrt[3]{x}\right) + {\left(1 + x\right)}^{0.6666666666666666}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{{t_0}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{x} + \sqrt[3]{x}\right)}\\ \end{array} \]
Alternative 4
Error0.5
Cost32896
\[\begin{array}{l} t_0 := \sqrt[3]{1 + x}\\ \frac{1}{{t_0}^{2} + \sqrt[3]{x} \cdot \left(t_0 + \sqrt[3]{x}\right)} \end{array} \]
Alternative 5
Error0.9
Cost32840
\[\begin{array}{l} t_0 := \sqrt[3]{\frac{1}{{x}^{5}}} \cdot -0.1111111111111111\\ \mathbf{if}\;x \leq -1671114779168.299:\\ \;\;\;\;\mathsf{fma}\left(0.3333333333333333, {\left(\frac{1}{\sqrt[3]{x}}\right)}^{2}, t_0\right)\\ \mathbf{elif}\;x \leq 255.6737590581196:\\ \;\;\;\;e^{\log \left(\sqrt[3]{1 + x} - \sqrt[3]{x}\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.3333333333333333, {\left(\sqrt[3]{x}\right)}^{-2}, t_0\right)\\ \end{array} \]
Alternative 6
Error0.9
Cost32840
\[\begin{array}{l} t_0 := \sqrt[3]{\frac{1}{{x}^{5}}} \cdot -0.1111111111111111\\ \mathbf{if}\;x \leq -1671114779168.299:\\ \;\;\;\;\mathsf{fma}\left(0.3333333333333333, \frac{1}{{\left(\sqrt[3]{x}\right)}^{2}}, t_0\right)\\ \mathbf{elif}\;x \leq 255.6737590581196:\\ \;\;\;\;e^{\log \left(\sqrt[3]{1 + x} - \sqrt[3]{x}\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.3333333333333333, {\left(\sqrt[3]{x}\right)}^{-2}, t_0\right)\\ \end{array} \]
Alternative 7
Error9.0
Cost27016
\[\begin{array}{l} \mathbf{if}\;x \leq -5329.454564788931:\\ \;\;\;\;\mathsf{fma}\left(0.3333333333333333, \sqrt[3]{\frac{\frac{1}{x}}{x}}, \frac{-0.1111111111111111}{{\left(\sqrt[3]{x}\right)}^{5}}\right)\\ \mathbf{elif}\;x \leq 1386709208860.7458:\\ \;\;\;\;\frac{\left(1 + x\right) - x}{\sqrt[3]{x} \cdot \left(\sqrt[3]{1 + x} + \sqrt[3]{x}\right) + {\left(1 + x\right)}^{0.6666666666666666}}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.3333333333333333}{x} \cdot \sqrt[3]{e^{\log x}}\\ \end{array} \]
Alternative 8
Error9.2
Cost26372
\[\begin{array}{l} \mathbf{if}\;x \leq -1671114779168.299:\\ \;\;\;\;\mathsf{fma}\left(0.3333333333333333, \sqrt[3]{\frac{\frac{1}{x}}{x}}, \frac{-0.1111111111111111}{{\left(\sqrt[3]{x}\right)}^{5}}\right)\\ \mathbf{elif}\;x \leq 40954943.76985199:\\ \;\;\;\;e^{\log \left(\sqrt[3]{1 + x} - \sqrt[3]{x}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.3333333333333333}{x} \cdot \sqrt[3]{e^{\log x}}\\ \end{array} \]
Alternative 9
Error9.2
Cost26184
\[\begin{array}{l} \mathbf{if}\;x \leq -1671114779168.299:\\ \;\;\;\;0.3333333333333333 \cdot \sqrt[3]{\frac{\frac{1}{x}}{x}}\\ \mathbf{elif}\;x \leq 40954943.76985199:\\ \;\;\;\;e^{\log \left(\sqrt[3]{1 + x} - \sqrt[3]{x}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.3333333333333333}{x} \cdot \sqrt[3]{e^{\log x}}\\ \end{array} \]
Alternative 10
Error9.2
Cost19784
\[\begin{array}{l} \mathbf{if}\;x \leq -1671114779168.299:\\ \;\;\;\;0.3333333333333333 \cdot \sqrt[3]{\frac{\frac{1}{x}}{x}}\\ \mathbf{elif}\;x \leq 40954943.76985199:\\ \;\;\;\;\sqrt[3]{1 + x} - \sqrt[3]{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.3333333333333333}{x} \cdot \sqrt[3]{e^{\log x}}\\ \end{array} \]
Alternative 11
Error15.5
Cost13384
\[\begin{array}{l} t_0 := 0.3333333333333333 \cdot \sqrt[3]{\frac{\frac{1}{x}}{x}}\\ \mathbf{if}\;x \leq -1671114779168.299:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 40954943.76985199:\\ \;\;\;\;\sqrt[3]{1 + x} - \sqrt[3]{x}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 12
Error16.3
Cost7112
\[\begin{array}{l} t_0 := 0.3333333333333333 \cdot \sqrt[3]{\frac{\frac{1}{x}}{x}}\\ \mathbf{if}\;x \leq -5329.454564788931:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 0.4213765771501462:\\ \;\;\;\;1 - \sqrt[3]{x}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 13
Error31.9
Cost6592
\[1 - \sqrt[3]{x} \]
Alternative 14
Error61.7
Cost64
\[0 \]
Alternative 15
Error32.3
Cost64
\[1 \]

Error

Reproduce

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