
(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 17 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
(let* ((t_0 (log (+ 1.0 x)))
(t_1 (pow x (/ 1.0 n)))
(t_2
(-
(+ (* 0.5 (/ (pow t_0 2.0) (pow n 2.0))) (/ t_0 n))
(+ (* 0.5 (/ (pow (log x) 2.0) (pow n 2.0))) (/ (log x) n)))))
(if (<= (/ 1.0 n) -5e-25)
(/ (/ t_1 n) x)
(if (<= (/ 1.0 n) -1e-129)
t_2
(if (<= (/ 1.0 n) -5e-165)
(/ 1.0 (* n (+ x 0.5)))
(if (<= (/ 1.0 n) 5e-14) t_2 (- (exp (/ (log1p x) n)) t_1)))))))
double code(double x, double n) {
double t_0 = log((1.0 + x));
double t_1 = pow(x, (1.0 / n));
double t_2 = ((0.5 * (pow(t_0, 2.0) / pow(n, 2.0))) + (t_0 / n)) - ((0.5 * (pow(log(x), 2.0) / pow(n, 2.0))) + (log(x) / n));
double tmp;
if ((1.0 / n) <= -5e-25) {
tmp = (t_1 / n) / x;
} else if ((1.0 / n) <= -1e-129) {
tmp = t_2;
} else if ((1.0 / n) <= -5e-165) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 5e-14) {
tmp = t_2;
} else {
tmp = exp((log1p(x) / n)) - t_1;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.log((1.0 + x));
double t_1 = Math.pow(x, (1.0 / n));
double t_2 = ((0.5 * (Math.pow(t_0, 2.0) / Math.pow(n, 2.0))) + (t_0 / n)) - ((0.5 * (Math.pow(Math.log(x), 2.0) / Math.pow(n, 2.0))) + (Math.log(x) / n));
double tmp;
if ((1.0 / n) <= -5e-25) {
tmp = (t_1 / n) / x;
} else if ((1.0 / n) <= -1e-129) {
tmp = t_2;
} else if ((1.0 / n) <= -5e-165) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 5e-14) {
tmp = t_2;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - t_1;
}
return tmp;
}
def code(x, n): t_0 = math.log((1.0 + x)) t_1 = math.pow(x, (1.0 / n)) t_2 = ((0.5 * (math.pow(t_0, 2.0) / math.pow(n, 2.0))) + (t_0 / n)) - ((0.5 * (math.pow(math.log(x), 2.0) / math.pow(n, 2.0))) + (math.log(x) / n)) tmp = 0 if (1.0 / n) <= -5e-25: tmp = (t_1 / n) / x elif (1.0 / n) <= -1e-129: tmp = t_2 elif (1.0 / n) <= -5e-165: tmp = 1.0 / (n * (x + 0.5)) elif (1.0 / n) <= 5e-14: tmp = t_2 else: tmp = math.exp((math.log1p(x) / n)) - t_1 return tmp
function code(x, n) t_0 = log(Float64(1.0 + x)) t_1 = x ^ Float64(1.0 / n) t_2 = Float64(Float64(Float64(0.5 * Float64((t_0 ^ 2.0) / (n ^ 2.0))) + Float64(t_0 / n)) - Float64(Float64(0.5 * Float64((log(x) ^ 2.0) / (n ^ 2.0))) + Float64(log(x) / n))) tmp = 0.0 if (Float64(1.0 / n) <= -5e-25) tmp = Float64(Float64(t_1 / n) / x); elseif (Float64(1.0 / n) <= -1e-129) tmp = t_2; elseif (Float64(1.0 / n) <= -5e-165) tmp = Float64(1.0 / Float64(n * Float64(x + 0.5))); elseif (Float64(1.0 / n) <= 5e-14) tmp = t_2; else tmp = Float64(exp(Float64(log1p(x) / n)) - t_1); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Log[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(0.5 * N[(N[Power[t$95$0, 2.0], $MachinePrecision] / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 / n), $MachinePrecision]), $MachinePrecision] - N[(N[(0.5 * N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-25], N[(N[(t$95$1 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-129], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-165], N[(1.0 / N[(n * N[(x + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-14], t$95$2, N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$1), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(1 + x\right)\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
t_2 := \left(0.5 \cdot \frac{{t_0}^{2}}{{n}^{2}} + \frac{t_0}{n}\right) - \left(0.5 \cdot \frac{{\log x}^{2}}{{n}^{2}} + \frac{\log x}{n}\right)\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-25}:\\
\;\;\;\;\frac{\frac{t_1}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{-129}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-165}:\\
\;\;\;\;\frac{1}{n \cdot \left(x + 0.5\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-14}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t_1\\
\end{array}
\end{array}
if (/.f64 1 n) < -4.99999999999999962e-25Initial program 91.8%
Taylor expanded in x around inf 95.9%
mul-1-neg95.9%
log-rec95.9%
mul-1-neg95.9%
distribute-neg-frac95.9%
mul-1-neg95.9%
remove-double-neg95.9%
*-commutative95.9%
Simplified95.9%
div-inv95.9%
pow-to-exp95.9%
*-un-lft-identity95.9%
times-frac95.9%
Applied egg-rr95.9%
associate-*l/96.0%
*-un-lft-identity96.0%
Applied egg-rr96.0%
if -4.99999999999999962e-25 < (/.f64 1 n) < -9.9999999999999993e-130 or -4.99999999999999981e-165 < (/.f64 1 n) < 5.0000000000000002e-14Initial program 26.8%
Taylor expanded in n around inf 81.5%
if -9.9999999999999993e-130 < (/.f64 1 n) < -4.99999999999999981e-165Initial program 25.6%
Taylor expanded in n around inf 34.3%
+-rgt-identity34.3%
+-rgt-identity34.3%
log1p-def34.3%
Simplified34.3%
clear-num34.3%
inv-pow34.3%
Applied egg-rr34.3%
unpow-134.3%
Simplified34.3%
Taylor expanded in x around inf 91.7%
*-commutative91.7%
distribute-lft-out91.7%
Simplified91.7%
if 5.0000000000000002e-14 < (/.f64 1 n) Initial program 57.5%
Taylor expanded in n around 0 57.5%
log1p-def96.0%
Simplified96.0%
Final simplification89.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n)))
(t_1
(+
(/ (- (log1p x) (log x)) n)
(*
0.5
(-
(/ (pow (log1p x) 2.0) (pow n 2.0))
(/ (pow (log x) 2.0) (pow n 2.0)))))))
(if (<= (/ 1.0 n) -5e-25)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) -1e-129)
t_1
(if (<= (/ 1.0 n) -5e-165)
(/ 1.0 (* n (+ x 0.5)))
(if (<= (/ 1.0 n) 5e-14) t_1 (- (exp (/ (log1p x) n)) t_0)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = ((log1p(x) - log(x)) / n) + (0.5 * ((pow(log1p(x), 2.0) / pow(n, 2.0)) - (pow(log(x), 2.0) / pow(n, 2.0))));
double tmp;
if ((1.0 / n) <= -5e-25) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= -1e-129) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-165) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 5e-14) {
tmp = t_1;
} 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.log1p(x) - Math.log(x)) / n) + (0.5 * ((Math.pow(Math.log1p(x), 2.0) / Math.pow(n, 2.0)) - (Math.pow(Math.log(x), 2.0) / Math.pow(n, 2.0))));
double tmp;
if ((1.0 / n) <= -5e-25) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= -1e-129) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-165) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 5e-14) {
tmp = t_1;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = ((math.log1p(x) - math.log(x)) / n) + (0.5 * ((math.pow(math.log1p(x), 2.0) / math.pow(n, 2.0)) - (math.pow(math.log(x), 2.0) / math.pow(n, 2.0)))) tmp = 0 if (1.0 / n) <= -5e-25: tmp = (t_0 / n) / x elif (1.0 / n) <= -1e-129: tmp = t_1 elif (1.0 / n) <= -5e-165: tmp = 1.0 / (n * (x + 0.5)) elif (1.0 / n) <= 5e-14: tmp = t_1 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(Float64(log1p(x) - log(x)) / n) + Float64(0.5 * Float64(Float64((log1p(x) ^ 2.0) / (n ^ 2.0)) - Float64((log(x) ^ 2.0) / (n ^ 2.0))))) tmp = 0.0 if (Float64(1.0 / n) <= -5e-25) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= -1e-129) tmp = t_1; elseif (Float64(1.0 / n) <= -5e-165) tmp = Float64(1.0 / Float64(n * Float64(x + 0.5))); elseif (Float64(1.0 / n) <= 5e-14) tmp = t_1; 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[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(0.5 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision] - N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-25], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-129], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-165], N[(1.0 / N[(n * N[(x + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-14], t$95$1, 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 := \frac{\mathsf{log1p}\left(x\right) - \log x}{n} + 0.5 \cdot \left(\frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{{n}^{2}} - \frac{{\log x}^{2}}{{n}^{2}}\right)\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-25}:\\
\;\;\;\;\frac{\frac{t_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{-129}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-165}:\\
\;\;\;\;\frac{1}{n \cdot \left(x + 0.5\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-14}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -4.99999999999999962e-25Initial program 91.8%
Taylor expanded in x around inf 95.9%
mul-1-neg95.9%
log-rec95.9%
mul-1-neg95.9%
distribute-neg-frac95.9%
mul-1-neg95.9%
remove-double-neg95.9%
*-commutative95.9%
Simplified95.9%
div-inv95.9%
pow-to-exp95.9%
*-un-lft-identity95.9%
times-frac95.9%
Applied egg-rr95.9%
associate-*l/96.0%
*-un-lft-identity96.0%
Applied egg-rr96.0%
if -4.99999999999999962e-25 < (/.f64 1 n) < -9.9999999999999993e-130 or -4.99999999999999981e-165 < (/.f64 1 n) < 5.0000000000000002e-14Initial program 26.8%
Taylor expanded in n around inf 81.5%
associate--l+73.6%
+-commutative73.6%
associate--r+81.5%
div-sub81.4%
remove-double-neg81.4%
mul-1-neg81.4%
distribute-lft-out--81.4%
distribute-neg-frac81.4%
mul-1-neg81.4%
Simplified81.4%
if -9.9999999999999993e-130 < (/.f64 1 n) < -4.99999999999999981e-165Initial program 25.6%
Taylor expanded in n around inf 34.3%
+-rgt-identity34.3%
+-rgt-identity34.3%
log1p-def34.3%
Simplified34.3%
clear-num34.3%
inv-pow34.3%
Applied egg-rr34.3%
unpow-134.3%
Simplified34.3%
Taylor expanded in x around inf 91.7%
*-commutative91.7%
distribute-lft-out91.7%
Simplified91.7%
if 5.0000000000000002e-14 < (/.f64 1 n) Initial program 57.5%
Taylor expanded in n around 0 57.5%
log1p-def96.0%
Simplified96.0%
Final simplification89.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (log (/ (+ 1.0 x) x)) n)))
(if (<= (/ 1.0 n) -5e-25)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) -1e-129)
t_1
(if (<= (/ 1.0 n) -5e-165)
(/ 1.0 (* n (+ x 0.5)))
(if (<= (/ 1.0 n) 5e-14) t_1 (- (exp (/ (log1p x) n)) t_0)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = log(((1.0 + x) / x)) / n;
double tmp;
if ((1.0 / n) <= -5e-25) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= -1e-129) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-165) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 5e-14) {
tmp = t_1;
} 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.log(((1.0 + x) / x)) / n;
double tmp;
if ((1.0 / n) <= -5e-25) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= -1e-129) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-165) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 5e-14) {
tmp = t_1;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = math.log(((1.0 + x) / x)) / n tmp = 0 if (1.0 / n) <= -5e-25: tmp = (t_0 / n) / x elif (1.0 / n) <= -1e-129: tmp = t_1 elif (1.0 / n) <= -5e-165: tmp = 1.0 / (n * (x + 0.5)) elif (1.0 / n) <= 5e-14: tmp = t_1 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(log(Float64(Float64(1.0 + x) / x)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-25) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= -1e-129) tmp = t_1; elseif (Float64(1.0 / n) <= -5e-165) tmp = Float64(1.0 / Float64(n * Float64(x + 0.5))); elseif (Float64(1.0 / n) <= 5e-14) tmp = t_1; 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[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-25], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-129], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-165], N[(1.0 / N[(n * N[(x + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-14], t$95$1, 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 := \frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-25}:\\
\;\;\;\;\frac{\frac{t_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{-129}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-165}:\\
\;\;\;\;\frac{1}{n \cdot \left(x + 0.5\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-14}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -4.99999999999999962e-25Initial program 91.8%
Taylor expanded in x around inf 95.9%
mul-1-neg95.9%
log-rec95.9%
mul-1-neg95.9%
distribute-neg-frac95.9%
mul-1-neg95.9%
remove-double-neg95.9%
*-commutative95.9%
Simplified95.9%
div-inv95.9%
pow-to-exp95.9%
*-un-lft-identity95.9%
times-frac95.9%
Applied egg-rr95.9%
associate-*l/96.0%
*-un-lft-identity96.0%
Applied egg-rr96.0%
if -4.99999999999999962e-25 < (/.f64 1 n) < -9.9999999999999993e-130 or -4.99999999999999981e-165 < (/.f64 1 n) < 5.0000000000000002e-14Initial program 26.8%
Taylor expanded in n around inf 81.2%
+-rgt-identity81.2%
+-rgt-identity81.2%
log1p-def81.2%
Simplified81.2%
log1p-udef81.2%
diff-log81.3%
Applied egg-rr81.3%
if -9.9999999999999993e-130 < (/.f64 1 n) < -4.99999999999999981e-165Initial program 25.6%
Taylor expanded in n around inf 34.3%
+-rgt-identity34.3%
+-rgt-identity34.3%
log1p-def34.3%
Simplified34.3%
clear-num34.3%
inv-pow34.3%
Applied egg-rr34.3%
unpow-134.3%
Simplified34.3%
Taylor expanded in x around inf 91.7%
*-commutative91.7%
distribute-lft-out91.7%
Simplified91.7%
if 5.0000000000000002e-14 < (/.f64 1 n) Initial program 57.5%
Taylor expanded in n around 0 57.5%
log1p-def96.0%
Simplified96.0%
Final simplification89.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (log (/ (+ 1.0 x) x)) n)))
(if (<= (/ 1.0 n) -5e-25)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) -1e-129)
t_1
(if (<= (/ 1.0 n) -5e-165)
(/ 1.0 (* n (+ x 0.5)))
(if (<= (/ 1.0 n) 1e-5)
t_1
(if (<= (/ 1.0 n) 1e+125)
(- (+ 1.0 (/ x n)) t_0)
(cbrt (pow (* n x) -3.0)))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = log(((1.0 + x) / x)) / n;
double tmp;
if ((1.0 / n) <= -5e-25) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= -1e-129) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-165) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 1e-5) {
tmp = t_1;
} else if ((1.0 / n) <= 1e+125) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = cbrt(pow((n * x), -3.0));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = Math.log(((1.0 + x) / x)) / n;
double tmp;
if ((1.0 / n) <= -5e-25) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= -1e-129) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-165) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 1e-5) {
tmp = t_1;
} else if ((1.0 / n) <= 1e+125) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = Math.cbrt(Math.pow((n * x), -3.0));
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(log(Float64(Float64(1.0 + x) / x)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-25) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= -1e-129) tmp = t_1; elseif (Float64(1.0 / n) <= -5e-165) tmp = Float64(1.0 / Float64(n * Float64(x + 0.5))); elseif (Float64(1.0 / n) <= 1e-5) tmp = t_1; elseif (Float64(1.0 / n) <= 1e+125) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = cbrt((Float64(n * x) ^ -3.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[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-25], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-129], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-165], N[(1.0 / N[(n * N[(x + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-5], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+125], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[Power[N[Power[N[(n * x), $MachinePrecision], -3.0], $MachinePrecision], 1/3], $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-25}:\\
\;\;\;\;\frac{\frac{t_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{-129}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-165}:\\
\;\;\;\;\frac{1}{n \cdot \left(x + 0.5\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-5}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+125}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{{\left(n \cdot x\right)}^{-3}}\\
\end{array}
\end{array}
if (/.f64 1 n) < -4.99999999999999962e-25Initial program 91.8%
Taylor expanded in x around inf 95.9%
mul-1-neg95.9%
log-rec95.9%
mul-1-neg95.9%
distribute-neg-frac95.9%
mul-1-neg95.9%
remove-double-neg95.9%
*-commutative95.9%
Simplified95.9%
div-inv95.9%
pow-to-exp95.9%
*-un-lft-identity95.9%
times-frac95.9%
Applied egg-rr95.9%
associate-*l/96.0%
*-un-lft-identity96.0%
Applied egg-rr96.0%
if -4.99999999999999962e-25 < (/.f64 1 n) < -9.9999999999999993e-130 or -4.99999999999999981e-165 < (/.f64 1 n) < 1.00000000000000008e-5Initial program 26.4%
Taylor expanded in n around inf 80.0%
+-rgt-identity80.0%
+-rgt-identity80.0%
log1p-def80.0%
Simplified80.0%
log1p-udef80.0%
diff-log80.0%
Applied egg-rr80.0%
if -9.9999999999999993e-130 < (/.f64 1 n) < -4.99999999999999981e-165Initial program 25.6%
Taylor expanded in n around inf 34.3%
+-rgt-identity34.3%
+-rgt-identity34.3%
log1p-def34.3%
Simplified34.3%
clear-num34.3%
inv-pow34.3%
Applied egg-rr34.3%
unpow-134.3%
Simplified34.3%
Taylor expanded in x around inf 91.7%
*-commutative91.7%
distribute-lft-out91.7%
Simplified91.7%
if 1.00000000000000008e-5 < (/.f64 1 n) < 9.9999999999999992e124Initial program 90.8%
Taylor expanded in x around 0 86.2%
if 9.9999999999999992e124 < (/.f64 1 n) Initial program 31.4%
Taylor expanded in n around inf 6.6%
+-rgt-identity6.6%
+-rgt-identity6.6%
log1p-def6.6%
Simplified6.6%
Taylor expanded in x around inf 42.2%
*-commutative42.2%
Simplified42.2%
add-sqr-sqrt42.2%
sqrt-unprod74.8%
inv-pow74.8%
inv-pow74.8%
pow-prod-up74.8%
metadata-eval74.8%
Applied egg-rr74.8%
add-cbrt-cube78.9%
pow1/378.9%
add-sqr-sqrt78.9%
sqrt-pow178.9%
metadata-eval78.9%
pow-prod-up78.9%
metadata-eval78.9%
Applied egg-rr78.9%
unpow1/378.9%
Simplified78.9%
Final simplification85.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (log (/ (+ 1.0 x) x)) n)))
(if (<= (/ 1.0 n) -5e-25)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) -1e-129)
t_1
(if (<= (/ 1.0 n) -5e-165)
(/ 1.0 (* n (+ x 0.5)))
(if (<= (/ 1.0 n) 1e-5) t_1 (- (exp (/ x n)) t_0)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = log(((1.0 + x) / x)) / n;
double tmp;
if ((1.0 / n) <= -5e-25) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= -1e-129) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-165) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 1e-5) {
tmp = t_1;
} else {
tmp = exp((x / 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) :: t_1
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
t_1 = log(((1.0d0 + x) / x)) / n
if ((1.0d0 / n) <= (-5d-25)) then
tmp = (t_0 / n) / x
else if ((1.0d0 / n) <= (-1d-129)) then
tmp = t_1
else if ((1.0d0 / n) <= (-5d-165)) then
tmp = 1.0d0 / (n * (x + 0.5d0))
else if ((1.0d0 / n) <= 1d-5) then
tmp = t_1
else
tmp = exp((x / 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 t_1 = Math.log(((1.0 + x) / x)) / n;
double tmp;
if ((1.0 / n) <= -5e-25) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= -1e-129) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-165) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 1e-5) {
tmp = t_1;
} else {
tmp = Math.exp((x / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = math.log(((1.0 + x) / x)) / n tmp = 0 if (1.0 / n) <= -5e-25: tmp = (t_0 / n) / x elif (1.0 / n) <= -1e-129: tmp = t_1 elif (1.0 / n) <= -5e-165: tmp = 1.0 / (n * (x + 0.5)) elif (1.0 / n) <= 1e-5: tmp = t_1 else: tmp = math.exp((x / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(log(Float64(Float64(1.0 + x) / x)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-25) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= -1e-129) tmp = t_1; elseif (Float64(1.0 / n) <= -5e-165) tmp = Float64(1.0 / Float64(n * Float64(x + 0.5))); elseif (Float64(1.0 / n) <= 1e-5) tmp = t_1; else tmp = Float64(exp(Float64(x / n)) - t_0); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = log(((1.0 + x) / x)) / n; tmp = 0.0; if ((1.0 / n) <= -5e-25) tmp = (t_0 / n) / x; elseif ((1.0 / n) <= -1e-129) tmp = t_1; elseif ((1.0 / n) <= -5e-165) tmp = 1.0 / (n * (x + 0.5)); elseif ((1.0 / n) <= 1e-5) tmp = t_1; else tmp = exp((x / n)) - t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-25], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-129], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-165], N[(1.0 / N[(n * N[(x + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-5], t$95$1, N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-25}:\\
\;\;\;\;\frac{\frac{t_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{-129}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-165}:\\
\;\;\;\;\frac{1}{n \cdot \left(x + 0.5\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-5}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -4.99999999999999962e-25Initial program 91.8%
Taylor expanded in x around inf 95.9%
mul-1-neg95.9%
log-rec95.9%
mul-1-neg95.9%
distribute-neg-frac95.9%
mul-1-neg95.9%
remove-double-neg95.9%
*-commutative95.9%
Simplified95.9%
div-inv95.9%
pow-to-exp95.9%
*-un-lft-identity95.9%
times-frac95.9%
Applied egg-rr95.9%
associate-*l/96.0%
*-un-lft-identity96.0%
Applied egg-rr96.0%
if -4.99999999999999962e-25 < (/.f64 1 n) < -9.9999999999999993e-130 or -4.99999999999999981e-165 < (/.f64 1 n) < 1.00000000000000008e-5Initial program 26.4%
Taylor expanded in n around inf 80.0%
+-rgt-identity80.0%
+-rgt-identity80.0%
log1p-def80.0%
Simplified80.0%
log1p-udef80.0%
diff-log80.0%
Applied egg-rr80.0%
if -9.9999999999999993e-130 < (/.f64 1 n) < -4.99999999999999981e-165Initial program 25.6%
Taylor expanded in n around inf 34.3%
+-rgt-identity34.3%
+-rgt-identity34.3%
log1p-def34.3%
Simplified34.3%
clear-num34.3%
inv-pow34.3%
Applied egg-rr34.3%
unpow-134.3%
Simplified34.3%
Taylor expanded in x around inf 91.7%
*-commutative91.7%
distribute-lft-out91.7%
Simplified91.7%
if 1.00000000000000008e-5 < (/.f64 1 n) Initial program 59.7%
Taylor expanded in n around 0 59.7%
log1p-def100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
Final simplification89.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ 1.0 (* n x)))
(t_1 (pow x (/ 1.0 n)))
(t_2 (/ (log (/ (+ 1.0 x) x)) n)))
(if (<= (/ 1.0 n) -5e-25)
(/ (/ t_1 n) x)
(if (<= (/ 1.0 n) -1e-129)
t_2
(if (<= (/ 1.0 n) -5e-165)
(/ 1.0 (* n (+ x 0.5)))
(if (<= (/ 1.0 n) 1e-5)
t_2
(if (<= (/ 1.0 n) 1e+125)
(- (+ 1.0 (/ x n)) t_1)
(sqrt (* t_0 t_0)))))))))
double code(double x, double n) {
double t_0 = 1.0 / (n * x);
double t_1 = pow(x, (1.0 / n));
double t_2 = log(((1.0 + x) / x)) / n;
double tmp;
if ((1.0 / n) <= -5e-25) {
tmp = (t_1 / n) / x;
} else if ((1.0 / n) <= -1e-129) {
tmp = t_2;
} else if ((1.0 / n) <= -5e-165) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 1e-5) {
tmp = t_2;
} else if ((1.0 / n) <= 1e+125) {
tmp = (1.0 + (x / n)) - t_1;
} else {
tmp = sqrt((t_0 * 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = 1.0d0 / (n * x)
t_1 = x ** (1.0d0 / n)
t_2 = log(((1.0d0 + x) / x)) / n
if ((1.0d0 / n) <= (-5d-25)) then
tmp = (t_1 / n) / x
else if ((1.0d0 / n) <= (-1d-129)) then
tmp = t_2
else if ((1.0d0 / n) <= (-5d-165)) then
tmp = 1.0d0 / (n * (x + 0.5d0))
else if ((1.0d0 / n) <= 1d-5) then
tmp = t_2
else if ((1.0d0 / n) <= 1d+125) then
tmp = (1.0d0 + (x / n)) - t_1
else
tmp = sqrt((t_0 * t_0))
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 / (n * x);
double t_1 = Math.pow(x, (1.0 / n));
double t_2 = Math.log(((1.0 + x) / x)) / n;
double tmp;
if ((1.0 / n) <= -5e-25) {
tmp = (t_1 / n) / x;
} else if ((1.0 / n) <= -1e-129) {
tmp = t_2;
} else if ((1.0 / n) <= -5e-165) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 1e-5) {
tmp = t_2;
} else if ((1.0 / n) <= 1e+125) {
tmp = (1.0 + (x / n)) - t_1;
} else {
tmp = Math.sqrt((t_0 * t_0));
}
return tmp;
}
def code(x, n): t_0 = 1.0 / (n * x) t_1 = math.pow(x, (1.0 / n)) t_2 = math.log(((1.0 + x) / x)) / n tmp = 0 if (1.0 / n) <= -5e-25: tmp = (t_1 / n) / x elif (1.0 / n) <= -1e-129: tmp = t_2 elif (1.0 / n) <= -5e-165: tmp = 1.0 / (n * (x + 0.5)) elif (1.0 / n) <= 1e-5: tmp = t_2 elif (1.0 / n) <= 1e+125: tmp = (1.0 + (x / n)) - t_1 else: tmp = math.sqrt((t_0 * t_0)) return tmp
function code(x, n) t_0 = Float64(1.0 / Float64(n * x)) t_1 = x ^ Float64(1.0 / n) t_2 = Float64(log(Float64(Float64(1.0 + x) / x)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-25) tmp = Float64(Float64(t_1 / n) / x); elseif (Float64(1.0 / n) <= -1e-129) tmp = t_2; elseif (Float64(1.0 / n) <= -5e-165) tmp = Float64(1.0 / Float64(n * Float64(x + 0.5))); elseif (Float64(1.0 / n) <= 1e-5) tmp = t_2; elseif (Float64(1.0 / n) <= 1e+125) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_1); else tmp = sqrt(Float64(t_0 * t_0)); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 / (n * x); t_1 = x ^ (1.0 / n); t_2 = log(((1.0 + x) / x)) / n; tmp = 0.0; if ((1.0 / n) <= -5e-25) tmp = (t_1 / n) / x; elseif ((1.0 / n) <= -1e-129) tmp = t_2; elseif ((1.0 / n) <= -5e-165) tmp = 1.0 / (n * (x + 0.5)); elseif ((1.0 / n) <= 1e-5) tmp = t_2; elseif ((1.0 / n) <= 1e+125) tmp = (1.0 + (x / n)) - t_1; else tmp = sqrt((t_0 * t_0)); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-25], N[(N[(t$95$1 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-129], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-165], N[(1.0 / N[(n * N[(x + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-5], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+125], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], N[Sqrt[N[(t$95$0 * t$95$0), $MachinePrecision]], $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{n \cdot x}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
t_2 := \frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-25}:\\
\;\;\;\;\frac{\frac{t_1}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{-129}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-165}:\\
\;\;\;\;\frac{1}{n \cdot \left(x + 0.5\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-5}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+125}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_1\\
\mathbf{else}:\\
\;\;\;\;\sqrt{t_0 \cdot t_0}\\
\end{array}
\end{array}
if (/.f64 1 n) < -4.99999999999999962e-25Initial program 91.8%
Taylor expanded in x around inf 95.9%
mul-1-neg95.9%
log-rec95.9%
mul-1-neg95.9%
distribute-neg-frac95.9%
mul-1-neg95.9%
remove-double-neg95.9%
*-commutative95.9%
Simplified95.9%
div-inv95.9%
pow-to-exp95.9%
*-un-lft-identity95.9%
times-frac95.9%
Applied egg-rr95.9%
associate-*l/96.0%
*-un-lft-identity96.0%
Applied egg-rr96.0%
if -4.99999999999999962e-25 < (/.f64 1 n) < -9.9999999999999993e-130 or -4.99999999999999981e-165 < (/.f64 1 n) < 1.00000000000000008e-5Initial program 26.4%
Taylor expanded in n around inf 80.0%
+-rgt-identity80.0%
+-rgt-identity80.0%
log1p-def80.0%
Simplified80.0%
log1p-udef80.0%
diff-log80.0%
Applied egg-rr80.0%
if -9.9999999999999993e-130 < (/.f64 1 n) < -4.99999999999999981e-165Initial program 25.6%
Taylor expanded in n around inf 34.3%
+-rgt-identity34.3%
+-rgt-identity34.3%
log1p-def34.3%
Simplified34.3%
clear-num34.3%
inv-pow34.3%
Applied egg-rr34.3%
unpow-134.3%
Simplified34.3%
Taylor expanded in x around inf 91.7%
*-commutative91.7%
distribute-lft-out91.7%
Simplified91.7%
if 1.00000000000000008e-5 < (/.f64 1 n) < 9.9999999999999992e124Initial program 90.8%
Taylor expanded in x around 0 86.2%
if 9.9999999999999992e124 < (/.f64 1 n) Initial program 31.4%
Taylor expanded in n around inf 6.6%
+-rgt-identity6.6%
+-rgt-identity6.6%
log1p-def6.6%
Simplified6.6%
Taylor expanded in x around inf 42.2%
*-commutative42.2%
Simplified42.2%
add-sqr-sqrt42.2%
sqrt-unprod74.8%
inv-pow74.8%
inv-pow74.8%
pow-prod-up74.8%
metadata-eval74.8%
Applied egg-rr74.8%
metadata-eval74.8%
pow-prod-up74.8%
unpow-174.8%
unpow-174.8%
Applied egg-rr74.8%
Final simplification85.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (log (/ (+ 1.0 x) x)) n)))
(if (<= (/ 1.0 n) -5e-25)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) -1e-129)
t_1
(if (<= (/ 1.0 n) -5e-165)
(/ 1.0 (* n (+ x 0.5)))
(if (<= (/ 1.0 n) 1e-5)
t_1
(if (<= (/ 1.0 n) 1e+238)
(- (+ 1.0 (/ x n)) t_0)
(/ 1.0 (* n x)))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = log(((1.0 + x) / x)) / n;
double tmp;
if ((1.0 / n) <= -5e-25) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= -1e-129) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-165) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 1e-5) {
tmp = t_1;
} else if ((1.0 / n) <= 1e+238) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 1.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) :: t_1
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
t_1 = log(((1.0d0 + x) / x)) / n
if ((1.0d0 / n) <= (-5d-25)) then
tmp = (t_0 / n) / x
else if ((1.0d0 / n) <= (-1d-129)) then
tmp = t_1
else if ((1.0d0 / n) <= (-5d-165)) then
tmp = 1.0d0 / (n * (x + 0.5d0))
else if ((1.0d0 / n) <= 1d-5) then
tmp = t_1
else if ((1.0d0 / n) <= 1d+238) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = 1.0d0 / (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 t_1 = Math.log(((1.0 + x) / x)) / n;
double tmp;
if ((1.0 / n) <= -5e-25) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= -1e-129) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-165) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 1e-5) {
tmp = t_1;
} else if ((1.0 / n) <= 1e+238) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = math.log(((1.0 + x) / x)) / n tmp = 0 if (1.0 / n) <= -5e-25: tmp = (t_0 / n) / x elif (1.0 / n) <= -1e-129: tmp = t_1 elif (1.0 / n) <= -5e-165: tmp = 1.0 / (n * (x + 0.5)) elif (1.0 / n) <= 1e-5: tmp = t_1 elif (1.0 / n) <= 1e+238: tmp = (1.0 + (x / n)) - t_0 else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(log(Float64(Float64(1.0 + x) / x)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-25) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= -1e-129) tmp = t_1; elseif (Float64(1.0 / n) <= -5e-165) tmp = Float64(1.0 / Float64(n * Float64(x + 0.5))); elseif (Float64(1.0 / n) <= 1e-5) tmp = t_1; elseif (Float64(1.0 / n) <= 1e+238) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = log(((1.0 + x) / x)) / n; tmp = 0.0; if ((1.0 / n) <= -5e-25) tmp = (t_0 / n) / x; elseif ((1.0 / n) <= -1e-129) tmp = t_1; elseif ((1.0 / n) <= -5e-165) tmp = 1.0 / (n * (x + 0.5)); elseif ((1.0 / n) <= 1e-5) tmp = t_1; elseif ((1.0 / n) <= 1e+238) tmp = (1.0 + (x / n)) - t_0; else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-25], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-129], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-165], N[(1.0 / N[(n * N[(x + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-5], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+238], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-25}:\\
\;\;\;\;\frac{\frac{t_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{-129}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-165}:\\
\;\;\;\;\frac{1}{n \cdot \left(x + 0.5\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-5}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+238}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 1 n) < -4.99999999999999962e-25Initial program 91.8%
Taylor expanded in x around inf 95.9%
mul-1-neg95.9%
log-rec95.9%
mul-1-neg95.9%
distribute-neg-frac95.9%
mul-1-neg95.9%
remove-double-neg95.9%
*-commutative95.9%
Simplified95.9%
div-inv95.9%
pow-to-exp95.9%
*-un-lft-identity95.9%
times-frac95.9%
Applied egg-rr95.9%
associate-*l/96.0%
*-un-lft-identity96.0%
Applied egg-rr96.0%
if -4.99999999999999962e-25 < (/.f64 1 n) < -9.9999999999999993e-130 or -4.99999999999999981e-165 < (/.f64 1 n) < 1.00000000000000008e-5Initial program 26.4%
Taylor expanded in n around inf 80.0%
+-rgt-identity80.0%
+-rgt-identity80.0%
log1p-def80.0%
Simplified80.0%
log1p-udef80.0%
diff-log80.0%
Applied egg-rr80.0%
if -9.9999999999999993e-130 < (/.f64 1 n) < -4.99999999999999981e-165Initial program 25.6%
Taylor expanded in n around inf 34.3%
+-rgt-identity34.3%
+-rgt-identity34.3%
log1p-def34.3%
Simplified34.3%
clear-num34.3%
inv-pow34.3%
Applied egg-rr34.3%
unpow-134.3%
Simplified34.3%
Taylor expanded in x around inf 91.7%
*-commutative91.7%
distribute-lft-out91.7%
Simplified91.7%
if 1.00000000000000008e-5 < (/.f64 1 n) < 1e238Initial program 72.3%
Taylor expanded in x around 0 65.3%
if 1e238 < (/.f64 1 n) Initial program 3.1%
Taylor expanded in n around inf 10.1%
+-rgt-identity10.1%
+-rgt-identity10.1%
log1p-def10.1%
Simplified10.1%
Taylor expanded in x around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification84.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))) (t_1 (/ (log (/ (+ 1.0 x) x)) n)))
(if (<= (/ 1.0 n) -2e-7)
t_0
(if (<= (/ 1.0 n) -1e-129)
t_1
(if (<= (/ 1.0 n) -5e-165)
(/ 1.0 (* n (+ x 0.5)))
(if (<= (/ 1.0 n) 1e-5)
t_1
(if (<= (/ 1.0 n) 1e+238) t_0 (/ 1.0 (* n x)))))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double t_1 = log(((1.0 + x) / x)) / n;
double tmp;
if ((1.0 / n) <= -2e-7) {
tmp = t_0;
} else if ((1.0 / n) <= -1e-129) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-165) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 1e-5) {
tmp = t_1;
} else if ((1.0 / n) <= 1e+238) {
tmp = t_0;
} else {
tmp = 1.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) :: t_1
real(8) :: tmp
t_0 = 1.0d0 - (x ** (1.0d0 / n))
t_1 = log(((1.0d0 + x) / x)) / n
if ((1.0d0 / n) <= (-2d-7)) then
tmp = t_0
else if ((1.0d0 / n) <= (-1d-129)) then
tmp = t_1
else if ((1.0d0 / n) <= (-5d-165)) then
tmp = 1.0d0 / (n * (x + 0.5d0))
else if ((1.0d0 / n) <= 1d-5) then
tmp = t_1
else if ((1.0d0 / n) <= 1d+238) then
tmp = t_0
else
tmp = 1.0d0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 - Math.pow(x, (1.0 / n));
double t_1 = Math.log(((1.0 + x) / x)) / n;
double tmp;
if ((1.0 / n) <= -2e-7) {
tmp = t_0;
} else if ((1.0 / n) <= -1e-129) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-165) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 1e-5) {
tmp = t_1;
} else if ((1.0 / n) <= 1e+238) {
tmp = t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) t_1 = math.log(((1.0 + x) / x)) / n tmp = 0 if (1.0 / n) <= -2e-7: tmp = t_0 elif (1.0 / n) <= -1e-129: tmp = t_1 elif (1.0 / n) <= -5e-165: tmp = 1.0 / (n * (x + 0.5)) elif (1.0 / n) <= 1e-5: tmp = t_1 elif (1.0 / n) <= 1e+238: tmp = t_0 else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) t_1 = Float64(log(Float64(Float64(1.0 + x) / x)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-7) tmp = t_0; elseif (Float64(1.0 / n) <= -1e-129) tmp = t_1; elseif (Float64(1.0 / n) <= -5e-165) tmp = Float64(1.0 / Float64(n * Float64(x + 0.5))); elseif (Float64(1.0 / n) <= 1e-5) tmp = t_1; elseif (Float64(1.0 / n) <= 1e+238) tmp = t_0; else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); t_1 = log(((1.0 + x) / x)) / n; tmp = 0.0; if ((1.0 / n) <= -2e-7) tmp = t_0; elseif ((1.0 / n) <= -1e-129) tmp = t_1; elseif ((1.0 / n) <= -5e-165) tmp = 1.0 / (n * (x + 0.5)); elseif ((1.0 / n) <= 1e-5) tmp = t_1; elseif ((1.0 / n) <= 1e+238) tmp = t_0; else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-7], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-129], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-165], N[(1.0 / N[(n * N[(x + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-5], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+238], t$95$0, N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-7}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{-129}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-165}:\\
\;\;\;\;\frac{1}{n \cdot \left(x + 0.5\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-5}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+238}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 1 n) < -1.9999999999999999e-7 or 1.00000000000000008e-5 < (/.f64 1 n) < 1e238Initial program 89.1%
Taylor expanded in x around 0 61.1%
if -1.9999999999999999e-7 < (/.f64 1 n) < -9.9999999999999993e-130 or -4.99999999999999981e-165 < (/.f64 1 n) < 1.00000000000000008e-5Initial program 25.8%
Taylor expanded in n around inf 78.0%
+-rgt-identity78.0%
+-rgt-identity78.0%
log1p-def78.0%
Simplified78.0%
log1p-udef78.0%
diff-log78.1%
Applied egg-rr78.1%
if -9.9999999999999993e-130 < (/.f64 1 n) < -4.99999999999999981e-165Initial program 25.6%
Taylor expanded in n around inf 34.3%
+-rgt-identity34.3%
+-rgt-identity34.3%
log1p-def34.3%
Simplified34.3%
clear-num34.3%
inv-pow34.3%
Applied egg-rr34.3%
unpow-134.3%
Simplified34.3%
Taylor expanded in x around inf 91.7%
*-commutative91.7%
distribute-lft-out91.7%
Simplified91.7%
if 1e238 < (/.f64 1 n) Initial program 3.1%
Taylor expanded in n around inf 10.1%
+-rgt-identity10.1%
+-rgt-identity10.1%
log1p-def10.1%
Simplified10.1%
Taylor expanded in x around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification72.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ (log (/ (+ 1.0 x) x)) n)))
(if (<= (/ 1.0 n) -5e-25)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) -1e-129)
t_1
(if (<= (/ 1.0 n) -5e-165)
(/ 1.0 (* n (+ x 0.5)))
(if (<= (/ 1.0 n) 1e-5)
t_1
(if (<= (/ 1.0 n) 1e+238) (- 1.0 t_0) (/ 1.0 (* n x)))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = log(((1.0 + x) / x)) / n;
double tmp;
if ((1.0 / n) <= -5e-25) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= -1e-129) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-165) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 1e-5) {
tmp = t_1;
} else if ((1.0 / n) <= 1e+238) {
tmp = 1.0 - t_0;
} else {
tmp = 1.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) :: t_1
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
t_1 = log(((1.0d0 + x) / x)) / n
if ((1.0d0 / n) <= (-5d-25)) then
tmp = (t_0 / n) / x
else if ((1.0d0 / n) <= (-1d-129)) then
tmp = t_1
else if ((1.0d0 / n) <= (-5d-165)) then
tmp = 1.0d0 / (n * (x + 0.5d0))
else if ((1.0d0 / n) <= 1d-5) then
tmp = t_1
else if ((1.0d0 / n) <= 1d+238) then
tmp = 1.0d0 - t_0
else
tmp = 1.0d0 / (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 t_1 = Math.log(((1.0 + x) / x)) / n;
double tmp;
if ((1.0 / n) <= -5e-25) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= -1e-129) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-165) {
tmp = 1.0 / (n * (x + 0.5));
} else if ((1.0 / n) <= 1e-5) {
tmp = t_1;
} else if ((1.0 / n) <= 1e+238) {
tmp = 1.0 - t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = math.log(((1.0 + x) / x)) / n tmp = 0 if (1.0 / n) <= -5e-25: tmp = (t_0 / n) / x elif (1.0 / n) <= -1e-129: tmp = t_1 elif (1.0 / n) <= -5e-165: tmp = 1.0 / (n * (x + 0.5)) elif (1.0 / n) <= 1e-5: tmp = t_1 elif (1.0 / n) <= 1e+238: tmp = 1.0 - t_0 else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(log(Float64(Float64(1.0 + x) / x)) / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-25) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= -1e-129) tmp = t_1; elseif (Float64(1.0 / n) <= -5e-165) tmp = Float64(1.0 / Float64(n * Float64(x + 0.5))); elseif (Float64(1.0 / n) <= 1e-5) tmp = t_1; elseif (Float64(1.0 / n) <= 1e+238) tmp = Float64(1.0 - t_0); else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = log(((1.0 + x) / x)) / n; tmp = 0.0; if ((1.0 / n) <= -5e-25) tmp = (t_0 / n) / x; elseif ((1.0 / n) <= -1e-129) tmp = t_1; elseif ((1.0 / n) <= -5e-165) tmp = 1.0 / (n * (x + 0.5)); elseif ((1.0 / n) <= 1e-5) tmp = t_1; elseif ((1.0 / n) <= 1e+238) tmp = 1.0 - t_0; else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-25], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-129], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-165], N[(1.0 / N[(n * N[(x + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-5], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+238], N[(1.0 - t$95$0), $MachinePrecision], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{-25}:\\
\;\;\;\;\frac{\frac{t_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{-129}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-165}:\\
\;\;\;\;\frac{1}{n \cdot \left(x + 0.5\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-5}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+238}:\\
\;\;\;\;1 - t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 1 n) < -4.99999999999999962e-25Initial program 91.8%
Taylor expanded in x around inf 95.9%
mul-1-neg95.9%
log-rec95.9%
mul-1-neg95.9%
distribute-neg-frac95.9%
mul-1-neg95.9%
remove-double-neg95.9%
*-commutative95.9%
Simplified95.9%
div-inv95.9%
pow-to-exp95.9%
*-un-lft-identity95.9%
times-frac95.9%
Applied egg-rr95.9%
associate-*l/96.0%
*-un-lft-identity96.0%
Applied egg-rr96.0%
if -4.99999999999999962e-25 < (/.f64 1 n) < -9.9999999999999993e-130 or -4.99999999999999981e-165 < (/.f64 1 n) < 1.00000000000000008e-5Initial program 26.4%
Taylor expanded in n around inf 80.0%
+-rgt-identity80.0%
+-rgt-identity80.0%
log1p-def80.0%
Simplified80.0%
log1p-udef80.0%
diff-log80.0%
Applied egg-rr80.0%
if -9.9999999999999993e-130 < (/.f64 1 n) < -4.99999999999999981e-165Initial program 25.6%
Taylor expanded in n around inf 34.3%
+-rgt-identity34.3%
+-rgt-identity34.3%
log1p-def34.3%
Simplified34.3%
clear-num34.3%
inv-pow34.3%
Applied egg-rr34.3%
unpow-134.3%
Simplified34.3%
Taylor expanded in x around inf 91.7%
*-commutative91.7%
distribute-lft-out91.7%
Simplified91.7%
if 1.00000000000000008e-5 < (/.f64 1 n) < 1e238Initial program 72.3%
Taylor expanded in x around 0 64.3%
if 1e238 < (/.f64 1 n) Initial program 3.1%
Taylor expanded in n around inf 10.1%
+-rgt-identity10.1%
+-rgt-identity10.1%
log1p-def10.1%
Simplified10.1%
Taylor expanded in x around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification83.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= x 1.2e-199)
t_0
(if (<= x 1.46e-158)
(/ (- (log x)) n)
(if (<= x 1.6e-110)
t_0
(if (<= x 1.0) (- (/ x n) (/ (log x) n)) (/ (/ 1.0 x) n)))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double tmp;
if (x <= 1.2e-199) {
tmp = t_0;
} else if (x <= 1.46e-158) {
tmp = -log(x) / n;
} else if (x <= 1.6e-110) {
tmp = t_0;
} else if (x <= 1.0) {
tmp = (x / n) - (log(x) / n);
} else {
tmp = (1.0 / x) / n;
}
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 = 1.0d0 - (x ** (1.0d0 / n))
if (x <= 1.2d-199) then
tmp = t_0
else if (x <= 1.46d-158) then
tmp = -log(x) / n
else if (x <= 1.6d-110) then
tmp = t_0
else if (x <= 1.0d0) then
tmp = (x / n) - (log(x) / n)
else
tmp = (1.0d0 / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 - Math.pow(x, (1.0 / n));
double tmp;
if (x <= 1.2e-199) {
tmp = t_0;
} else if (x <= 1.46e-158) {
tmp = -Math.log(x) / n;
} else if (x <= 1.6e-110) {
tmp = t_0;
} else if (x <= 1.0) {
tmp = (x / n) - (Math.log(x) / n);
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) tmp = 0 if x <= 1.2e-199: tmp = t_0 elif x <= 1.46e-158: tmp = -math.log(x) / n elif x <= 1.6e-110: tmp = t_0 elif x <= 1.0: tmp = (x / n) - (math.log(x) / n) else: tmp = (1.0 / x) / n return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) tmp = 0.0 if (x <= 1.2e-199) tmp = t_0; elseif (x <= 1.46e-158) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 1.6e-110) tmp = t_0; elseif (x <= 1.0) tmp = Float64(Float64(x / n) - Float64(log(x) / n)); else tmp = Float64(Float64(1.0 / x) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); tmp = 0.0; if (x <= 1.2e-199) tmp = t_0; elseif (x <= 1.46e-158) tmp = -log(x) / n; elseif (x <= 1.6e-110) tmp = t_0; elseif (x <= 1.0) tmp = (x / n) - (log(x) / n); else tmp = (1.0 / x) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.2e-199], t$95$0, If[LessEqual[x, 1.46e-158], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 1.6e-110], t$95$0, If[LessEqual[x, 1.0], N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 1.2 \cdot 10^{-199}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.46 \cdot 10^{-158}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{-110}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\end{array}
\end{array}
if x < 1.19999999999999998e-199 or 1.4599999999999999e-158 < x < 1.60000000000000014e-110Initial program 60.5%
Taylor expanded in x around 0 60.5%
if 1.19999999999999998e-199 < x < 1.4599999999999999e-158Initial program 39.1%
Taylor expanded in x around 0 39.1%
Taylor expanded in n around inf 58.9%
neg-mul-158.9%
distribute-neg-frac58.9%
Simplified58.9%
if 1.60000000000000014e-110 < x < 1Initial program 32.1%
Taylor expanded in n around inf 54.2%
+-rgt-identity54.2%
+-rgt-identity54.2%
log1p-def54.2%
Simplified54.2%
Taylor expanded in x around 0 51.6%
neg-mul-151.6%
+-commutative51.6%
unsub-neg51.6%
Simplified51.6%
if 1 < x Initial program 61.6%
Taylor expanded in n around inf 62.2%
+-rgt-identity62.2%
+-rgt-identity62.2%
log1p-def62.2%
Simplified62.2%
Taylor expanded in x around inf 66.8%
Final simplification60.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= x 1.45e-199)
t_0
(if (<= x 2e-158)
(/ (- (log x)) n)
(if (<= x 2.3e-110)
t_0
(if (<= x 1.0) (/ (- x (log x)) n) (/ (/ 1.0 x) n)))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double tmp;
if (x <= 1.45e-199) {
tmp = t_0;
} else if (x <= 2e-158) {
tmp = -log(x) / n;
} else if (x <= 2.3e-110) {
tmp = t_0;
} else if (x <= 1.0) {
tmp = (x - log(x)) / n;
} else {
tmp = (1.0 / x) / n;
}
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 = 1.0d0 - (x ** (1.0d0 / n))
if (x <= 1.45d-199) then
tmp = t_0
else if (x <= 2d-158) then
tmp = -log(x) / n
else if (x <= 2.3d-110) then
tmp = t_0
else if (x <= 1.0d0) then
tmp = (x - log(x)) / n
else
tmp = (1.0d0 / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 - Math.pow(x, (1.0 / n));
double tmp;
if (x <= 1.45e-199) {
tmp = t_0;
} else if (x <= 2e-158) {
tmp = -Math.log(x) / n;
} else if (x <= 2.3e-110) {
tmp = t_0;
} else if (x <= 1.0) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) tmp = 0 if x <= 1.45e-199: tmp = t_0 elif x <= 2e-158: tmp = -math.log(x) / n elif x <= 2.3e-110: tmp = t_0 elif x <= 1.0: tmp = (x - math.log(x)) / n else: tmp = (1.0 / x) / n return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) tmp = 0.0 if (x <= 1.45e-199) tmp = t_0; elseif (x <= 2e-158) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 2.3e-110) tmp = t_0; elseif (x <= 1.0) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(1.0 / x) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); tmp = 0.0; if (x <= 1.45e-199) tmp = t_0; elseif (x <= 2e-158) tmp = -log(x) / n; elseif (x <= 2.3e-110) tmp = t_0; elseif (x <= 1.0) tmp = (x - log(x)) / n; else tmp = (1.0 / x) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.45e-199], t$95$0, If[LessEqual[x, 2e-158], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 2.3e-110], t$95$0, If[LessEqual[x, 1.0], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 1.45 \cdot 10^{-199}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2 \cdot 10^{-158}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-110}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\end{array}
\end{array}
if x < 1.45e-199 or 2.00000000000000013e-158 < x < 2.3000000000000001e-110Initial program 60.5%
Taylor expanded in x around 0 60.5%
if 1.45e-199 < x < 2.00000000000000013e-158Initial program 39.1%
Taylor expanded in x around 0 39.1%
Taylor expanded in n around inf 58.9%
neg-mul-158.9%
distribute-neg-frac58.9%
Simplified58.9%
if 2.3000000000000001e-110 < x < 1Initial program 32.1%
Taylor expanded in n around inf 54.2%
+-rgt-identity54.2%
+-rgt-identity54.2%
log1p-def54.2%
Simplified54.2%
Taylor expanded in x around 0 51.5%
neg-mul-151.5%
unsub-neg51.5%
Simplified51.5%
if 1 < x Initial program 61.6%
Taylor expanded in n around inf 62.2%
+-rgt-identity62.2%
+-rgt-identity62.2%
log1p-def62.2%
Simplified62.2%
Taylor expanded in x around inf 66.8%
Final simplification60.7%
(FPCore (x n) :precision binary64 (if (<= x 1.0) (/ (- x (log x)) n) (/ (/ 1.0 x) n)))
double code(double x, double n) {
double tmp;
if (x <= 1.0) {
tmp = (x - log(x)) / n;
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 1.0d0) then
tmp = (x - log(x)) / n
else
tmp = (1.0d0 / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 1.0) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.0: tmp = (x - math.log(x)) / n else: tmp = (1.0 / x) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 1.0) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(1.0 / x) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.0) tmp = (x - log(x)) / n; else tmp = (1.0 / x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.0], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\end{array}
\end{array}
if x < 1Initial program 46.9%
Taylor expanded in n around inf 48.2%
+-rgt-identity48.2%
+-rgt-identity48.2%
log1p-def48.2%
Simplified48.2%
Taylor expanded in x around 0 47.2%
neg-mul-147.2%
unsub-neg47.2%
Simplified47.2%
if 1 < x Initial program 61.6%
Taylor expanded in n around inf 62.2%
+-rgt-identity62.2%
+-rgt-identity62.2%
log1p-def62.2%
Simplified62.2%
Taylor expanded in x around inf 66.8%
Final simplification54.7%
(FPCore (x n) :precision binary64 (if (<= x 0.55) (/ (- (log x)) n) (/ (/ 1.0 x) n)))
double code(double x, double n) {
double tmp;
if (x <= 0.55) {
tmp = -log(x) / n;
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 0.55d0) then
tmp = -log(x) / n
else
tmp = (1.0d0 / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.55) {
tmp = -Math.log(x) / n;
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.55: tmp = -math.log(x) / n else: tmp = (1.0 / x) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 0.55) tmp = Float64(Float64(-log(x)) / n); else tmp = Float64(Float64(1.0 / x) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.55) tmp = -log(x) / n; else tmp = (1.0 / x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.55], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.55:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\end{array}
\end{array}
if x < 0.55000000000000004Initial program 46.9%
Taylor expanded in x around 0 45.1%
Taylor expanded in n around inf 46.4%
neg-mul-146.4%
distribute-neg-frac46.4%
Simplified46.4%
if 0.55000000000000004 < x Initial program 61.6%
Taylor expanded in n around inf 62.2%
+-rgt-identity62.2%
+-rgt-identity62.2%
log1p-def62.2%
Simplified62.2%
Taylor expanded in x around inf 66.8%
Final simplification54.2%
(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(1.0 / Float64(n * x)) end
function tmp = code(x, n) tmp = 1.0 / (n * x); end
code[x_, n_] := N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{n \cdot x}
\end{array}
Initial program 52.6%
Taylor expanded in n around inf 53.5%
+-rgt-identity53.5%
+-rgt-identity53.5%
log1p-def53.5%
Simplified53.5%
Taylor expanded in x around inf 41.0%
*-commutative41.0%
Simplified41.0%
Final simplification41.0%
(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 52.6%
Taylor expanded in x around inf 55.5%
mul-1-neg55.5%
log-rec55.5%
mul-1-neg55.5%
distribute-neg-frac55.5%
mul-1-neg55.5%
remove-double-neg55.5%
*-commutative55.5%
Simplified55.5%
Taylor expanded in n around inf 41.0%
associate-/r*41.5%
Simplified41.5%
Final simplification41.5%
(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(Float64(1.0 / x) / n) end
function tmp = code(x, n) tmp = (1.0 / x) / n; end
code[x_, n_] := N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x}}{n}
\end{array}
Initial program 52.6%
Taylor expanded in n around inf 53.5%
+-rgt-identity53.5%
+-rgt-identity53.5%
log1p-def53.5%
Simplified53.5%
Taylor expanded in x around inf 41.5%
Final simplification41.5%
(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 52.6%
Taylor expanded in x around 0 32.6%
Taylor expanded in x around inf 4.5%
Final simplification4.5%
herbie shell --seed 2023311
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))