?

Average Error: 29.6 → 0.5
Time: 10.7s
Precision: binary64
Cost: 39433

?

\[\sqrt[3]{x + 1} - \sqrt[3]{x} \]
\[\begin{array}{l} t_0 := \sqrt[3]{1 + x}\\ \mathbf{if}\;x \leq -4 \cdot 10^{+154} \lor \neg \left(x \leq 2 \cdot 10^{+144}\right):\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{x}, {t_0}^{2}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + t_0, \sqrt[3]{{\left(1 + x\right)}^{2}}\right)}\\ \end{array} \]
(FPCore (x) :precision binary64 (- (cbrt (+ x 1.0)) (cbrt x)))
(FPCore (x)
 :precision binary64
 (let* ((t_0 (cbrt (+ 1.0 x))))
   (if (or (<= x -4e+154) (not (<= x 2e+144)))
     (/ 1.0 (fma (cbrt x) (+ (cbrt x) (cbrt x)) (pow t_0 2.0)))
     (/ 1.0 (fma (cbrt x) (+ (cbrt x) t_0) (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 ((x <= -4e+154) || !(x <= 2e+144)) {
		tmp = 1.0 / fma(cbrt(x), (cbrt(x) + cbrt(x)), pow(t_0, 2.0));
	} else {
		tmp = 1.0 / fma(cbrt(x), (cbrt(x) + t_0), 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 ((x <= -4e+154) || !(x <= 2e+144))
		tmp = Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + cbrt(x)), (t_0 ^ 2.0)));
	else
		tmp = Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + t_0), 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[Or[LessEqual[x, -4e+154], N[Not[LessEqual[x, 2e+144]], $MachinePrecision]], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision] + N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] + t$95$0), $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}\;x \leq -4 \cdot 10^{+154} \lor \neg \left(x \leq 2 \cdot 10^{+144}\right):\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{x}, {t_0}^{2}\right)}\\

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


\end{array}

Error?

Derivation?

  1. Split input into 2 regimes
  2. if x < -4.00000000000000015e154 or 2.00000000000000005e144 < x

    1. Initial program 61.0

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

      \[\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)}} \]
    3. Simplified1.0

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

      [Start]61.0

      \[ \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)} \]

      associate-*r/ [=>]61.0

      \[ \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)}} \]

      *-rgt-identity [=>]61.0

      \[ \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)} \]

      +-commutative [=>]61.0

      \[ \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)} \]

      associate--l+ [=>]1.0

      \[ \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)} \]

      +-inverses [=>]1.0

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

      metadata-eval [=>]1.0

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

      +-commutative [=>]1.0

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

      fma-def [=>]1.0

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

      +-commutative [=>]1.0

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

      +-commutative [=>]1.0

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

      \[\leadsto \frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \color{blue}{{\left(\sqrt[3]{\sqrt[3]{1 + x}}\right)}^{3}} + \sqrt[3]{x}, {\left(\sqrt[3]{1 + x}\right)}^{2}\right)} \]
    5. Taylor expanded in x around inf 32.6

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

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

      [Start]32.6

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

      unpow1/3 [=>]1.0

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

    if -4.00000000000000015e154 < x < 2.00000000000000005e144

    1. Initial program 18.8

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

      \[\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)}} \]
    3. Simplified0.4

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

      [Start]18.0

      \[ \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)} \]

      associate-*r/ [=>]18.0

      \[ \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)}} \]

      *-rgt-identity [=>]18.0

      \[ \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)} \]

      +-commutative [=>]18.0

      \[ \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)} \]

      associate--l+ [=>]0.4

      \[ \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)} \]

      +-inverses [=>]0.4

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

      metadata-eval [=>]0.4

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

      +-commutative [=>]0.4

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

      fma-def [=>]0.4

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

      +-commutative [=>]0.4

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

      +-commutative [=>]0.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4 \cdot 10^{+154} \lor \neg \left(x \leq 2 \cdot 10^{+144}\right):\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{x}, {\left(\sqrt[3]{1 + x}\right)}^{2}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{1 + x}, \sqrt[3]{{\left(1 + x\right)}^{2}}\right)}\\ \end{array} \]

