
(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 12 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
(let* ((t_0 (cbrt (+ 1.0 x))))
(/
(+ 1.0 (- x x))
(+
(pow t_0 2.0)
(*
(+ x (+ 1.0 x))
(/ (cbrt x) (+ (pow (cbrt x) 2.0) (* t_0 (- t_0 (cbrt x))))))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
return (1.0 + (x - x)) / (pow(t_0, 2.0) + ((x + (1.0 + x)) * (cbrt(x) / (pow(cbrt(x), 2.0) + (t_0 * (t_0 - cbrt(x)))))));
}
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) + ((x + (1.0 + x)) * (Math.cbrt(x) / (Math.pow(Math.cbrt(x), 2.0) + (t_0 * (t_0 - Math.cbrt(x)))))));
}
function code(x) t_0 = cbrt(Float64(1.0 + x)) return Float64(Float64(1.0 + Float64(x - x)) / Float64((t_0 ^ 2.0) + Float64(Float64(x + Float64(1.0 + x)) * Float64(cbrt(x) / Float64((cbrt(x) ^ 2.0) + Float64(t_0 * Float64(t_0 - cbrt(x)))))))) 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[(x + N[(1.0 + x), $MachinePrecision]), $MachinePrecision] * N[(N[Power[x, 1/3], $MachinePrecision] / N[(N[Power[N[Power[x, 1/3], $MachinePrecision], 2.0], $MachinePrecision] + N[(t$95$0 * N[(t$95$0 - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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} + \left(x + \left(1 + x\right)\right) \cdot \frac{\sqrt[3]{x}}{{\left(\sqrt[3]{x}\right)}^{2} + t\_0 \cdot \left(t\_0 - \sqrt[3]{x}\right)}}
\end{array}
\end{array}
Initial program 6.8%
add-sqr-sqrt6.4%
pow26.4%
pow1/37.6%
sqrt-pow17.6%
metadata-eval7.6%
Applied egg-rr7.6%
flip3--7.6%
div-inv7.6%
rem-cube-cbrt7.6%
+-commutative7.6%
pow-pow7.6%
metadata-eval7.6%
unpow1/35.9%
rem-cube-cbrt8.3%
pow28.3%
+-commutative8.3%
distribute-rgt-out8.3%
Applied egg-rr8.3%
associate-*r/8.3%
associate--l+98.4%
+-commutative98.4%
Simplified98.4%
flip3-+98.4%
associate-*r/71.1%
rem-cube-cbrt71.4%
pow371.5%
add-cube-cbrt71.8%
pow271.8%
distribute-rgt-out--71.8%
Applied egg-rr71.8%
*-commutative71.8%
associate-/l*99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (sqrt (+ 1.0 x)))))
(/
(+ 1.0 (- x x))
(+ (pow (* t_0 t_0) 2.0) (* (cbrt x) (+ (cbrt (+ 1.0 x)) (cbrt x)))))))
double code(double x) {
double t_0 = cbrt(sqrt((1.0 + x)));
return (1.0 + (x - x)) / (pow((t_0 * t_0), 2.0) + (cbrt(x) * (cbrt((1.0 + x)) + cbrt(x))));
}
public static double code(double x) {
double t_0 = Math.cbrt(Math.sqrt((1.0 + x)));
return (1.0 + (x - x)) / (Math.pow((t_0 * t_0), 2.0) + (Math.cbrt(x) * (Math.cbrt((1.0 + x)) + Math.cbrt(x))));
}
function code(x) t_0 = cbrt(sqrt(Float64(1.0 + x))) return Float64(Float64(1.0 + Float64(x - x)) / Float64((Float64(t_0 * t_0) ^ 2.0) + Float64(cbrt(x) * Float64(cbrt(Float64(1.0 + x)) + cbrt(x))))) end
code[x_] := Block[{t$95$0 = N[Power[N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision]}, N[(N[(1.0 + N[(x - x), $MachinePrecision]), $MachinePrecision] / N[(N[Power[N[(t$95$0 * t$95$0), $MachinePrecision], 2.0], $MachinePrecision] + N[(N[Power[x, 1/3], $MachinePrecision] * N[(N[Power[N[(1.0 + x), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{\sqrt{1 + x}}\\
\frac{1 + \left(x - x\right)}{{\left(t\_0 \cdot t\_0\right)}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{1 + x} + \sqrt[3]{x}\right)}
\end{array}
\end{array}
Initial program 6.8%
add-sqr-sqrt6.4%
pow26.4%
pow1/37.6%
sqrt-pow17.6%
metadata-eval7.6%
Applied egg-rr7.6%
flip3--7.6%
div-inv7.6%
rem-cube-cbrt7.6%
+-commutative7.6%
pow-pow7.6%
metadata-eval7.6%
unpow1/35.9%
rem-cube-cbrt8.3%
pow28.3%
+-commutative8.3%
distribute-rgt-out8.3%
Applied egg-rr8.3%
associate-*r/8.3%
associate--l+98.4%
+-commutative98.4%
Simplified98.4%
pow1/392.9%
+-commutative92.9%
add-sqr-sqrt92.9%
unpow-prod-down92.9%
Applied egg-rr92.9%
unpow1/394.3%
+-commutative94.3%
unpow1/398.5%
+-commutative98.5%
Simplified98.5%
Final simplification98.5%
(FPCore (x) :precision binary64 (let* ((t_0 (cbrt (+ 1.0 x)))) (/ (+ 1.0 (- x x)) (+ (pow t_0 2.0) (* (cbrt x) (+ t_0 (cbrt x)))))))
double code(double x) {
double t_0 = cbrt((1.0 + x));
return (1.0 + (x - x)) / (pow(t_0, 2.0) + (cbrt(x) * (t_0 + cbrt(x))));
}
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) * (t_0 + Math.cbrt(x))));
}
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(t_0 + cbrt(x))))) 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[(t$95$0 + N[Power[x, 1/3], $MachinePrecision]), $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(t\_0 + \sqrt[3]{x}\right)}
\end{array}
\end{array}
Initial program 6.8%
add-sqr-sqrt6.4%
pow26.4%
pow1/37.6%
sqrt-pow17.6%
metadata-eval7.6%
Applied egg-rr7.6%
flip3--7.6%
div-inv7.6%
rem-cube-cbrt7.6%
+-commutative7.6%
pow-pow7.6%
metadata-eval7.6%
unpow1/35.9%
rem-cube-cbrt8.3%
pow28.3%
+-commutative8.3%
distribute-rgt-out8.3%
Applied egg-rr8.3%
associate-*r/8.3%
associate--l+98.4%
+-commutative98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (x) :precision binary64 (+ (* -0.1111111111111111 (cbrt (/ 1.0 (pow x 5.0)))) (* 0.3333333333333333 (* (pow x -0.5) (cbrt (pow x -0.5))))))
double code(double x) {
return (-0.1111111111111111 * cbrt((1.0 / pow(x, 5.0)))) + (0.3333333333333333 * (pow(x, -0.5) * cbrt(pow(x, -0.5))));
}
public static double code(double x) {
return (-0.1111111111111111 * Math.cbrt((1.0 / Math.pow(x, 5.0)))) + (0.3333333333333333 * (Math.pow(x, -0.5) * Math.cbrt(Math.pow(x, -0.5))));
}
function code(x) return Float64(Float64(-0.1111111111111111 * cbrt(Float64(1.0 / (x ^ 5.0)))) + Float64(0.3333333333333333 * Float64((x ^ -0.5) * cbrt((x ^ -0.5))))) end
code[x_] := N[(N[(-0.1111111111111111 * N[Power[N[(1.0 / N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] + N[(0.3333333333333333 * N[(N[Power[x, -0.5], $MachinePrecision] * N[Power[N[Power[x, -0.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.1111111111111111 \cdot \sqrt[3]{\frac{1}{{x}^{5}}} + 0.3333333333333333 \cdot \left({x}^{-0.5} \cdot \sqrt[3]{{x}^{-0.5}}\right)
\end{array}
Initial program 6.8%
Taylor expanded in x around inf 49.8%
add-sqr-sqrt49.7%
cbrt-prod49.4%
sqrt-div49.4%
metadata-eval49.4%
unpow249.4%
sqrt-prod49.5%
add-sqr-sqrt49.4%
sqrt-div49.4%
metadata-eval49.4%
unpow249.4%
sqrt-prod97.2%
add-sqr-sqrt97.2%
Applied egg-rr97.2%
unpow297.2%
Simplified97.2%
unpow297.2%
add-sqr-sqrt97.0%
associate-*r*97.0%
add-sqr-sqrt96.9%
sqrt-prod97.0%
unpow297.0%
sqrt-prod97.1%
unpow297.1%
add-cube-cbrt98.0%
inv-pow98.0%
sqrt-pow198.0%
metadata-eval98.0%
add-cbrt-cube97.5%
Applied egg-rr97.8%
Final simplification97.8%
(FPCore (x) :precision binary64 (+ (* -0.1111111111111111 (cbrt (/ 1.0 (pow x 5.0)))) (* 0.3333333333333333 (pow (cbrt x) -2.0))))
double code(double x) {
return (-0.1111111111111111 * cbrt((1.0 / pow(x, 5.0)))) + (0.3333333333333333 * pow(cbrt(x), -2.0));
}
public static double code(double x) {
return (-0.1111111111111111 * Math.cbrt((1.0 / Math.pow(x, 5.0)))) + (0.3333333333333333 * Math.pow(Math.cbrt(x), -2.0));
}
function code(x) return Float64(Float64(-0.1111111111111111 * cbrt(Float64(1.0 / (x ^ 5.0)))) + Float64(0.3333333333333333 * (cbrt(x) ^ -2.0))) end
code[x_] := N[(N[(-0.1111111111111111 * N[Power[N[(1.0 / N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] + N[(0.3333333333333333 * N[Power[N[Power[x, 1/3], $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.1111111111111111 \cdot \sqrt[3]{\frac{1}{{x}^{5}}} + 0.3333333333333333 \cdot {\left(\sqrt[3]{x}\right)}^{-2}
\end{array}
Initial program 6.8%
Taylor expanded in x around inf 49.8%
add-sqr-sqrt49.7%
cbrt-prod49.4%
sqrt-div49.4%
metadata-eval49.4%
unpow249.4%
sqrt-prod49.5%
add-sqr-sqrt49.4%
sqrt-div49.4%
metadata-eval49.4%
unpow249.4%
sqrt-prod97.2%
add-sqr-sqrt97.2%
Applied egg-rr97.2%
unpow297.2%
Simplified97.2%
unpow297.2%
cbrt-div97.4%
metadata-eval97.4%
cbrt-div97.4%
metadata-eval97.4%
Applied egg-rr97.4%
unpow-197.4%
unpow-197.4%
pow-sqr97.5%
metadata-eval97.5%
Simplified97.5%
Final simplification97.5%
(FPCore (x)
:precision binary64
(if (<= x 9e+154)
(cbrt (* (pow x -2.0) 0.037037037037037035))
(+
(* -0.1111111111111111 (cbrt (/ 1.0 (pow x 5.0))))
(* 0.3333333333333333 (pow x -0.6666666666666666)))))
double code(double x) {
double tmp;
if (x <= 9e+154) {
tmp = cbrt((pow(x, -2.0) * 0.037037037037037035));
} else {
tmp = (-0.1111111111111111 * cbrt((1.0 / pow(x, 5.0)))) + (0.3333333333333333 * pow(x, -0.6666666666666666));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 9e+154) {
tmp = Math.cbrt((Math.pow(x, -2.0) * 0.037037037037037035));
} else {
tmp = (-0.1111111111111111 * Math.cbrt((1.0 / Math.pow(x, 5.0)))) + (0.3333333333333333 * Math.pow(x, -0.6666666666666666));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 9e+154) tmp = cbrt(Float64((x ^ -2.0) * 0.037037037037037035)); else tmp = Float64(Float64(-0.1111111111111111 * cbrt(Float64(1.0 / (x ^ 5.0)))) + Float64(0.3333333333333333 * (x ^ -0.6666666666666666))); end return tmp end
code[x_] := If[LessEqual[x, 9e+154], N[Power[N[(N[Power[x, -2.0], $MachinePrecision] * 0.037037037037037035), $MachinePrecision], 1/3], $MachinePrecision], N[(N[(-0.1111111111111111 * N[Power[N[(1.0 / N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] + N[(0.3333333333333333 * N[Power[x, -0.6666666666666666], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 9 \cdot 10^{+154}:\\
\;\;\;\;\sqrt[3]{{x}^{-2} \cdot 0.037037037037037035}\\
\mathbf{else}:\\
\;\;\;\;-0.1111111111111111 \cdot \sqrt[3]{\frac{1}{{x}^{5}}} + 0.3333333333333333 \cdot {x}^{-0.6666666666666666}\\
\end{array}
\end{array}
if x < 9.00000000000000018e154Initial program 8.8%
pow1/311.4%
pow-to-exp10.4%
Applied egg-rr10.4%
Taylor expanded in x around inf 95.0%
unpow-195.0%
exp-to-pow89.2%
exp-prod89.2%
associate-*l*89.2%
metadata-eval89.2%
exp-to-pow95.0%
rem-cbrt-cube94.7%
*-commutative94.7%
cube-prod94.5%
rem-cube-cbrt94.8%
metadata-eval95.1%
Simplified95.1%
if 9.00000000000000018e154 < x Initial program 4.8%
Taylor expanded in x around inf 4.8%
pow1/34.8%
pow-flip7.2%
pow-pow89.2%
metadata-eval89.2%
metadata-eval89.2%
Applied egg-rr89.2%
Final simplification92.1%
(FPCore (x)
:precision binary64
(if (<= x 1.35e+154)
(+
(* -0.1111111111111111 (pow x -1.6666666666666667))
(* 0.3333333333333333 (cbrt (/ 1.0 (pow x 2.0)))))
(+
(* -0.1111111111111111 (cbrt (/ 1.0 (pow x 5.0))))
(* 0.3333333333333333 (pow x -0.6666666666666666)))))
double code(double x) {
double tmp;
if (x <= 1.35e+154) {
tmp = (-0.1111111111111111 * pow(x, -1.6666666666666667)) + (0.3333333333333333 * cbrt((1.0 / pow(x, 2.0))));
} else {
tmp = (-0.1111111111111111 * cbrt((1.0 / pow(x, 5.0)))) + (0.3333333333333333 * pow(x, -0.6666666666666666));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 1.35e+154) {
tmp = (-0.1111111111111111 * Math.pow(x, -1.6666666666666667)) + (0.3333333333333333 * Math.cbrt((1.0 / Math.pow(x, 2.0))));
} else {
tmp = (-0.1111111111111111 * Math.cbrt((1.0 / Math.pow(x, 5.0)))) + (0.3333333333333333 * Math.pow(x, -0.6666666666666666));
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 1.35e+154) tmp = Float64(Float64(-0.1111111111111111 * (x ^ -1.6666666666666667)) + Float64(0.3333333333333333 * cbrt(Float64(1.0 / (x ^ 2.0))))); else tmp = Float64(Float64(-0.1111111111111111 * cbrt(Float64(1.0 / (x ^ 5.0)))) + Float64(0.3333333333333333 * (x ^ -0.6666666666666666))); end return tmp end
code[x_] := If[LessEqual[x, 1.35e+154], N[(N[(-0.1111111111111111 * N[Power[x, -1.6666666666666667], $MachinePrecision]), $MachinePrecision] + N[(0.3333333333333333 * N[Power[N[(1.0 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-0.1111111111111111 * N[Power[N[(1.0 / N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] + N[(0.3333333333333333 * N[Power[x, -0.6666666666666666], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;-0.1111111111111111 \cdot {x}^{-1.6666666666666667} + 0.3333333333333333 \cdot \sqrt[3]{\frac{1}{{x}^{2}}}\\
\mathbf{else}:\\
\;\;\;\;-0.1111111111111111 \cdot \sqrt[3]{\frac{1}{{x}^{5}}} + 0.3333333333333333 \cdot {x}^{-0.6666666666666666}\\
\end{array}
\end{array}
if x < 1.35000000000000003e154Initial program 8.8%
Taylor expanded in x around inf 96.9%
pow1/396.9%
pow-flip96.9%
pow-pow96.9%
metadata-eval96.9%
metadata-eval96.9%
Applied egg-rr96.9%
if 1.35000000000000003e154 < x Initial program 4.8%
Taylor expanded in x around inf 4.8%
pow1/34.8%
pow-flip7.2%
pow-pow89.2%
metadata-eval89.2%
metadata-eval89.2%
Applied egg-rr89.2%
Final simplification93.0%
(FPCore (x) :precision binary64 (+ (* -0.1111111111111111 (pow x -1.6666666666666667)) (* 0.3333333333333333 (pow (cbrt (/ 1.0 x)) 2.0))))
double code(double x) {
return (-0.1111111111111111 * pow(x, -1.6666666666666667)) + (0.3333333333333333 * pow(cbrt((1.0 / x)), 2.0));
}
public static double code(double x) {
return (-0.1111111111111111 * Math.pow(x, -1.6666666666666667)) + (0.3333333333333333 * Math.pow(Math.cbrt((1.0 / x)), 2.0));
}
function code(x) return Float64(Float64(-0.1111111111111111 * (x ^ -1.6666666666666667)) + Float64(0.3333333333333333 * (cbrt(Float64(1.0 / x)) ^ 2.0))) end
code[x_] := N[(N[(-0.1111111111111111 * N[Power[x, -1.6666666666666667], $MachinePrecision]), $MachinePrecision] + N[(0.3333333333333333 * N[Power[N[Power[N[(1.0 / x), $MachinePrecision], 1/3], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.1111111111111111 \cdot {x}^{-1.6666666666666667} + 0.3333333333333333 \cdot {\left(\sqrt[3]{\frac{1}{x}}\right)}^{2}
\end{array}
Initial program 6.8%
Taylor expanded in x around inf 49.8%
add-sqr-sqrt49.7%
cbrt-prod49.4%
sqrt-div49.4%
metadata-eval49.4%
unpow249.4%
sqrt-prod49.5%
add-sqr-sqrt49.4%
sqrt-div49.4%
metadata-eval49.4%
unpow249.4%
sqrt-prod97.2%
add-sqr-sqrt97.2%
Applied egg-rr97.2%
unpow297.2%
Simplified97.2%
pow1/349.8%
pow-flip49.8%
pow-pow49.7%
metadata-eval49.7%
metadata-eval49.7%
Applied egg-rr97.2%
Final simplification97.2%
(FPCore (x) :precision binary64 (+ (* -0.1111111111111111 (pow x -1.6666666666666667)) (* 0.3333333333333333 (pow (/ 1.0 (cbrt x)) 2.0))))
double code(double x) {
return (-0.1111111111111111 * pow(x, -1.6666666666666667)) + (0.3333333333333333 * pow((1.0 / cbrt(x)), 2.0));
}
public static double code(double x) {
return (-0.1111111111111111 * Math.pow(x, -1.6666666666666667)) + (0.3333333333333333 * Math.pow((1.0 / Math.cbrt(x)), 2.0));
}
function code(x) return Float64(Float64(-0.1111111111111111 * (x ^ -1.6666666666666667)) + Float64(0.3333333333333333 * (Float64(1.0 / cbrt(x)) ^ 2.0))) end
code[x_] := N[(N[(-0.1111111111111111 * N[Power[x, -1.6666666666666667], $MachinePrecision]), $MachinePrecision] + N[(0.3333333333333333 * N[Power[N[(1.0 / N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.1111111111111111 \cdot {x}^{-1.6666666666666667} + 0.3333333333333333 \cdot {\left(\frac{1}{\sqrt[3]{x}}\right)}^{2}
\end{array}
Initial program 6.8%
Taylor expanded in x around inf 49.8%
add-sqr-sqrt49.7%
cbrt-prod49.4%
sqrt-div49.4%
metadata-eval49.4%
unpow249.4%
sqrt-prod49.5%
add-sqr-sqrt49.4%
sqrt-div49.4%
metadata-eval49.4%
unpow249.4%
sqrt-prod97.2%
add-sqr-sqrt97.2%
Applied egg-rr97.2%
unpow297.2%
Simplified97.2%
cbrt-div97.4%
metadata-eval97.4%
Applied egg-rr97.4%
pow1/349.8%
pow-flip49.8%
pow-pow49.7%
metadata-eval49.7%
metadata-eval49.7%
Applied egg-rr97.4%
Final simplification97.4%
(FPCore (x) :precision binary64 (cbrt (* (pow x -2.0) 0.037037037037037035)))
double code(double x) {
return cbrt((pow(x, -2.0) * 0.037037037037037035));
}
public static double code(double x) {
return Math.cbrt((Math.pow(x, -2.0) * 0.037037037037037035));
}
function code(x) return cbrt(Float64((x ^ -2.0) * 0.037037037037037035)) end
code[x_] := N[Power[N[(N[Power[x, -2.0], $MachinePrecision] * 0.037037037037037035), $MachinePrecision], 1/3], $MachinePrecision]
\begin{array}{l}
\\
\sqrt[3]{{x}^{-2} \cdot 0.037037037037037035}
\end{array}
Initial program 6.8%
pow1/37.6%
pow-to-exp6.9%
Applied egg-rr6.9%
Taylor expanded in x around inf 48.8%
unpow-148.8%
exp-to-pow46.0%
exp-prod47.2%
associate-*l*47.2%
metadata-eval47.2%
exp-to-pow50.1%
rem-cbrt-cube49.6%
*-commutative49.6%
cube-prod49.5%
rem-cube-cbrt49.6%
metadata-eval49.8%
Simplified49.8%
Final simplification49.8%
(FPCore (x) :precision binary64 (* 0.3333333333333333 (cbrt (pow x -2.0))))
double code(double x) {
return 0.3333333333333333 * cbrt(pow(x, -2.0));
}
public static double code(double x) {
return 0.3333333333333333 * Math.cbrt(Math.pow(x, -2.0));
}
function code(x) return Float64(0.3333333333333333 * cbrt((x ^ -2.0))) end
code[x_] := N[(0.3333333333333333 * N[Power[N[Power[x, -2.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.3333333333333333 \cdot \sqrt[3]{{x}^{-2}}
\end{array}
Initial program 6.8%
pow1/37.6%
pow-to-exp6.9%
Applied egg-rr6.9%
Taylor expanded in x around inf 48.8%
unpow-148.8%
exp-to-pow46.0%
exp-prod47.2%
associate-*l*47.2%
metadata-eval47.2%
exp-to-pow50.1%
Simplified50.1%
Final simplification50.1%
(FPCore (x) :precision binary64 (+ 1.0 (cbrt x)))
double code(double x) {
return 1.0 + cbrt(x);
}
public static double code(double x) {
return 1.0 + Math.cbrt(x);
}
function code(x) return Float64(1.0 + cbrt(x)) end
code[x_] := N[(1.0 + N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \sqrt[3]{x}
\end{array}
Initial program 6.8%
Taylor expanded in x around 0 1.8%
sub-neg1.8%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt5.2%
fabs-neg5.2%
unpow1/35.2%
metadata-eval5.2%
pow-sqr5.2%
fabs-sqr5.2%
pow-sqr5.2%
metadata-eval5.2%
unpow1/35.2%
Simplified5.2%
Final simplification5.2%
(FPCore (x) :precision binary64 (let* ((t_0 (cbrt (+ x 1.0)))) (/ 1.0 (+ (+ (* t_0 t_0) (* (cbrt x) t_0)) (* (cbrt x) (cbrt x))))))
double code(double x) {
double t_0 = cbrt((x + 1.0));
return 1.0 / (((t_0 * t_0) + (cbrt(x) * t_0)) + (cbrt(x) * cbrt(x)));
}
public static double code(double x) {
double t_0 = Math.cbrt((x + 1.0));
return 1.0 / (((t_0 * t_0) + (Math.cbrt(x) * t_0)) + (Math.cbrt(x) * Math.cbrt(x)));
}
function code(x) t_0 = cbrt(Float64(x + 1.0)) return Float64(1.0 / Float64(Float64(Float64(t_0 * t_0) + Float64(cbrt(x) * t_0)) + Float64(cbrt(x) * cbrt(x)))) end
code[x_] := Block[{t$95$0 = N[Power[N[(x + 1.0), $MachinePrecision], 1/3], $MachinePrecision]}, N[(1.0 / N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] + N[(N[Power[x, 1/3], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(N[Power[x, 1/3], $MachinePrecision] * N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{x + 1}\\
\frac{1}{\left(t\_0 \cdot t\_0 + \sqrt[3]{x} \cdot t\_0\right) + \sqrt[3]{x} \cdot \sqrt[3]{x}}
\end{array}
\end{array}
herbie shell --seed 2024046
(FPCore (x)
:name "2cbrt (problem 3.3.4)"
:precision binary64
:pre (and (> x 1.0) (< x 1e+308))
:alt
(/ 1.0 (+ (+ (* (cbrt (+ x 1.0)) (cbrt (+ x 1.0))) (* (cbrt x) (cbrt (+ x 1.0)))) (* (cbrt x) (cbrt x))))
(- (cbrt (+ x 1.0)) (cbrt x)))