
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
(FPCore (x n)
:precision binary64
(if (<= x 550000.0)
(/
(log
(/
x
(exp
(+
(log1p x)
(/
(fma
0.16666666666666666
(/ (- (pow (log1p x) 3.0) (pow (log x) 3.0)) n)
(* (- (pow (log1p x) 2.0) (pow (log x) 2.0)) 0.5))
n)))))
(- n))
(/ (/ (pow x (/ 1.0 n)) n) x)))
double code(double x, double n) {
double tmp;
if (x <= 550000.0) {
tmp = log((x / exp((log1p(x) + (fma(0.16666666666666666, ((pow(log1p(x), 3.0) - pow(log(x), 3.0)) / n), ((pow(log1p(x), 2.0) - pow(log(x), 2.0)) * 0.5)) / n))))) / -n;
} else {
tmp = (pow(x, (1.0 / n)) / n) / x;
}
return tmp;
}
function code(x, n) tmp = 0.0 if (x <= 550000.0) tmp = Float64(log(Float64(x / exp(Float64(log1p(x) + Float64(fma(0.16666666666666666, Float64(Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0)) / n), Float64(Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0)) * 0.5)) / n))))) / Float64(-n)); else tmp = Float64(Float64((x ^ Float64(1.0 / n)) / n) / x); end return tmp end
code[x_, n_] := If[LessEqual[x, 550000.0], N[(N[Log[N[(x / N[Exp[N[(N[Log[1 + x], $MachinePrecision] + N[(N[(0.16666666666666666 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-n)), $MachinePrecision], N[(N[(N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 550000:\\
\;\;\;\;\frac{\log \left(\frac{x}{e^{\mathsf{log1p}\left(x\right) + \frac{\mathsf{fma}\left(0.16666666666666666, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}}{n}, \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) \cdot 0.5\right)}{n}}}\right)}{-n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{x}^{\left(\frac{1}{n}\right)}}{n}}{x}\\
\end{array}
\end{array}
if x < 5.5e5Initial program 48.6%
Taylor expanded in n around -inf 79.4%
Simplified79.4%
add-log-exp87.0%
diff-log87.1%
Applied egg-rr87.1%
if 5.5e5 < x Initial program 66.8%
Taylor expanded in x around inf 98.9%
associate-/r*99.4%
mul-1-neg99.4%
log-rec99.4%
mul-1-neg99.4%
distribute-neg-frac99.4%
mul-1-neg99.4%
remove-double-neg99.4%
*-rgt-identity99.4%
associate-/l*99.4%
exp-to-pow99.4%
Simplified99.4%
Final simplification91.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n)))
(t_1
(/
(cbrt
(pow
(-
(- (log x) (log1p x))
(/
(fma
0.16666666666666666
(/ (pow (- (log x)) 3.0) n)
(* (- (pow (log1p x) 2.0) (pow (log x) 2.0)) 0.5))
n))
3.0))
(- n))))
(if (<= x 8.2e-203)
t_1
(if (<= x 3e-189)
(- (exp (/ (log1p x) n)) t_0)
(if (<= x 440000.0) t_1 (/ (/ t_0 n) x))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = cbrt(pow(((log(x) - log1p(x)) - (fma(0.16666666666666666, (pow(-log(x), 3.0) / n), ((pow(log1p(x), 2.0) - pow(log(x), 2.0)) * 0.5)) / n)), 3.0)) / -n;
double tmp;
if (x <= 8.2e-203) {
tmp = t_1;
} else if (x <= 3e-189) {
tmp = exp((log1p(x) / n)) - t_0;
} else if (x <= 440000.0) {
tmp = t_1;
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(cbrt((Float64(Float64(log(x) - log1p(x)) - Float64(fma(0.16666666666666666, Float64((Float64(-log(x)) ^ 3.0) / n), Float64(Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0)) * 0.5)) / n)) ^ 3.0)) / Float64(-n)) tmp = 0.0 if (x <= 8.2e-203) tmp = t_1; elseif (x <= 3e-189) tmp = Float64(exp(Float64(log1p(x) / n)) - t_0); elseif (x <= 440000.0) tmp = t_1; else tmp = Float64(Float64(t_0 / n) / x); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[Power[N[(N[(N[Log[x], $MachinePrecision] - N[Log[1 + x], $MachinePrecision]), $MachinePrecision] - N[(N[(0.16666666666666666 * N[(N[Power[(-N[Log[x], $MachinePrecision]), 3.0], $MachinePrecision] / n), $MachinePrecision] + N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], 1/3], $MachinePrecision] / (-n)), $MachinePrecision]}, If[LessEqual[x, 8.2e-203], t$95$1, If[LessEqual[x, 3e-189], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[x, 440000.0], t$95$1, N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\sqrt[3]{{\left(\left(\log x - \mathsf{log1p}\left(x\right)\right) - \frac{\mathsf{fma}\left(0.16666666666666666, \frac{{\left(-\log x\right)}^{3}}{n}, \left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) \cdot 0.5\right)}{n}\right)}^{3}}}{-n}\\
\mathbf{if}\;x \leq 8.2 \cdot 10^{-203}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 3 \cdot 10^{-189}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\
\mathbf{elif}\;x \leq 440000:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\end{array}
\end{array}
if x < 8.19999999999999962e-203 or 3e-189 < x < 4.4e5Initial program 46.8%
Taylor expanded in n around -inf 82.0%
Simplified82.0%
add-cbrt-cube86.1%
pow386.2%
Applied egg-rr86.2%
Taylor expanded in x around 0 86.2%
neg-mul-186.2%
cube-neg86.2%
Simplified86.2%
if 8.19999999999999962e-203 < x < 3e-189Initial program 78.9%
Taylor expanded in n around 0 78.9%
log1p-define89.7%
*-rgt-identity89.7%
associate-/l*89.7%
exp-to-pow89.7%
Simplified89.7%
if 4.4e5 < x Initial program 66.8%
Taylor expanded in x around inf 98.9%
associate-/r*99.4%
mul-1-neg99.4%
log-rec99.4%
mul-1-neg99.4%
distribute-neg-frac99.4%
mul-1-neg99.4%
remove-double-neg99.4%
*-rgt-identity99.4%
associate-/l*99.4%
exp-to-pow99.4%
Simplified99.4%
Final simplification91.5%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -0.5)
(- (pow (+ x 1.0) (/ 1.0 n)) (cbrt (pow x (/ 3.0 n))))
(if (<= (/ 1.0 n) 2e-8)
(/
(-
(+
(log1p x)
(/
(+
(* (- (pow (log1p x) 2.0) (pow (log x) 2.0)) 0.5)
(*
0.16666666666666666
(/ (- (pow (log1p x) 3.0) (pow (log x) 3.0)) n)))
n))
(log x))
n)
(- (exp (/ (log1p x) n)) (pow x (/ 1.0 n))))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -0.5) {
tmp = pow((x + 1.0), (1.0 / n)) - cbrt(pow(x, (3.0 / n)));
} else if ((1.0 / n) <= 2e-8) {
tmp = ((log1p(x) + ((((pow(log1p(x), 2.0) - pow(log(x), 2.0)) * 0.5) + (0.16666666666666666 * ((pow(log1p(x), 3.0) - pow(log(x), 3.0)) / n))) / n)) - log(x)) / n;
} else {
tmp = exp((log1p(x) / n)) - pow(x, (1.0 / n));
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -0.5) {
tmp = Math.pow((x + 1.0), (1.0 / n)) - Math.cbrt(Math.pow(x, (3.0 / n)));
} else if ((1.0 / n) <= 2e-8) {
tmp = ((Math.log1p(x) + ((((Math.pow(Math.log1p(x), 2.0) - Math.pow(Math.log(x), 2.0)) * 0.5) + (0.16666666666666666 * ((Math.pow(Math.log1p(x), 3.0) - Math.pow(Math.log(x), 3.0)) / n))) / n)) - Math.log(x)) / n;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n));
}
return tmp;
}
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -0.5) tmp = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - cbrt((x ^ Float64(3.0 / n)))); elseif (Float64(1.0 / n) <= 2e-8) tmp = Float64(Float64(Float64(log1p(x) + Float64(Float64(Float64(Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0)) * 0.5) + Float64(0.16666666666666666 * Float64(Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0)) / n))) / n)) - log(x)) / n); else tmp = Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n))); end return tmp end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -0.5], N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[N[Power[x, N[(3.0 / n), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-8], N[(N[(N[(N[Log[1 + x], $MachinePrecision] + N[(N[(N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] + N[(0.16666666666666666 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -0.5:\\
\;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - \sqrt[3]{{x}^{\left(\frac{3}{n}\right)}}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\frac{\left(\mathsf{log1p}\left(x\right) + \frac{\left({\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}\right) \cdot 0.5 + 0.16666666666666666 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}}{n}}{n}\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -0.5Initial program 99.9%
add-cbrt-cube99.9%
pow399.9%
pow-pow99.9%
Applied egg-rr99.9%
associate-*l/99.9%
metadata-eval99.9%
Simplified99.9%
if -0.5 < (/.f64 #s(literal 1 binary64) n) < 2e-8Initial program 28.6%
Taylor expanded in n around -inf 75.3%
Simplified75.3%
if 2e-8 < (/.f64 #s(literal 1 binary64) n) Initial program 53.8%
Taylor expanded in n around 0 53.8%
log1p-define97.7%
*-rgt-identity97.7%
associate-/l*97.7%
exp-to-pow97.7%
Simplified97.7%
Final simplification86.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (- (pow (+ x 1.0) (/ 1.0 n)) t_0)))
(if (<= t_1 -2e-8)
(pow (cbrt (- 1.0 t_0)) 3.0)
(if (<= t_1 0.0)
(/ (- (log1p x) (log x)) n)
(log (exp (- (exp (/ (log1p x) n)) t_0)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = pow((x + 1.0), (1.0 / n)) - t_0;
double tmp;
if (t_1 <= -2e-8) {
tmp = pow(cbrt((1.0 - t_0)), 3.0);
} else if (t_1 <= 0.0) {
tmp = (log1p(x) - log(x)) / n;
} else {
tmp = log(exp((exp((log1p(x) / n)) - t_0)));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = Math.pow((x + 1.0), (1.0 / n)) - t_0;
double tmp;
if (t_1 <= -2e-8) {
tmp = Math.pow(Math.cbrt((1.0 - t_0)), 3.0);
} else if (t_1 <= 0.0) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else {
tmp = Math.log(Math.exp((Math.exp((Math.log1p(x) / n)) - t_0)));
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - t_0) tmp = 0.0 if (t_1 <= -2e-8) tmp = cbrt(Float64(1.0 - t_0)) ^ 3.0; elseif (t_1 <= 0.0) tmp = Float64(Float64(log1p(x) - log(x)) / n); else tmp = log(exp(Float64(exp(Float64(log1p(x) / n)) - t_0))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-8], N[Power[N[Power[N[(1.0 - t$95$0), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[Log[N[Exp[N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-8}:\\
\;\;\;\;{\left(\sqrt[3]{1 - t\_0}\right)}^{3}\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\log \left(e^{e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0}\right)\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -2e-8Initial program 98.7%
Taylor expanded in x around 0 98.7%
*-rgt-identity98.7%
associate-/l*98.9%
exp-to-pow98.7%
Simplified98.7%
add-cube-cbrt98.7%
pow398.7%
Applied egg-rr98.7%
if -2e-8 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 0.0Initial program 42.8%
Taylor expanded in n around inf 79.5%
log1p-define79.5%
Simplified79.5%
if 0.0 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) Initial program 55.4%
add-log-exp55.4%
pow-to-exp55.4%
un-div-inv55.4%
+-commutative55.4%
log1p-define99.3%
Applied egg-rr99.3%
Final simplification86.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (- (pow (+ x 1.0) (/ 1.0 n)) t_0)))
(if (<= t_1 -2e-8)
(pow (cbrt (- 1.0 t_0)) 3.0)
(if (<= t_1 0.0)
(/ (- (log1p x) (log x)) n)
(- (exp (/ (log1p x) n)) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = pow((x + 1.0), (1.0 / n)) - t_0;
double tmp;
if (t_1 <= -2e-8) {
tmp = pow(cbrt((1.0 - t_0)), 3.0);
} else if (t_1 <= 0.0) {
tmp = (log1p(x) - log(x)) / n;
} else {
tmp = exp((log1p(x) / n)) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = Math.pow((x + 1.0), (1.0 / n)) - t_0;
double tmp;
if (t_1 <= -2e-8) {
tmp = Math.pow(Math.cbrt((1.0 - t_0)), 3.0);
} else if (t_1 <= 0.0) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - t_0;
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - t_0) tmp = 0.0 if (t_1 <= -2e-8) tmp = cbrt(Float64(1.0 - t_0)) ^ 3.0; elseif (t_1 <= 0.0) tmp = Float64(Float64(log1p(x) - log(x)) / n); else tmp = Float64(exp(Float64(log1p(x) / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-8], N[Power[N[Power[N[(1.0 - t$95$0), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-8}:\\
\;\;\;\;{\left(\sqrt[3]{1 - t\_0}\right)}^{3}\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -2e-8Initial program 98.7%
Taylor expanded in x around 0 98.7%
*-rgt-identity98.7%
associate-/l*98.9%
exp-to-pow98.7%
Simplified98.7%
add-cube-cbrt98.7%
pow398.7%
Applied egg-rr98.7%
if -2e-8 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 0.0Initial program 42.8%
Taylor expanded in n around inf 79.5%
log1p-define79.5%
Simplified79.5%
if 0.0 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) Initial program 55.4%
Taylor expanded in n around 0 55.4%
log1p-define99.3%
*-rgt-identity99.3%
associate-/l*99.3%
exp-to-pow99.3%
Simplified99.3%
Final simplification86.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (- (pow (+ x 1.0) (/ 1.0 n)) t_0)))
(if (<= t_1 -2e-8)
(- 1.0 t_0)
(if (<= t_1 0.0)
(/ (- (log1p x) (log x)) n)
(-
(+
1.0
(*
x
(+
(/ 1.0 n)
(* x (+ (* 0.5 (* (/ 1.0 n) (/ 1.0 n))) (* 0.5 (/ -1.0 n)))))))
t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = pow((x + 1.0), (1.0 / n)) - t_0;
double tmp;
if (t_1 <= -2e-8) {
tmp = 1.0 - t_0;
} else if (t_1 <= 0.0) {
tmp = (log1p(x) - log(x)) / n;
} else {
tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * ((1.0 / n) * (1.0 / n))) + (0.5 * (-1.0 / n))))))) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = Math.pow((x + 1.0), (1.0 / n)) - t_0;
double tmp;
if (t_1 <= -2e-8) {
tmp = 1.0 - t_0;
} else if (t_1 <= 0.0) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else {
tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * ((1.0 / n) * (1.0 / n))) + (0.5 * (-1.0 / n))))))) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = math.pow((x + 1.0), (1.0 / n)) - t_0 tmp = 0 if t_1 <= -2e-8: tmp = 1.0 - t_0 elif t_1 <= 0.0: tmp = (math.log1p(x) - math.log(x)) / n else: tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * ((1.0 / n) * (1.0 / n))) + (0.5 * (-1.0 / n))))))) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - t_0) tmp = 0.0 if (t_1 <= -2e-8) tmp = Float64(1.0 - t_0); elseif (t_1 <= 0.0) tmp = Float64(Float64(log1p(x) - log(x)) / n); else tmp = Float64(Float64(1.0 + Float64(x * Float64(Float64(1.0 / n) + Float64(x * Float64(Float64(0.5 * Float64(Float64(1.0 / n) * Float64(1.0 / n))) + Float64(0.5 * Float64(-1.0 / n))))))) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-8], N[(1.0 - t$95$0), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 + N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(x * N[(N[(0.5 * N[(N[(1.0 / n), $MachinePrecision] * N[(1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-8}:\\
\;\;\;\;1 - t\_0\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + x \cdot \left(0.5 \cdot \left(\frac{1}{n} \cdot \frac{1}{n}\right) + 0.5 \cdot \frac{-1}{n}\right)\right)\right) - t\_0\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -2e-8Initial program 98.7%
Taylor expanded in x around 0 98.7%
*-rgt-identity98.7%
associate-/l*98.9%
exp-to-pow98.7%
Simplified98.7%
if -2e-8 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 0.0Initial program 42.8%
Taylor expanded in n around inf 79.5%
log1p-define79.5%
Simplified79.5%
if 0.0 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) Initial program 55.4%
Taylor expanded in x around 0 80.6%
inv-pow80.6%
unpow280.6%
unpow-prod-down80.6%
inv-pow80.6%
inv-pow80.6%
Applied egg-rr80.6%
Final simplification83.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (- (pow (+ x 1.0) (/ 1.0 n)) t_0)))
(if (<= t_1 -2e-8)
(pow (cbrt (- 1.0 t_0)) 3.0)
(if (<= t_1 0.0)
(/ (- (log1p x) (log x)) n)
(-
(+
1.0
(*
x
(+
(/ 1.0 n)
(* x (+ (* 0.5 (* (/ 1.0 n) (/ 1.0 n))) (* 0.5 (/ -1.0 n)))))))
t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = pow((x + 1.0), (1.0 / n)) - t_0;
double tmp;
if (t_1 <= -2e-8) {
tmp = pow(cbrt((1.0 - t_0)), 3.0);
} else if (t_1 <= 0.0) {
tmp = (log1p(x) - log(x)) / n;
} else {
tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * ((1.0 / n) * (1.0 / n))) + (0.5 * (-1.0 / n))))))) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = Math.pow((x + 1.0), (1.0 / n)) - t_0;
double tmp;
if (t_1 <= -2e-8) {
tmp = Math.pow(Math.cbrt((1.0 - t_0)), 3.0);
} else if (t_1 <= 0.0) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else {
tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * ((1.0 / n) * (1.0 / n))) + (0.5 * (-1.0 / n))))))) - t_0;
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - t_0) tmp = 0.0 if (t_1 <= -2e-8) tmp = cbrt(Float64(1.0 - t_0)) ^ 3.0; elseif (t_1 <= 0.0) tmp = Float64(Float64(log1p(x) - log(x)) / n); else tmp = Float64(Float64(1.0 + Float64(x * Float64(Float64(1.0 / n) + Float64(x * Float64(Float64(0.5 * Float64(Float64(1.0 / n) * Float64(1.0 / n))) + Float64(0.5 * Float64(-1.0 / n))))))) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-8], N[Power[N[Power[N[(1.0 - t$95$0), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 + N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(x * N[(N[(0.5 * N[(N[(1.0 / n), $MachinePrecision] * N[(1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := {\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-8}:\\
\;\;\;\;{\left(\sqrt[3]{1 - t\_0}\right)}^{3}\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + x \cdot \left(0.5 \cdot \left(\frac{1}{n} \cdot \frac{1}{n}\right) + 0.5 \cdot \frac{-1}{n}\right)\right)\right) - t\_0\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < -2e-8Initial program 98.7%
Taylor expanded in x around 0 98.7%
*-rgt-identity98.7%
associate-/l*98.9%
exp-to-pow98.7%
Simplified98.7%
add-cube-cbrt98.7%
pow398.7%
Applied egg-rr98.7%
if -2e-8 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) < 0.0Initial program 42.8%
Taylor expanded in n around inf 79.5%
log1p-define79.5%
Simplified79.5%
if 0.0 < (-.f64 (pow.f64 (+.f64 x #s(literal 1 binary64)) (/.f64 #s(literal 1 binary64) n)) (pow.f64 x (/.f64 #s(literal 1 binary64) n))) Initial program 55.4%
Taylor expanded in x around 0 80.6%
inv-pow80.6%
unpow280.6%
unpow-prod-down80.6%
inv-pow80.6%
inv-pow80.6%
Applied egg-rr80.6%
Final simplification83.4%
(FPCore (x n)
:precision binary64
(if (<= (/ 1.0 n) -0.5)
(- (pow (+ x 1.0) (/ 1.0 n)) (cbrt (pow x (/ 3.0 n))))
(if (<= (/ 1.0 n) 2e-8)
(/
(-
(+ (log1p x) (* 0.5 (/ (- (pow (log1p x) 2.0) (pow (log x) 2.0)) n)))
(log x))
n)
(- (exp (/ (log1p x) n)) (pow x (/ 1.0 n))))))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -0.5) {
tmp = pow((x + 1.0), (1.0 / n)) - cbrt(pow(x, (3.0 / n)));
} else if ((1.0 / n) <= 2e-8) {
tmp = ((log1p(x) + (0.5 * ((pow(log1p(x), 2.0) - pow(log(x), 2.0)) / n))) - log(x)) / n;
} else {
tmp = exp((log1p(x) / n)) - pow(x, (1.0 / n));
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -0.5) {
tmp = Math.pow((x + 1.0), (1.0 / n)) - Math.cbrt(Math.pow(x, (3.0 / n)));
} else if ((1.0 / n) <= 2e-8) {
tmp = ((Math.log1p(x) + (0.5 * ((Math.pow(Math.log1p(x), 2.0) - Math.pow(Math.log(x), 2.0)) / n))) - Math.log(x)) / n;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n));
}
return tmp;
}
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -0.5) tmp = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - cbrt((x ^ Float64(3.0 / n)))); elseif (Float64(1.0 / n) <= 2e-8) tmp = Float64(Float64(Float64(log1p(x) + Float64(0.5 * Float64(Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0)) / n))) - log(x)) / n); else tmp = Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n))); end return tmp end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -0.5], N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[N[Power[x, N[(3.0 / n), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-8], N[(N[(N[(N[Log[1 + x], $MachinePrecision] + N[(0.5 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -0.5:\\
\;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - \sqrt[3]{{x}^{\left(\frac{3}{n}\right)}}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\frac{\left(\mathsf{log1p}\left(x\right) + 0.5 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}}{n}\right) - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -0.5Initial program 99.9%
add-cbrt-cube99.9%
pow399.9%
pow-pow99.9%
Applied egg-rr99.9%
associate-*l/99.9%
metadata-eval99.9%
Simplified99.9%
if -0.5 < (/.f64 #s(literal 1 binary64) n) < 2e-8Initial program 28.6%
Taylor expanded in n around inf 75.1%
Simplified75.1%
if 2e-8 < (/.f64 #s(literal 1 binary64) n) Initial program 53.8%
Taylor expanded in n around 0 53.8%
log1p-define97.7%
*-rgt-identity97.7%
associate-/l*97.7%
exp-to-pow97.7%
Simplified97.7%
Final simplification86.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log x) (- n))) (t_1 (pow x (/ 1.0 n))))
(if (<= x 4.4e-189)
(- (+ 1.0 (/ x n)) t_1)
(if (<= x 9e-173)
t_0
(if (<= x 1.85e-124)
(-
(+ 1.0 (* x (+ (/ 1.0 n) (/ (+ (* x -0.5) (* 0.5 (/ x n))) n))))
t_1)
(if (<= x 1e-65)
t_0
(if (<= x 2.25e-9)
(log1p (expm1 (/ 1.0 (* x n))))
(/ (/ t_1 n) x))))))))
double code(double x, double n) {
double t_0 = log(x) / -n;
double t_1 = pow(x, (1.0 / n));
double tmp;
if (x <= 4.4e-189) {
tmp = (1.0 + (x / n)) - t_1;
} else if (x <= 9e-173) {
tmp = t_0;
} else if (x <= 1.85e-124) {
tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_1;
} else if (x <= 1e-65) {
tmp = t_0;
} else if (x <= 2.25e-9) {
tmp = log1p(expm1((1.0 / (x * n))));
} else {
tmp = (t_1 / n) / x;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.log(x) / -n;
double t_1 = Math.pow(x, (1.0 / n));
double tmp;
if (x <= 4.4e-189) {
tmp = (1.0 + (x / n)) - t_1;
} else if (x <= 9e-173) {
tmp = t_0;
} else if (x <= 1.85e-124) {
tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_1;
} else if (x <= 1e-65) {
tmp = t_0;
} else if (x <= 2.25e-9) {
tmp = Math.log1p(Math.expm1((1.0 / (x * n))));
} else {
tmp = (t_1 / n) / x;
}
return tmp;
}
def code(x, n): t_0 = math.log(x) / -n t_1 = math.pow(x, (1.0 / n)) tmp = 0 if x <= 4.4e-189: tmp = (1.0 + (x / n)) - t_1 elif x <= 9e-173: tmp = t_0 elif x <= 1.85e-124: tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_1 elif x <= 1e-65: tmp = t_0 elif x <= 2.25e-9: tmp = math.log1p(math.expm1((1.0 / (x * n)))) else: tmp = (t_1 / n) / x return tmp
function code(x, n) t_0 = Float64(log(x) / Float64(-n)) t_1 = x ^ Float64(1.0 / n) tmp = 0.0 if (x <= 4.4e-189) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_1); elseif (x <= 9e-173) tmp = t_0; elseif (x <= 1.85e-124) tmp = Float64(Float64(1.0 + Float64(x * Float64(Float64(1.0 / n) + Float64(Float64(Float64(x * -0.5) + Float64(0.5 * Float64(x / n))) / n)))) - t_1); elseif (x <= 1e-65) tmp = t_0; elseif (x <= 2.25e-9) tmp = log1p(expm1(Float64(1.0 / Float64(x * n)))); else tmp = Float64(Float64(t_1 / n) / x); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 4.4e-189], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[x, 9e-173], t$95$0, If[LessEqual[x, 1.85e-124], N[(N[(1.0 + N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(x * -0.5), $MachinePrecision] + N[(0.5 * N[(x / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[x, 1e-65], t$95$0, If[LessEqual[x, 2.25e-9], N[Log[1 + N[(Exp[N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], N[(N[(t$95$1 / n), $MachinePrecision] / x), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log x}{-n}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 4.4 \cdot 10^{-189}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_1\\
\mathbf{elif}\;x \leq 9 \cdot 10^{-173}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{-124}:\\
\;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + \frac{x \cdot -0.5 + 0.5 \cdot \frac{x}{n}}{n}\right)\right) - t\_1\\
\mathbf{elif}\;x \leq 10^{-65}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.25 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1}{x \cdot n}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_1}{n}}{x}\\
\end{array}
\end{array}
if x < 4.40000000000000038e-189Initial program 63.2%
Taylor expanded in x around 0 63.9%
*-rgt-identity63.9%
associate-/l*63.9%
exp-to-pow63.9%
Simplified63.9%
if 4.40000000000000038e-189 < x < 9.00000000000000037e-173 or 1.84999999999999995e-124 < x < 9.99999999999999923e-66Initial program 28.1%
Taylor expanded in x around 0 28.1%
*-rgt-identity28.1%
associate-/l*28.1%
exp-to-pow28.1%
Simplified28.1%
Taylor expanded in n around inf 63.5%
mul-1-neg63.5%
distribute-neg-frac263.5%
Simplified63.5%
if 9.00000000000000037e-173 < x < 1.84999999999999995e-124Initial program 47.4%
Taylor expanded in x around 0 46.9%
Taylor expanded in n around inf 60.8%
if 9.99999999999999923e-66 < x < 2.24999999999999988e-9Initial program 56.1%
Taylor expanded in x around inf 38.9%
mul-1-neg38.9%
log-rec38.9%
mul-1-neg38.9%
distribute-neg-frac38.9%
mul-1-neg38.9%
remove-double-neg38.9%
*-commutative38.9%
Simplified38.9%
Taylor expanded in n around inf 10.1%
log1p-expm1-u70.2%
Applied egg-rr70.2%
if 2.24999999999999988e-9 < x Initial program 64.7%
Taylor expanded in x around inf 96.3%
associate-/r*96.7%
mul-1-neg96.7%
log-rec96.7%
mul-1-neg96.7%
distribute-neg-frac96.7%
mul-1-neg96.7%
remove-double-neg96.7%
*-rgt-identity96.7%
associate-/l*96.7%
exp-to-pow96.7%
Simplified96.7%
Final simplification77.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-32)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) -2e-113)
(/ (- x (log x)) n)
(if (<= (/ 1.0 n) 4e-259)
(/ (pow x (+ (/ 1.0 n) -1.0)) n)
(if (<= (/ 1.0 n) 2e-24)
(- (/ x n) (/ (log x) n))
(-
(+
1.0
(*
x
(+
(/ 1.0 n)
(* x (+ (* 0.5 (* (/ 1.0 n) (/ 1.0 n))) (* 0.5 (/ -1.0 n)))))))
t_0)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-32) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= -2e-113) {
tmp = (x - log(x)) / n;
} else if ((1.0 / n) <= 4e-259) {
tmp = pow(x, ((1.0 / n) + -1.0)) / n;
} else if ((1.0 / n) <= 2e-24) {
tmp = (x / n) - (log(x) / n);
} else {
tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * ((1.0 / n) * (1.0 / n))) + (0.5 * (-1.0 / n))))))) - t_0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-2d-32)) then
tmp = t_0 / (x * n)
else if ((1.0d0 / n) <= (-2d-113)) then
tmp = (x - log(x)) / n
else if ((1.0d0 / n) <= 4d-259) then
tmp = (x ** ((1.0d0 / n) + (-1.0d0))) / n
else if ((1.0d0 / n) <= 2d-24) then
tmp = (x / n) - (log(x) / n)
else
tmp = (1.0d0 + (x * ((1.0d0 / n) + (x * ((0.5d0 * ((1.0d0 / n) * (1.0d0 / n))) + (0.5d0 * ((-1.0d0) / n))))))) - t_0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-32) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= -2e-113) {
tmp = (x - Math.log(x)) / n;
} else if ((1.0 / n) <= 4e-259) {
tmp = Math.pow(x, ((1.0 / n) + -1.0)) / n;
} else if ((1.0 / n) <= 2e-24) {
tmp = (x / n) - (Math.log(x) / n);
} else {
tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * ((1.0 / n) * (1.0 / n))) + (0.5 * (-1.0 / n))))))) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-32: tmp = t_0 / (x * n) elif (1.0 / n) <= -2e-113: tmp = (x - math.log(x)) / n elif (1.0 / n) <= 4e-259: tmp = math.pow(x, ((1.0 / n) + -1.0)) / n elif (1.0 / n) <= 2e-24: tmp = (x / n) - (math.log(x) / n) else: tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * ((1.0 / n) * (1.0 / n))) + (0.5 * (-1.0 / n))))))) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-32) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= -2e-113) tmp = Float64(Float64(x - log(x)) / n); elseif (Float64(1.0 / n) <= 4e-259) tmp = Float64((x ^ Float64(Float64(1.0 / n) + -1.0)) / n); elseif (Float64(1.0 / n) <= 2e-24) tmp = Float64(Float64(x / n) - Float64(log(x) / n)); else tmp = Float64(Float64(1.0 + Float64(x * Float64(Float64(1.0 / n) + Float64(x * Float64(Float64(0.5 * Float64(Float64(1.0 / n) * Float64(1.0 / n))) + Float64(0.5 * Float64(-1.0 / n))))))) - t_0); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -2e-32) tmp = t_0 / (x * n); elseif ((1.0 / n) <= -2e-113) tmp = (x - log(x)) / n; elseif ((1.0 / n) <= 4e-259) tmp = (x ^ ((1.0 / n) + -1.0)) / n; elseif ((1.0 / n) <= 2e-24) tmp = (x / n) - (log(x) / n); else tmp = (1.0 + (x * ((1.0 / n) + (x * ((0.5 * ((1.0 / n) * (1.0 / n))) + (0.5 * (-1.0 / n))))))) - t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-32], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-113], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-259], N[(N[Power[x, N[(N[(1.0 / n), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-24], N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(x * N[(N[(0.5 * N[(N[(1.0 / n), $MachinePrecision] * N[(1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-32}:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{-113}:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-259}:\\
\;\;\;\;\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-24}:\\
\;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + x \cdot \left(0.5 \cdot \left(\frac{1}{n} \cdot \frac{1}{n}\right) + 0.5 \cdot \frac{-1}{n}\right)\right)\right) - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -2.00000000000000011e-32Initial program 93.5%
Taylor expanded in x around inf 94.8%
mul-1-neg94.8%
log-rec94.8%
mul-1-neg94.8%
distribute-neg-frac94.8%
mul-1-neg94.8%
remove-double-neg94.8%
*-commutative94.8%
Simplified94.8%
Taylor expanded in x around 0 94.8%
*-rgt-identity94.8%
associate-*r/94.8%
exp-to-pow94.8%
*-commutative94.8%
Simplified94.8%
if -2.00000000000000011e-32 < (/.f64 #s(literal 1 binary64) n) < -1.99999999999999996e-113Initial program 12.3%
Taylor expanded in x around 0 3.5%
*-rgt-identity3.5%
associate-/l*3.5%
exp-to-pow3.5%
Simplified3.5%
Taylor expanded in n around inf 64.7%
if -1.99999999999999996e-113 < (/.f64 #s(literal 1 binary64) n) < 4.0000000000000003e-259Initial program 45.6%
Taylor expanded in x around inf 63.5%
mul-1-neg63.5%
log-rec63.5%
mul-1-neg63.5%
distribute-neg-frac63.5%
mul-1-neg63.5%
remove-double-neg63.5%
*-commutative63.5%
Simplified63.5%
*-un-lft-identity63.5%
associate-/r*64.5%
div-inv64.5%
pow-to-exp64.5%
pow164.5%
pow-div64.5%
Applied egg-rr64.5%
*-lft-identity64.5%
sub-neg64.5%
metadata-eval64.5%
Simplified64.5%
if 4.0000000000000003e-259 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999985e-24Initial program 20.0%
Taylor expanded in x around 0 3.9%
Taylor expanded in n around inf 54.5%
*-commutative54.5%
Simplified54.5%
Taylor expanded in x around 0 55.6%
mul-1-neg55.6%
+-commutative55.6%
unsub-neg55.6%
Simplified55.6%
if 1.99999999999999985e-24 < (/.f64 #s(literal 1 binary64) n) Initial program 54.2%
Taylor expanded in x around 0 78.7%
inv-pow78.7%
unpow278.7%
unpow-prod-down78.7%
inv-pow78.7%
inv-pow78.7%
Applied egg-rr78.7%
Final simplification75.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-32)
(/ t_0 (* x n))
(if (<= (/ 1.0 n) -2e-113)
(/ (- x (log x)) n)
(if (<= (/ 1.0 n) 4e-259)
(/ (pow x (+ (/ 1.0 n) -1.0)) n)
(if (<= (/ 1.0 n) 2e-24)
(- (/ x n) (/ (log x) n))
(-
(+ 1.0 (* x (+ (/ 1.0 n) (/ (+ (* x -0.5) (* 0.5 (/ x n))) n))))
t_0)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-32) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= -2e-113) {
tmp = (x - log(x)) / n;
} else if ((1.0 / n) <= 4e-259) {
tmp = pow(x, ((1.0 / n) + -1.0)) / n;
} else if ((1.0 / n) <= 2e-24) {
tmp = (x / n) - (log(x) / n);
} else {
tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-2d-32)) then
tmp = t_0 / (x * n)
else if ((1.0d0 / n) <= (-2d-113)) then
tmp = (x - log(x)) / n
else if ((1.0d0 / n) <= 4d-259) then
tmp = (x ** ((1.0d0 / n) + (-1.0d0))) / n
else if ((1.0d0 / n) <= 2d-24) then
tmp = (x / n) - (log(x) / n)
else
tmp = (1.0d0 + (x * ((1.0d0 / n) + (((x * (-0.5d0)) + (0.5d0 * (x / n))) / n)))) - t_0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-32) {
tmp = t_0 / (x * n);
} else if ((1.0 / n) <= -2e-113) {
tmp = (x - Math.log(x)) / n;
} else if ((1.0 / n) <= 4e-259) {
tmp = Math.pow(x, ((1.0 / n) + -1.0)) / n;
} else if ((1.0 / n) <= 2e-24) {
tmp = (x / n) - (Math.log(x) / n);
} else {
tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-32: tmp = t_0 / (x * n) elif (1.0 / n) <= -2e-113: tmp = (x - math.log(x)) / n elif (1.0 / n) <= 4e-259: tmp = math.pow(x, ((1.0 / n) + -1.0)) / n elif (1.0 / n) <= 2e-24: tmp = (x / n) - (math.log(x) / n) else: tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-32) tmp = Float64(t_0 / Float64(x * n)); elseif (Float64(1.0 / n) <= -2e-113) tmp = Float64(Float64(x - log(x)) / n); elseif (Float64(1.0 / n) <= 4e-259) tmp = Float64((x ^ Float64(Float64(1.0 / n) + -1.0)) / n); elseif (Float64(1.0 / n) <= 2e-24) tmp = Float64(Float64(x / n) - Float64(log(x) / n)); else tmp = Float64(Float64(1.0 + Float64(x * Float64(Float64(1.0 / n) + Float64(Float64(Float64(x * -0.5) + Float64(0.5 * Float64(x / n))) / n)))) - t_0); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -2e-32) tmp = t_0 / (x * n); elseif ((1.0 / n) <= -2e-113) tmp = (x - log(x)) / n; elseif ((1.0 / n) <= 4e-259) tmp = (x ^ ((1.0 / n) + -1.0)) / n; elseif ((1.0 / n) <= 2e-24) tmp = (x / n) - (log(x) / n); else tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-32], N[(t$95$0 / N[(x * n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-113], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-259], N[(N[Power[x, N[(N[(1.0 / n), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-24], N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(x * -0.5), $MachinePrecision] + N[(0.5 * N[(x / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-32}:\\
\;\;\;\;\frac{t\_0}{x \cdot n}\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{-113}:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-259}:\\
\;\;\;\;\frac{{x}^{\left(\frac{1}{n} + -1\right)}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-24}:\\
\;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + \frac{x \cdot -0.5 + 0.5 \cdot \frac{x}{n}}{n}\right)\right) - t\_0\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -2.00000000000000011e-32Initial program 93.5%
Taylor expanded in x around inf 94.8%
mul-1-neg94.8%
log-rec94.8%
mul-1-neg94.8%
distribute-neg-frac94.8%
mul-1-neg94.8%
remove-double-neg94.8%
*-commutative94.8%
Simplified94.8%
Taylor expanded in x around 0 94.8%
*-rgt-identity94.8%
associate-*r/94.8%
exp-to-pow94.8%
*-commutative94.8%
Simplified94.8%
if -2.00000000000000011e-32 < (/.f64 #s(literal 1 binary64) n) < -1.99999999999999996e-113Initial program 12.3%
Taylor expanded in x around 0 3.5%
*-rgt-identity3.5%
associate-/l*3.5%
exp-to-pow3.5%
Simplified3.5%
Taylor expanded in n around inf 64.7%
if -1.99999999999999996e-113 < (/.f64 #s(literal 1 binary64) n) < 4.0000000000000003e-259Initial program 45.6%
Taylor expanded in x around inf 63.5%
mul-1-neg63.5%
log-rec63.5%
mul-1-neg63.5%
distribute-neg-frac63.5%
mul-1-neg63.5%
remove-double-neg63.5%
*-commutative63.5%
Simplified63.5%
*-un-lft-identity63.5%
associate-/r*64.5%
div-inv64.5%
pow-to-exp64.5%
pow164.5%
pow-div64.5%
Applied egg-rr64.5%
*-lft-identity64.5%
sub-neg64.5%
metadata-eval64.5%
Simplified64.5%
if 4.0000000000000003e-259 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999985e-24Initial program 20.0%
Taylor expanded in x around 0 3.9%
Taylor expanded in n around inf 54.5%
*-commutative54.5%
Simplified54.5%
Taylor expanded in x around 0 55.6%
mul-1-neg55.6%
+-commutative55.6%
unsub-neg55.6%
Simplified55.6%
if 1.99999999999999985e-24 < (/.f64 #s(literal 1 binary64) n) Initial program 54.2%
Taylor expanded in x around 0 78.7%
Taylor expanded in n around inf 74.2%
Final simplification75.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= x 1.38e-188)
(- 1.0 t_0)
(if (<= x 2.6e-45) (/ (log x) (- n)) (/ (/ t_0 n) x)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if (x <= 1.38e-188) {
tmp = 1.0 - t_0;
} else if (x <= 2.6e-45) {
tmp = log(x) / -n;
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if (x <= 1.38d-188) then
tmp = 1.0d0 - t_0
else if (x <= 2.6d-45) then
tmp = log(x) / -n
else
tmp = (t_0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if (x <= 1.38e-188) {
tmp = 1.0 - t_0;
} else if (x <= 2.6e-45) {
tmp = Math.log(x) / -n;
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if x <= 1.38e-188: tmp = 1.0 - t_0 elif x <= 2.6e-45: tmp = math.log(x) / -n else: tmp = (t_0 / n) / x return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (x <= 1.38e-188) tmp = Float64(1.0 - t_0); elseif (x <= 2.6e-45) tmp = Float64(log(x) / Float64(-n)); else tmp = Float64(Float64(t_0 / n) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if (x <= 1.38e-188) tmp = 1.0 - t_0; elseif (x <= 2.6e-45) tmp = log(x) / -n; else tmp = (t_0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 1.38e-188], N[(1.0 - t$95$0), $MachinePrecision], If[LessEqual[x, 2.6e-45], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 1.38 \cdot 10^{-188}:\\
\;\;\;\;1 - t\_0\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-45}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\end{array}
\end{array}
if x < 1.3800000000000001e-188Initial program 63.2%
Taylor expanded in x around 0 63.2%
*-rgt-identity63.2%
associate-/l*63.2%
exp-to-pow63.2%
Simplified63.2%
if 1.3800000000000001e-188 < x < 2.59999999999999987e-45Initial program 36.7%
Taylor expanded in x around 0 36.7%
*-rgt-identity36.7%
associate-/l*36.8%
exp-to-pow36.7%
Simplified36.7%
Taylor expanded in n around inf 52.6%
mul-1-neg52.6%
distribute-neg-frac252.6%
Simplified52.6%
if 2.59999999999999987e-45 < x Initial program 64.2%
Taylor expanded in x around inf 88.4%
associate-/r*88.7%
mul-1-neg88.7%
log-rec88.7%
mul-1-neg88.7%
distribute-neg-frac88.7%
mul-1-neg88.7%
remove-double-neg88.7%
*-rgt-identity88.7%
associate-/l*88.7%
exp-to-pow88.7%
Simplified88.7%
Final simplification72.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= x 3e-189)
(- (+ 1.0 (/ x n)) t_0)
(if (<= x 2.3e-45) (/ (log x) (- n)) (/ (/ t_0 n) x)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if (x <= 3e-189) {
tmp = (1.0 + (x / n)) - t_0;
} else if (x <= 2.3e-45) {
tmp = log(x) / -n;
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if (x <= 3d-189) then
tmp = (1.0d0 + (x / n)) - t_0
else if (x <= 2.3d-45) then
tmp = log(x) / -n
else
tmp = (t_0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if (x <= 3e-189) {
tmp = (1.0 + (x / n)) - t_0;
} else if (x <= 2.3e-45) {
tmp = Math.log(x) / -n;
} else {
tmp = (t_0 / n) / x;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if x <= 3e-189: tmp = (1.0 + (x / n)) - t_0 elif x <= 2.3e-45: tmp = math.log(x) / -n else: tmp = (t_0 / n) / x return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (x <= 3e-189) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); elseif (x <= 2.3e-45) tmp = Float64(log(x) / Float64(-n)); else tmp = Float64(Float64(t_0 / n) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if (x <= 3e-189) tmp = (1.0 + (x / n)) - t_0; elseif (x <= 2.3e-45) tmp = log(x) / -n; else tmp = (t_0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 3e-189], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[x, 2.3e-45], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 3 \cdot 10^{-189}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-45}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\end{array}
\end{array}
if x < 3e-189Initial program 63.2%
Taylor expanded in x around 0 63.9%
*-rgt-identity63.9%
associate-/l*63.9%
exp-to-pow63.9%
Simplified63.9%
if 3e-189 < x < 2.29999999999999992e-45Initial program 36.7%
Taylor expanded in x around 0 36.7%
*-rgt-identity36.7%
associate-/l*36.8%
exp-to-pow36.7%
Simplified36.7%
Taylor expanded in n around inf 52.6%
mul-1-neg52.6%
distribute-neg-frac252.6%
Simplified52.6%
if 2.29999999999999992e-45 < x Initial program 64.2%
Taylor expanded in x around inf 88.4%
associate-/r*88.7%
mul-1-neg88.7%
log-rec88.7%
mul-1-neg88.7%
distribute-neg-frac88.7%
mul-1-neg88.7%
remove-double-neg88.7%
*-rgt-identity88.7%
associate-/l*88.7%
exp-to-pow88.7%
Simplified88.7%
Final simplification72.4%
(FPCore (x n) :precision binary64 (if (<= x 5.4e-189) (- 1.0 (pow x (/ 1.0 n))) (if (<= x 1.0) (- (/ x n) (/ (log x) n)) (/ (/ (- 1.0 (/ 0.5 x)) n) x))))
double code(double x, double n) {
double tmp;
if (x <= 5.4e-189) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 1.0) {
tmp = (x / n) - (log(x) / n);
} else {
tmp = ((1.0 - (0.5 / x)) / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 5.4d-189) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 1.0d0) then
tmp = (x / n) - (log(x) / n)
else
tmp = ((1.0d0 - (0.5d0 / x)) / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 5.4e-189) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 1.0) {
tmp = (x / n) - (Math.log(x) / n);
} else {
tmp = ((1.0 - (0.5 / x)) / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 5.4e-189: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 1.0: tmp = (x / n) - (math.log(x) / n) else: tmp = ((1.0 - (0.5 / x)) / n) / x return tmp
function code(x, n) tmp = 0.0 if (x <= 5.4e-189) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 1.0) tmp = Float64(Float64(x / n) - Float64(log(x) / n)); else tmp = Float64(Float64(Float64(1.0 - Float64(0.5 / x)) / n) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 5.4e-189) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 1.0) tmp = (x / n) - (log(x) / n); else tmp = ((1.0 - (0.5 / x)) / n) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 5.4e-189], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.0], N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - N[(0.5 / x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.4 \cdot 10^{-189}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 - \frac{0.5}{x}}{n}}{x}\\
\end{array}
\end{array}
if x < 5.3999999999999999e-189Initial program 63.2%
Taylor expanded in x around 0 63.2%
*-rgt-identity63.2%
associate-/l*63.2%
exp-to-pow63.2%
Simplified63.2%
if 5.3999999999999999e-189 < x < 1Initial program 41.2%
Taylor expanded in x around 0 38.0%
Taylor expanded in n around inf 48.1%
*-commutative48.1%
Simplified48.1%
Taylor expanded in x around 0 48.0%
mul-1-neg48.0%
+-commutative48.0%
unsub-neg48.0%
Simplified48.0%
if 1 < x Initial program 65.6%
Taylor expanded in x around inf 84.5%
Simplified84.5%
Taylor expanded in n around inf 64.8%
associate-*r/64.8%
metadata-eval64.8%
Simplified64.8%
Final simplification58.0%
(FPCore (x n) :precision binary64 (if (<= x 3.05e-189) (- 1.0 (pow x (/ 1.0 n))) (if (<= x 0.98) (/ (- x (log x)) n) (/ (/ (- 1.0 (/ 0.5 x)) n) x))))
double code(double x, double n) {
double tmp;
if (x <= 3.05e-189) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 0.98) {
tmp = (x - log(x)) / n;
} else {
tmp = ((1.0 - (0.5 / x)) / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 3.05d-189) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 0.98d0) then
tmp = (x - log(x)) / n
else
tmp = ((1.0d0 - (0.5d0 / x)) / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 3.05e-189) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 0.98) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = ((1.0 - (0.5 / x)) / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 3.05e-189: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 0.98: tmp = (x - math.log(x)) / n else: tmp = ((1.0 - (0.5 / x)) / n) / x return tmp
function code(x, n) tmp = 0.0 if (x <= 3.05e-189) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 0.98) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(Float64(1.0 - Float64(0.5 / x)) / n) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 3.05e-189) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 0.98) tmp = (x - log(x)) / n; else tmp = ((1.0 - (0.5 / x)) / n) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 3.05e-189], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.98], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(1.0 - N[(0.5 / x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.05 \cdot 10^{-189}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 0.98:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 - \frac{0.5}{x}}{n}}{x}\\
\end{array}
\end{array}
if x < 3.05e-189Initial program 63.2%
Taylor expanded in x around 0 63.2%
*-rgt-identity63.2%
associate-/l*63.2%
exp-to-pow63.2%
Simplified63.2%
if 3.05e-189 < x < 0.97999999999999998Initial program 41.2%
Taylor expanded in x around 0 38.6%
*-rgt-identity38.6%
associate-/l*38.7%
exp-to-pow38.6%
Simplified38.6%
Taylor expanded in n around inf 48.0%
if 0.97999999999999998 < x Initial program 65.6%
Taylor expanded in x around inf 84.5%
Simplified84.5%
Taylor expanded in n around inf 64.8%
associate-*r/64.8%
metadata-eval64.8%
Simplified64.8%
Final simplification58.0%
(FPCore (x n) :precision binary64 (if (<= x 0.96) (/ (- x (log x)) n) (/ (/ (- 1.0 (/ 0.5 x)) n) x)))
double code(double x, double n) {
double tmp;
if (x <= 0.96) {
tmp = (x - log(x)) / n;
} else {
tmp = ((1.0 - (0.5 / x)) / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.96d0) then
tmp = (x - log(x)) / n
else
tmp = ((1.0d0 - (0.5d0 / x)) / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.96) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = ((1.0 - (0.5 / x)) / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.96: tmp = (x - math.log(x)) / n else: tmp = ((1.0 - (0.5 / x)) / n) / x return tmp
function code(x, n) tmp = 0.0 if (x <= 0.96) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(Float64(1.0 - Float64(0.5 / x)) / n) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.96) tmp = (x - log(x)) / n; else tmp = ((1.0 - (0.5 / x)) / n) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.96], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(1.0 - N[(0.5 / x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.96:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 - \frac{0.5}{x}}{n}}{x}\\
\end{array}
\end{array}
if x < 0.95999999999999996Initial program 49.2%
Taylor expanded in x around 0 47.8%
*-rgt-identity47.8%
associate-/l*47.9%
exp-to-pow47.8%
Simplified47.8%
Taylor expanded in n around inf 45.8%
if 0.95999999999999996 < x Initial program 65.6%
Taylor expanded in x around inf 84.5%
Simplified84.5%
Taylor expanded in n around inf 64.8%
associate-*r/64.8%
metadata-eval64.8%
Simplified64.8%
Final simplification53.4%
(FPCore (x n) :precision binary64 (if (<= x 0.68) (/ (log x) (- n)) (/ (/ (- 1.0 (/ 0.5 x)) n) x)))
double code(double x, double n) {
double tmp;
if (x <= 0.68) {
tmp = log(x) / -n;
} else {
tmp = ((1.0 - (0.5 / x)) / n) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.68d0) then
tmp = log(x) / -n
else
tmp = ((1.0d0 - (0.5d0 / x)) / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.68) {
tmp = Math.log(x) / -n;
} else {
tmp = ((1.0 - (0.5 / x)) / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.68: tmp = math.log(x) / -n else: tmp = ((1.0 - (0.5 / x)) / n) / x return tmp
function code(x, n) tmp = 0.0 if (x <= 0.68) tmp = Float64(log(x) / Float64(-n)); else tmp = Float64(Float64(Float64(1.0 - Float64(0.5 / x)) / n) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.68) tmp = log(x) / -n; else tmp = ((1.0 - (0.5 / x)) / n) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.68], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], N[(N[(N[(1.0 - N[(0.5 / x), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.68:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 - \frac{0.5}{x}}{n}}{x}\\
\end{array}
\end{array}
if x < 0.680000000000000049Initial program 49.2%
Taylor expanded in x around 0 47.3%
*-rgt-identity47.3%
associate-/l*47.3%
exp-to-pow47.3%
Simplified47.3%
Taylor expanded in n around inf 45.6%
mul-1-neg45.6%
distribute-neg-frac245.6%
Simplified45.6%
if 0.680000000000000049 < x Initial program 65.6%
Taylor expanded in x around inf 84.5%
Simplified84.5%
Taylor expanded in n around inf 64.8%
associate-*r/64.8%
metadata-eval64.8%
Simplified64.8%
Final simplification53.2%
(FPCore (x n) :precision binary64 (* (/ 1.0 n) (/ 1.0 x)))
double code(double x, double n) {
return (1.0 / n) * (1.0 / x);
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = (1.0d0 / n) * (1.0d0 / x)
end function
public static double code(double x, double n) {
return (1.0 / n) * (1.0 / x);
}
def code(x, n): return (1.0 / n) * (1.0 / x)
function code(x, n) return Float64(Float64(1.0 / n) * Float64(1.0 / x)) end
function tmp = code(x, n) tmp = (1.0 / n) * (1.0 / x); end
code[x_, n_] := N[(N[(1.0 / n), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{n} \cdot \frac{1}{x}
\end{array}
Initial program 55.7%
Taylor expanded in x around inf 59.0%
mul-1-neg59.0%
log-rec59.0%
mul-1-neg59.0%
distribute-neg-frac59.0%
mul-1-neg59.0%
remove-double-neg59.0%
*-commutative59.0%
Simplified59.0%
Taylor expanded in n around inf 41.1%
inv-pow41.1%
unpow-prod-down41.3%
inv-pow41.3%
inv-pow41.3%
Applied egg-rr41.3%
Final simplification41.3%
(FPCore (x n) :precision binary64 (/ 1.0 (* x n)))
double code(double x, double n) {
return 1.0 / (x * n);
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = 1.0d0 / (x * n)
end function
public static double code(double x, double n) {
return 1.0 / (x * n);
}
def code(x, n): return 1.0 / (x * n)
function code(x, n) return Float64(1.0 / Float64(x * n)) end
function tmp = code(x, n) tmp = 1.0 / (x * n); end
code[x_, n_] := N[(1.0 / N[(x * n), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{x \cdot n}
\end{array}
Initial program 55.7%
Taylor expanded in x around inf 59.0%
mul-1-neg59.0%
log-rec59.0%
mul-1-neg59.0%
distribute-neg-frac59.0%
mul-1-neg59.0%
remove-double-neg59.0%
*-commutative59.0%
Simplified59.0%
Taylor expanded in n around inf 41.1%
Final simplification41.1%
(FPCore (x n) :precision binary64 (/ (/ 1.0 n) x))
double code(double x, double n) {
return (1.0 / n) / x;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = (1.0d0 / n) / x
end function
public static double code(double x, double n) {
return (1.0 / n) / x;
}
def code(x, n): return (1.0 / n) / x
function code(x, n) return Float64(Float64(1.0 / n) / x) end
function tmp = code(x, n) tmp = (1.0 / n) / x; end
code[x_, n_] := N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{n}}{x}
\end{array}
Initial program 55.7%
Taylor expanded in x around inf 59.0%
mul-1-neg59.0%
log-rec59.0%
mul-1-neg59.0%
distribute-neg-frac59.0%
mul-1-neg59.0%
remove-double-neg59.0%
*-commutative59.0%
Simplified59.0%
Taylor expanded in n around inf 41.1%
associate-/r*41.3%
Simplified41.3%
Final simplification41.3%
(FPCore (x n) :precision binary64 (/ x n))
double code(double x, double n) {
return x / n;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = x / n
end function
public static double code(double x, double n) {
return x / n;
}
def code(x, n): return x / n
function code(x, n) return Float64(x / n) end
function tmp = code(x, n) tmp = x / n; end
code[x_, n_] := N[(x / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{n}
\end{array}
Initial program 55.7%
Taylor expanded in x around 0 36.7%
*-rgt-identity36.7%
associate-/l*36.7%
exp-to-pow36.7%
Simplified36.7%
Taylor expanded in x around inf 4.3%
Final simplification4.3%
herbie shell --seed 2024112
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))