
(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 13 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 (+ x 1.0))))
(if (<= (- t_0 (cbrt x)) 1e-10)
(* 0.3333333333333333 (/ (cbrt (- (pow (/ -1.0 x) -1.0))) x))
(/
1.0
(fma (cbrt x) (+ (cbrt x) t_0) (pow (+ x 1.0) 0.6666666666666666))))))
double code(double x) {
double t_0 = cbrt((x + 1.0));
double tmp;
if ((t_0 - cbrt(x)) <= 1e-10) {
tmp = 0.3333333333333333 * (cbrt(-pow((-1.0 / x), -1.0)) / x);
} else {
tmp = 1.0 / fma(cbrt(x), (cbrt(x) + t_0), pow((x + 1.0), 0.6666666666666666));
}
return tmp;
}
function code(x) t_0 = cbrt(Float64(x + 1.0)) tmp = 0.0 if (Float64(t_0 - cbrt(x)) <= 1e-10) tmp = Float64(0.3333333333333333 * Float64(cbrt(Float64(-(Float64(-1.0 / x) ^ -1.0))) / x)); else tmp = Float64(1.0 / fma(cbrt(x), Float64(cbrt(x) + t_0), (Float64(x + 1.0) ^ 0.6666666666666666))); end return tmp end
code[x_] := Block[{t$95$0 = N[Power[N[(x + 1.0), $MachinePrecision], 1/3], $MachinePrecision]}, If[LessEqual[N[(t$95$0 - N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision], 1e-10], N[(0.3333333333333333 * N[(N[Power[(-N[Power[N[(-1.0 / x), $MachinePrecision], -1.0], $MachinePrecision]), 1/3], $MachinePrecision] / x), $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[(x + 1.0), $MachinePrecision], 0.6666666666666666], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{x + 1}\\
\mathbf{if}\;t\_0 - \sqrt[3]{x} \leq 10^{-10}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\sqrt[3]{-{\left(\frac{-1}{x}\right)}^{-1}}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt[3]{x}, \sqrt[3]{x} + t\_0, {\left(x + 1\right)}^{0.6666666666666666}\right)}\\
\end{array}
\end{array}
if (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) < 1.00000000000000004e-10Initial program 4.2%
add-sqr-sqrt4.0%
add-sqr-sqrt4.2%
difference-of-squares4.2%
pow1/34.2%
sqrt-pow14.2%
metadata-eval4.2%
pow1/34.2%
sqrt-pow14.2%
metadata-eval4.2%
pow1/31.8%
sqrt-pow11.8%
metadata-eval1.8%
pow1/34.2%
sqrt-pow14.2%
metadata-eval4.2%
Applied egg-rr4.2%
Taylor expanded in x around -inf 0.0%
Simplified99.1%
if 1.00000000000000004e-10 < (-.f64 (cbrt.f64 (+.f64 x 1)) (cbrt.f64 x)) Initial program 56.9%
pow1/354.1%
pow-to-exp53.6%
Applied egg-rr53.6%
exp-to-pow54.1%
pow1/356.9%
flip3--59.5%
div-inv59.5%
rem-cube-cbrt70.3%
rem-cube-cbrt98.6%
pow298.6%
distribute-rgt-out98.3%
+-commutative98.3%
Applied egg-rr98.3%
associate-*r/98.3%
*-rgt-identity98.3%
+-commutative98.3%
associate--l+98.3%
+-inverses98.3%
metadata-eval98.3%
+-commutative98.3%
fma-def98.2%
+-commutative98.2%
+-commutative98.2%
Simplified98.2%
unpow298.2%
pow1/399.0%
metadata-eval99.0%
pow-sqr99.1%
+-commutative99.1%
+-commutative99.1%
associate-*l*99.0%
+-commutative99.0%
pow1/398.8%
metadata-eval98.8%
pow-sqr98.8%
+-commutative98.8%
+-commutative98.8%
cube-mult98.9%
+-commutative98.9%
pow-pow99.2%
metadata-eval99.2%
pow1/299.2%
add-sqr-sqrt99.2%
hypot-1-def99.2%
Applied egg-rr99.2%
metadata-eval99.2%
sqrt-pow199.3%
pow1/398.7%
hypot-udef98.5%
metadata-eval98.5%
add-sqr-sqrt98.5%
add-cube-cbrt98.3%
sqrt-prod98.5%
sqrt-unprod98.4%
associate-*l*98.4%
add-sqr-sqrt98.5%
associate-*l*98.3%
add-sqr-sqrt98.2%
pow1/399.0%
pow1/398.6%
Applied egg-rr98.8%
Final simplification99.1%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (- (pow (/ -1.0 x) -1.0)))))
(-
(+
(* (/ t_0 (pow x 2.0)) -0.1111111111111111)
(* 0.3333333333333333 (/ (cbrt x) x)))
(/ (* t_0 -0.06172839506172839) (pow x 3.0)))))
double code(double x) {
double t_0 = cbrt(-pow((-1.0 / x), -1.0));
return (((t_0 / pow(x, 2.0)) * -0.1111111111111111) + (0.3333333333333333 * (cbrt(x) / x))) - ((t_0 * -0.06172839506172839) / pow(x, 3.0));
}
public static double code(double x) {
double t_0 = Math.cbrt(-Math.pow((-1.0 / x), -1.0));
return (((t_0 / Math.pow(x, 2.0)) * -0.1111111111111111) + (0.3333333333333333 * (Math.cbrt(x) / x))) - ((t_0 * -0.06172839506172839) / Math.pow(x, 3.0));
}
function code(x) t_0 = cbrt(Float64(-(Float64(-1.0 / x) ^ -1.0))) return Float64(Float64(Float64(Float64(t_0 / (x ^ 2.0)) * -0.1111111111111111) + Float64(0.3333333333333333 * Float64(cbrt(x) / x))) - Float64(Float64(t_0 * -0.06172839506172839) / (x ^ 3.0))) end
code[x_] := Block[{t$95$0 = N[Power[(-N[Power[N[(-1.0 / x), $MachinePrecision], -1.0], $MachinePrecision]), 1/3], $MachinePrecision]}, N[(N[(N[(N[(t$95$0 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision] * -0.1111111111111111), $MachinePrecision] + N[(0.3333333333333333 * N[(N[Power[x, 1/3], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(t$95$0 * -0.06172839506172839), $MachinePrecision] / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{-{\left(\frac{-1}{x}\right)}^{-1}}\\
\left(\frac{t\_0}{{x}^{2}} \cdot -0.1111111111111111 + 0.3333333333333333 \cdot \frac{\sqrt[3]{x}}{x}\right) - \frac{t\_0 \cdot -0.06172839506172839}{{x}^{3}}
\end{array}
\end{array}
Initial program 6.7%
add-sqr-sqrt6.4%
add-sqr-sqrt6.7%
difference-of-squares6.7%
pow1/36.7%
sqrt-pow16.7%
metadata-eval6.7%
pow1/36.7%
sqrt-pow16.7%
metadata-eval6.7%
pow1/34.3%
sqrt-pow14.3%
metadata-eval4.3%
pow1/36.8%
sqrt-pow16.8%
metadata-eval6.8%
Applied egg-rr6.8%
Taylor expanded in x around -inf 0.0%
+-commutative0.0%
mul-1-neg0.0%
Simplified98.9%
add-sqr-sqrt98.8%
sqrt-unprod48.5%
mul-1-neg48.5%
mul-1-neg48.5%
sqr-neg48.5%
unpow-148.5%
unpow-148.5%
frac-times48.6%
metadata-eval48.6%
frac-times48.6%
metadata-eval48.6%
unpow248.6%
clear-num48.5%
/-rgt-identity48.5%
unpow248.5%
sqrt-prod98.9%
add-sqr-sqrt99.0%
expm1-log1p-u93.3%
expm1-udef93.3%
Applied egg-rr93.3%
expm1-def93.3%
expm1-log1p99.0%
Simplified99.0%
Final simplification99.0%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (- (pow (/ -1.0 x) -1.0)))))
(-
(+
(* -0.1111111111111111 (* (/ -1.0 x) (* (/ -1.0 x) (cbrt x))))
(* 0.3333333333333333 (/ t_0 x)))
(/ (* t_0 -0.06172839506172839) (pow x 3.0)))))
double code(double x) {
double t_0 = cbrt(-pow((-1.0 / x), -1.0));
return ((-0.1111111111111111 * ((-1.0 / x) * ((-1.0 / x) * cbrt(x)))) + (0.3333333333333333 * (t_0 / x))) - ((t_0 * -0.06172839506172839) / pow(x, 3.0));
}
public static double code(double x) {
double t_0 = Math.cbrt(-Math.pow((-1.0 / x), -1.0));
return ((-0.1111111111111111 * ((-1.0 / x) * ((-1.0 / x) * Math.cbrt(x)))) + (0.3333333333333333 * (t_0 / x))) - ((t_0 * -0.06172839506172839) / Math.pow(x, 3.0));
}
function code(x) t_0 = cbrt(Float64(-(Float64(-1.0 / x) ^ -1.0))) return Float64(Float64(Float64(-0.1111111111111111 * Float64(Float64(-1.0 / x) * Float64(Float64(-1.0 / x) * cbrt(x)))) + Float64(0.3333333333333333 * Float64(t_0 / x))) - Float64(Float64(t_0 * -0.06172839506172839) / (x ^ 3.0))) end
code[x_] := Block[{t$95$0 = N[Power[(-N[Power[N[(-1.0 / x), $MachinePrecision], -1.0], $MachinePrecision]), 1/3], $MachinePrecision]}, N[(N[(N[(-0.1111111111111111 * N[(N[(-1.0 / x), $MachinePrecision] * N[(N[(-1.0 / x), $MachinePrecision] * N[Power[x, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.3333333333333333 * N[(t$95$0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(t$95$0 * -0.06172839506172839), $MachinePrecision] / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{-{\left(\frac{-1}{x}\right)}^{-1}}\\
\left(-0.1111111111111111 \cdot \left(\frac{-1}{x} \cdot \left(\frac{-1}{x} \cdot \sqrt[3]{x}\right)\right) + 0.3333333333333333 \cdot \frac{t\_0}{x}\right) - \frac{t\_0 \cdot -0.06172839506172839}{{x}^{3}}
\end{array}
\end{array}
Initial program 6.7%
add-sqr-sqrt6.4%
add-sqr-sqrt6.7%
difference-of-squares6.7%
pow1/36.7%
sqrt-pow16.7%
metadata-eval6.7%
pow1/36.7%
sqrt-pow16.7%
metadata-eval6.7%
pow1/34.3%
sqrt-pow14.3%
metadata-eval4.3%
pow1/36.8%
sqrt-pow16.8%
metadata-eval6.8%
Applied egg-rr6.8%
Taylor expanded in x around -inf 0.0%
+-commutative0.0%
mul-1-neg0.0%
Simplified98.9%
div-inv98.9%
add-sqr-sqrt98.9%
associate-*r*98.9%
Applied egg-rr98.9%
Final simplification98.9%
(FPCore (x)
:precision binary64
(let* ((t_0 (cbrt (- (pow (/ -1.0 x) -1.0)))))
(+
(* (/ t_0 (pow x 2.0)) -0.1111111111111111)
(* 0.3333333333333333 (/ t_0 x)))))
double code(double x) {
double t_0 = cbrt(-pow((-1.0 / x), -1.0));
return ((t_0 / pow(x, 2.0)) * -0.1111111111111111) + (0.3333333333333333 * (t_0 / x));
}
public static double code(double x) {
double t_0 = Math.cbrt(-Math.pow((-1.0 / x), -1.0));
return ((t_0 / Math.pow(x, 2.0)) * -0.1111111111111111) + (0.3333333333333333 * (t_0 / x));
}
function code(x) t_0 = cbrt(Float64(-(Float64(-1.0 / x) ^ -1.0))) return Float64(Float64(Float64(t_0 / (x ^ 2.0)) * -0.1111111111111111) + Float64(0.3333333333333333 * Float64(t_0 / x))) end
code[x_] := Block[{t$95$0 = N[Power[(-N[Power[N[(-1.0 / x), $MachinePrecision], -1.0], $MachinePrecision]), 1/3], $MachinePrecision]}, N[(N[(N[(t$95$0 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision] * -0.1111111111111111), $MachinePrecision] + N[(0.3333333333333333 * N[(t$95$0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{-{\left(\frac{-1}{x}\right)}^{-1}}\\
\frac{t\_0}{{x}^{2}} \cdot -0.1111111111111111 + 0.3333333333333333 \cdot \frac{t\_0}{x}
\end{array}
\end{array}
Initial program 6.7%
add-sqr-sqrt6.4%
add-sqr-sqrt6.7%
difference-of-squares6.7%
pow1/36.7%
sqrt-pow16.7%
metadata-eval6.7%
pow1/36.7%
sqrt-pow16.7%
metadata-eval6.7%
pow1/34.3%
sqrt-pow14.3%
metadata-eval4.3%
pow1/36.8%
sqrt-pow16.8%
metadata-eval6.8%
Applied egg-rr6.8%
Taylor expanded in x around -inf 0.0%
associate-+r+0.0%
Simplified98.6%
Final simplification98.6%
(FPCore (x) :precision binary64 (let* ((t_0 (cbrt (+ x 1.0)))) (/ 1.0 (+ (pow t_0 2.0) (* (cbrt x) (+ (cbrt x) t_0))))))
double code(double x) {
double t_0 = cbrt((x + 1.0));
return 1.0 / (pow(t_0, 2.0) + (cbrt(x) * (cbrt(x) + t_0)));
}
public static double code(double x) {
double t_0 = Math.cbrt((x + 1.0));
return 1.0 / (Math.pow(t_0, 2.0) + (Math.cbrt(x) * (Math.cbrt(x) + t_0)));
}
function code(x) t_0 = cbrt(Float64(x + 1.0)) return Float64(1.0 / Float64((t_0 ^ 2.0) + Float64(cbrt(x) * Float64(cbrt(x) + t_0)))) end
code[x_] := Block[{t$95$0 = N[Power[N[(x + 1.0), $MachinePrecision], 1/3], $MachinePrecision]}, N[(1.0 / 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]{x + 1}\\
\frac{1}{{t\_0}^{2} + \sqrt[3]{x} \cdot \left(\sqrt[3]{x} + t\_0\right)}
\end{array}
\end{array}
Initial program 6.7%
pow1/37.7%
pow-to-exp6.9%
Applied egg-rr6.9%
exp-to-pow7.7%
pow1/36.7%
flip3--6.8%
div-inv6.8%
rem-cube-cbrt6.6%
rem-cube-cbrt8.7%
pow28.7%
distribute-rgt-out8.7%
+-commutative8.7%
Applied egg-rr8.7%
associate-*r/8.7%
*-rgt-identity8.7%
+-commutative8.7%
associate--l+98.3%
+-inverses98.3%
metadata-eval98.3%
+-commutative98.3%
fma-def98.3%
+-commutative98.3%
+-commutative98.3%
Simplified98.3%
fma-udef98.3%
+-commutative98.3%
Applied egg-rr98.3%
Final simplification98.3%
(FPCore (x) :precision binary64 (if (<= x 1.8e+155) (* 0.3333333333333333 (cbrt (pow x -2.0))) (* 0.3333333333333333 (pow x -0.6666666666666666))))
double code(double x) {
double tmp;
if (x <= 1.8e+155) {
tmp = 0.3333333333333333 * cbrt(pow(x, -2.0));
} else {
tmp = 0.3333333333333333 * pow(x, -0.6666666666666666);
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 1.8e+155) {
tmp = 0.3333333333333333 * Math.cbrt(Math.pow(x, -2.0));
} else {
tmp = 0.3333333333333333 * Math.pow(x, -0.6666666666666666);
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 1.8e+155) tmp = Float64(0.3333333333333333 * cbrt((x ^ -2.0))); else tmp = Float64(0.3333333333333333 * (x ^ -0.6666666666666666)); end return tmp end
code[x_] := If[LessEqual[x, 1.8e+155], N[(0.3333333333333333 * N[Power[N[Power[x, -2.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(0.3333333333333333 * N[Power[x, -0.6666666666666666], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.8 \cdot 10^{+155}:\\
\;\;\;\;0.3333333333333333 \cdot \sqrt[3]{{x}^{-2}}\\
\mathbf{else}:\\
\;\;\;\;0.3333333333333333 \cdot {x}^{-0.6666666666666666}\\
\end{array}
\end{array}
if x < 1.80000000000000004e155Initial program 8.9%
add-sqr-sqrt9.2%
add-sqr-sqrt8.7%
difference-of-squares8.8%
pow1/38.8%
sqrt-pow18.8%
metadata-eval8.8%
pow1/38.8%
sqrt-pow18.8%
metadata-eval8.8%
pow1/36.9%
sqrt-pow16.9%
metadata-eval6.9%
pow1/39.3%
sqrt-pow19.0%
metadata-eval9.0%
Applied egg-rr9.0%
Taylor expanded in x around inf 88.2%
unpow1/394.4%
Simplified94.4%
expm1-log1p-u94.4%
expm1-udef10.4%
metadata-eval10.4%
unpow210.4%
frac-times10.4%
cbrt-unprod10.4%
cbrt-unprod10.4%
frac-times10.4%
metadata-eval10.4%
unpow210.4%
pow-flip10.4%
metadata-eval10.4%
Applied egg-rr10.4%
expm1-def95.1%
expm1-log1p95.1%
Simplified95.1%
if 1.80000000000000004e155 < x Initial program 4.7%
add-sqr-sqrt3.8%
add-sqr-sqrt4.7%
difference-of-squares4.7%
pow1/34.7%
sqrt-pow14.7%
metadata-eval4.7%
pow1/34.7%
sqrt-pow14.7%
metadata-eval4.7%
pow1/31.9%
sqrt-pow11.9%
metadata-eval1.9%
pow1/34.5%
sqrt-pow14.7%
metadata-eval4.7%
Applied egg-rr4.7%
Taylor expanded in x around inf 4.7%
unpow1/34.7%
Simplified4.7%
pow1/34.7%
pow-flip9.0%
pow-pow89.2%
metadata-eval89.2%
metadata-eval89.2%
Applied egg-rr89.2%
Final simplification92.0%
(FPCore (x) :precision binary64 (* 0.3333333333333333 (/ (cbrt (- (pow (/ -1.0 x) -1.0))) x)))
double code(double x) {
return 0.3333333333333333 * (cbrt(-pow((-1.0 / x), -1.0)) / x);
}
public static double code(double x) {
return 0.3333333333333333 * (Math.cbrt(-Math.pow((-1.0 / x), -1.0)) / x);
}
function code(x) return Float64(0.3333333333333333 * Float64(cbrt(Float64(-(Float64(-1.0 / x) ^ -1.0))) / x)) end
code[x_] := N[(0.3333333333333333 * N[(N[Power[(-N[Power[N[(-1.0 / x), $MachinePrecision], -1.0], $MachinePrecision]), 1/3], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.3333333333333333 \cdot \frac{\sqrt[3]{-{\left(\frac{-1}{x}\right)}^{-1}}}{x}
\end{array}
Initial program 6.7%
add-sqr-sqrt6.4%
add-sqr-sqrt6.7%
difference-of-squares6.7%
pow1/36.7%
sqrt-pow16.7%
metadata-eval6.7%
pow1/36.7%
sqrt-pow16.7%
metadata-eval6.7%
pow1/34.3%
sqrt-pow14.3%
metadata-eval4.3%
pow1/36.8%
sqrt-pow16.8%
metadata-eval6.8%
Applied egg-rr6.8%
Taylor expanded in x around -inf 0.0%
Simplified97.4%
Final simplification97.4%
(FPCore (x) :precision binary64 (* 0.3333333333333333 (pow (cbrt x) -2.0)))
double code(double x) {
return 0.3333333333333333 * pow(cbrt(x), -2.0);
}
public static double code(double x) {
return 0.3333333333333333 * Math.pow(Math.cbrt(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, 1/3], $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.3333333333333333 \cdot {\left(\sqrt[3]{x}\right)}^{-2}
\end{array}
Initial program 6.7%
add-sqr-sqrt6.4%
add-sqr-sqrt6.7%
difference-of-squares6.7%
pow1/36.7%
sqrt-pow16.7%
metadata-eval6.7%
pow1/36.7%
sqrt-pow16.7%
metadata-eval6.7%
pow1/34.3%
sqrt-pow14.3%
metadata-eval4.3%
pow1/36.8%
sqrt-pow16.8%
metadata-eval6.8%
Applied egg-rr6.8%
Taylor expanded in x around inf 45.1%
unpow1/348.1%
Simplified48.1%
metadata-eval48.1%
unpow248.1%
frac-times50.7%
cbrt-unprod96.4%
Applied egg-rr96.6%
unpow-196.6%
unpow-196.6%
pow-sqr96.6%
metadata-eval96.6%
Simplified96.6%
Final simplification96.6%
(FPCore (x) :precision binary64 (/ 0.3333333333333333 (pow (cbrt x) 2.0)))
double code(double x) {
return 0.3333333333333333 / pow(cbrt(x), 2.0);
}
public static double code(double x) {
return 0.3333333333333333 / Math.pow(Math.cbrt(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, 1/3], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.3333333333333333}{{\left(\sqrt[3]{x}\right)}^{2}}
\end{array}
Initial program 6.7%
add-sqr-sqrt6.4%
add-sqr-sqrt6.7%
difference-of-squares6.7%
pow1/36.7%
sqrt-pow16.7%
metadata-eval6.7%
pow1/36.7%
sqrt-pow16.7%
metadata-eval6.7%
pow1/34.3%
sqrt-pow14.3%
metadata-eval4.3%
pow1/36.8%
sqrt-pow16.8%
metadata-eval6.8%
Applied egg-rr6.8%
Taylor expanded in x around inf 45.1%
unpow1/348.1%
Simplified48.1%
cbrt-div48.3%
metadata-eval48.3%
unpow248.3%
cbrt-prod96.6%
un-div-inv96.6%
pow296.6%
Applied egg-rr96.6%
Final simplification96.6%
(FPCore (x) :precision binary64 (if (<= x 1.8e+155) (* 0.3333333333333333 (cbrt (* (/ -1.0 x) (/ -1.0 x)))) (* 0.3333333333333333 (pow x -0.6666666666666666))))
double code(double x) {
double tmp;
if (x <= 1.8e+155) {
tmp = 0.3333333333333333 * cbrt(((-1.0 / x) * (-1.0 / x)));
} else {
tmp = 0.3333333333333333 * pow(x, -0.6666666666666666);
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 1.8e+155) {
tmp = 0.3333333333333333 * Math.cbrt(((-1.0 / x) * (-1.0 / x)));
} else {
tmp = 0.3333333333333333 * Math.pow(x, -0.6666666666666666);
}
return tmp;
}
function code(x) tmp = 0.0 if (x <= 1.8e+155) tmp = Float64(0.3333333333333333 * cbrt(Float64(Float64(-1.0 / x) * Float64(-1.0 / x)))); else tmp = Float64(0.3333333333333333 * (x ^ -0.6666666666666666)); end return tmp end
code[x_] := If[LessEqual[x, 1.8e+155], N[(0.3333333333333333 * N[Power[N[(N[(-1.0 / x), $MachinePrecision] * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(0.3333333333333333 * N[Power[x, -0.6666666666666666], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.8 \cdot 10^{+155}:\\
\;\;\;\;0.3333333333333333 \cdot \sqrt[3]{\frac{-1}{x} \cdot \frac{-1}{x}}\\
\mathbf{else}:\\
\;\;\;\;0.3333333333333333 \cdot {x}^{-0.6666666666666666}\\
\end{array}
\end{array}
if x < 1.80000000000000004e155Initial program 8.9%
add-sqr-sqrt9.2%
add-sqr-sqrt8.7%
difference-of-squares8.8%
pow1/38.8%
sqrt-pow18.8%
metadata-eval8.8%
pow1/38.8%
sqrt-pow18.8%
metadata-eval8.8%
pow1/36.9%
sqrt-pow16.9%
metadata-eval6.9%
pow1/39.3%
sqrt-pow19.0%
metadata-eval9.0%
Applied egg-rr9.0%
Taylor expanded in x around inf 88.2%
unpow1/394.4%
Simplified94.4%
metadata-eval94.4%
unpow294.4%
frac-times95.0%
Applied egg-rr95.0%
if 1.80000000000000004e155 < x Initial program 4.7%
add-sqr-sqrt3.8%
add-sqr-sqrt4.7%
difference-of-squares4.7%
pow1/34.7%
sqrt-pow14.7%
metadata-eval4.7%
pow1/34.7%
sqrt-pow14.7%
metadata-eval4.7%
pow1/31.9%
sqrt-pow11.9%
metadata-eval1.9%
pow1/34.5%
sqrt-pow14.7%
metadata-eval4.7%
Applied egg-rr4.7%
Taylor expanded in x around inf 4.7%
unpow1/34.7%
Simplified4.7%
pow1/34.7%
pow-flip9.0%
pow-pow89.2%
metadata-eval89.2%
metadata-eval89.2%
Applied egg-rr89.2%
Final simplification92.0%
(FPCore (x) :precision binary64 (* 0.3333333333333333 (pow x -0.6666666666666666)))
double code(double x) {
return 0.3333333333333333 * pow(x, -0.6666666666666666);
}
real(8) function code(x)
real(8), intent (in) :: x
code = 0.3333333333333333d0 * (x ** (-0.6666666666666666d0))
end function
public static double code(double x) {
return 0.3333333333333333 * Math.pow(x, -0.6666666666666666);
}
def code(x): return 0.3333333333333333 * math.pow(x, -0.6666666666666666)
function code(x) return Float64(0.3333333333333333 * (x ^ -0.6666666666666666)) end
function tmp = code(x) tmp = 0.3333333333333333 * (x ^ -0.6666666666666666); end
code[x_] := N[(0.3333333333333333 * N[Power[x, -0.6666666666666666], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.3333333333333333 \cdot {x}^{-0.6666666666666666}
\end{array}
Initial program 6.7%
add-sqr-sqrt6.4%
add-sqr-sqrt6.7%
difference-of-squares6.7%
pow1/36.7%
sqrt-pow16.7%
metadata-eval6.7%
pow1/36.7%
sqrt-pow16.7%
metadata-eval6.7%
pow1/34.3%
sqrt-pow14.3%
metadata-eval4.3%
pow1/36.8%
sqrt-pow16.8%
metadata-eval6.8%
Applied egg-rr6.8%
Taylor expanded in x around inf 45.1%
unpow1/348.1%
Simplified48.1%
pow1/345.1%
pow-flip47.7%
pow-pow89.0%
metadata-eval89.0%
metadata-eval89.0%
Applied egg-rr89.0%
Final simplification89.0%
(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}
Initial program 6.7%
Taylor expanded in x around inf 4.1%
Final simplification4.1%
(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}
Initial program 6.7%
Taylor expanded in x around 0 6.2%
Final simplification6.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 2024040
(FPCore (x)
:name "2cbrt (problem 3.3.4)"
:precision binary64
:pre (and (> x 1.0) (< x 1e+308))
:herbie-target
(/ 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)))