
(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:
Herbie found 1 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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}
(FPCore (x) :precision binary64 (* (pow (pow (cbrt x) 2.0) -1.0) 0.3333333333333333))
double code(double x) {
return pow(pow(cbrt(x), 2.0), -1.0) * 0.3333333333333333;
}
public static double code(double x) {
return Math.pow(Math.pow(Math.cbrt(x), 2.0), -1.0) * 0.3333333333333333;
}
function code(x) return Float64(((cbrt(x) ^ 2.0) ^ -1.0) * 0.3333333333333333) end
code[x_] := N[(N[Power[N[Power[N[Power[x, 1/3], $MachinePrecision], 2.0], $MachinePrecision], -1.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]
\begin{array}{l}
\\
{\left({\left(\sqrt[3]{x}\right)}^{2}\right)}^{-1} \cdot 0.3333333333333333
\end{array}
Initial program 6.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-cbrt.f64N/A
pow-flipN/A
lower-pow.f64N/A
metadata-eval52.8
Applied rewrites52.8%
lift-cbrt.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow-flipN/A
cbrt-divN/A
metadata-evalN/A
inv-powN/A
unpow2N/A
cbrt-prodN/A
lower-pow.f64N/A
pow2N/A
lower-pow.f64N/A
lower-cbrt.f6496.9
Applied rewrites96.9%
herbie shell --seed 2025062 -o reduce:regimes -o reduce:simplify
(FPCore (x)
:name "2cbrt (problem 3.3.4)"
:precision binary64
:pre (and (> x 1.0) (< x 1e+308))
:alt
(! :herbie-platform herbie20 (/ 1 (+ (* (cbrt (+ x 1)) (cbrt (+ x 1))) (* (cbrt x) (cbrt (+ x 1))) (* (cbrt x) (cbrt x)))))
(- (cbrt (+ x 1.0)) (cbrt x)))