Alternatives

Alternative 1
Error0.5
Cost58944
\[\begin{array}{l} t_0 := {\left(\frac{-1}{x}\right)}^{-1}\\ \frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{\mathsf{fma}\left(t_0, -1, \frac{-t_0}{x}\right)}, {\left(\sqrt[3]{1 + x}\right)}^{2}\right)} \end{array} \]
Alternative 2
Error0.5
Cost52228
\[\begin{array}{l} t_0 := \sqrt[3]{1 + x}\\ t_1 := {t_0}^{2}\\ \mathbf{if}\;t_0 - \sqrt[3]{x} \leq 0:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + \sqrt[3]{x}, t_1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(1 + x\right) - x}{t_1 + \sqrt[3]{x} \cdot \left(\sqrt[3]{x} + t_0\right)}\\ \end{array} \]
Alternative 3
Error0.5
Cost39168
\[\begin{array}{l} t_0 := \sqrt[3]{1 + x}\\ \frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + t_0, {t_0}^{2}\right)} \end{array} \]
Alternative 4
Error24.2
Cost33416
\[\begin{array}{l} t_0 := \sqrt[3]{1 + x}\\ t_1 := {t_0}^{2}\\ t_2 := \sqrt[3]{x} + t_0\\ \mathbf{if}\;x \leq -9 \cdot 10^{+15}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, t_2, 1\right)}\\ \mathbf{elif}\;x \leq 9 \cdot 10^{+15}:\\ \;\;\;\;\frac{\left(1 + x\right) - x}{t_1 + \sqrt[3]{x} \cdot t_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, 1 + \sqrt[3]{x}, t_1\right)}\\ \end{array} \]
Alternative 5
Error24.9
Cost33032
\[\begin{array}{l} t_0 := \sqrt[3]{1 + x}\\ \mathbf{if}\;x \leq -8 \cdot 10^{+14}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + t_0, 1\right)}\\ \mathbf{elif}\;x \leq 7.6 \cdot 10^{+14}:\\ \;\;\;\;\frac{\sqrt[3]{1 + {x}^{3}}}{\sqrt[3]{\mathsf{fma}\left(x, x, 1 - x\right)}} - \sqrt[3]{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, 1 + \sqrt[3]{x}, {t_0}^{2}\right)}\\ \end{array} \]
Alternative 6
Error24.8
Cost32905
\[\begin{array}{l} t_0 := \sqrt[3]{1 + x}\\ \mathbf{if}\;x \leq -1.2 \cdot 10^{+15} \lor \neg \left(x \leq 3.7 \cdot 10^{+14}\right):\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, 1 + \sqrt[3]{x}, {t_0}^{2}\right)}\\ \mathbf{else}:\\ \;\;\;\;t_0 + \frac{\sqrt[3]{x} \cdot \left(-1 + \left(-1 - \sqrt[3]{x}\right)\right)}{\sqrt[3]{x} + 2}\\ \end{array} \]
Alternative 7
Error24.8
Cost32904
\[\begin{array}{l} t_0 := \sqrt[3]{1 + x}\\ \mathbf{if}\;x \leq -1.2 \cdot 10^{+15}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + t_0, 1\right)}\\ \mathbf{elif}\;x \leq 3.7 \cdot 10^{+14}:\\ \;\;\;\;t_0 + \frac{\sqrt[3]{x} \cdot \left(-1 + \left(-1 - \sqrt[3]{x}\right)\right)}{\sqrt[3]{x} + 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, 1 + \sqrt[3]{x}, {t_0}^{2}\right)}\\ \end{array} \]
Alternative 8
Error29.6
Cost25920
\[e^{\log \left(\sqrt[3]{1 + x} - \sqrt[3]{x}\right)} \]
Alternative 9
Error29.6
Cost13120
\[\sqrt[3]{1 + x} - \sqrt[3]{x} \]
Alternative 10
Error61.7
Cost64
\[0 \]
Alternative 11
Error31.7
Cost64
\[1 \]

Error

Reproduce?

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