
(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 19 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 (/ 1.0 (* n x))) (t_1 (log (/ x (+ x 1.0)))) (t_2 (/ (- t_1) n)))
(if (<= (/ 1.0 n) -1e-30)
(/ (exp (/ (log x) n)) (* n x))
(if (<= (/ 1.0 n) -1e-87)
t_2
(if (<= (/ 1.0 n) -5e-116)
(/ (/ 1.0 x) n)
(if (<= (/ 1.0 n) 2e-112)
t_2
(if (<= (/ 1.0 n) 5e-104)
(- t_0 (/ 0.5 (* n (pow x 2.0))))
(if (<= (/ 1.0 n) 5e-7)
(* t_1 (/ 1.0 (- n)))
(if (<= (/ 1.0 n) 1e+214)
(- (+ 1.0 (/ x n)) (pow x (/ 1.0 n)))
t_0)))))))))
double code(double x, double n) {
double t_0 = 1.0 / (n * x);
double t_1 = log((x / (x + 1.0)));
double t_2 = -t_1 / n;
double tmp;
if ((1.0 / n) <= -1e-30) {
tmp = exp((log(x) / n)) / (n * x);
} else if ((1.0 / n) <= -1e-87) {
tmp = t_2;
} else if ((1.0 / n) <= -5e-116) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e-112) {
tmp = t_2;
} else if ((1.0 / n) <= 5e-104) {
tmp = t_0 - (0.5 / (n * pow(x, 2.0)));
} else if ((1.0 / n) <= 5e-7) {
tmp = t_1 * (1.0 / -n);
} else if ((1.0 / n) <= 1e+214) {
tmp = (1.0 + (x / n)) - pow(x, (1.0 / n));
} else {
tmp = 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 = log((x / (x + 1.0d0)))
t_2 = -t_1 / n
if ((1.0d0 / n) <= (-1d-30)) then
tmp = exp((log(x) / n)) / (n * x)
else if ((1.0d0 / n) <= (-1d-87)) then
tmp = t_2
else if ((1.0d0 / n) <= (-5d-116)) then
tmp = (1.0d0 / x) / n
else if ((1.0d0 / n) <= 2d-112) then
tmp = t_2
else if ((1.0d0 / n) <= 5d-104) then
tmp = t_0 - (0.5d0 / (n * (x ** 2.0d0)))
else if ((1.0d0 / n) <= 5d-7) then
tmp = t_1 * (1.0d0 / -n)
else if ((1.0d0 / n) <= 1d+214) then
tmp = (1.0d0 + (x / n)) - (x ** (1.0d0 / n))
else
tmp = 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.log((x / (x + 1.0)));
double t_2 = -t_1 / n;
double tmp;
if ((1.0 / n) <= -1e-30) {
tmp = Math.exp((Math.log(x) / n)) / (n * x);
} else if ((1.0 / n) <= -1e-87) {
tmp = t_2;
} else if ((1.0 / n) <= -5e-116) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e-112) {
tmp = t_2;
} else if ((1.0 / n) <= 5e-104) {
tmp = t_0 - (0.5 / (n * Math.pow(x, 2.0)));
} else if ((1.0 / n) <= 5e-7) {
tmp = t_1 * (1.0 / -n);
} else if ((1.0 / n) <= 1e+214) {
tmp = (1.0 + (x / n)) - Math.pow(x, (1.0 / n));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = 1.0 / (n * x) t_1 = math.log((x / (x + 1.0))) t_2 = -t_1 / n tmp = 0 if (1.0 / n) <= -1e-30: tmp = math.exp((math.log(x) / n)) / (n * x) elif (1.0 / n) <= -1e-87: tmp = t_2 elif (1.0 / n) <= -5e-116: tmp = (1.0 / x) / n elif (1.0 / n) <= 2e-112: tmp = t_2 elif (1.0 / n) <= 5e-104: tmp = t_0 - (0.5 / (n * math.pow(x, 2.0))) elif (1.0 / n) <= 5e-7: tmp = t_1 * (1.0 / -n) elif (1.0 / n) <= 1e+214: tmp = (1.0 + (x / n)) - math.pow(x, (1.0 / n)) else: tmp = t_0 return tmp
function code(x, n) t_0 = Float64(1.0 / Float64(n * x)) t_1 = log(Float64(x / Float64(x + 1.0))) t_2 = Float64(Float64(-t_1) / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-30) tmp = Float64(exp(Float64(log(x) / n)) / Float64(n * x)); elseif (Float64(1.0 / n) <= -1e-87) tmp = t_2; elseif (Float64(1.0 / n) <= -5e-116) tmp = Float64(Float64(1.0 / x) / n); elseif (Float64(1.0 / n) <= 2e-112) tmp = t_2; elseif (Float64(1.0 / n) <= 5e-104) tmp = Float64(t_0 - Float64(0.5 / Float64(n * (x ^ 2.0)))); elseif (Float64(1.0 / n) <= 5e-7) tmp = Float64(t_1 * Float64(1.0 / Float64(-n))); elseif (Float64(1.0 / n) <= 1e+214) tmp = Float64(Float64(1.0 + Float64(x / n)) - (x ^ Float64(1.0 / n))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 / (n * x); t_1 = log((x / (x + 1.0))); t_2 = -t_1 / n; tmp = 0.0; if ((1.0 / n) <= -1e-30) tmp = exp((log(x) / n)) / (n * x); elseif ((1.0 / n) <= -1e-87) tmp = t_2; elseif ((1.0 / n) <= -5e-116) tmp = (1.0 / x) / n; elseif ((1.0 / n) <= 2e-112) tmp = t_2; elseif ((1.0 / n) <= 5e-104) tmp = t_0 - (0.5 / (n * (x ^ 2.0))); elseif ((1.0 / n) <= 5e-7) tmp = t_1 * (1.0 / -n); elseif ((1.0 / n) <= 1e+214) tmp = (1.0 + (x / n)) - (x ^ (1.0 / n)); else tmp = 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[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[((-t$95$1) / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-30], N[(N[Exp[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-87], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-116], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-112], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-104], N[(t$95$0 - N[(0.5 / N[(n * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-7], N[(t$95$1 * N[(1.0 / (-n)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+214], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{n \cdot x}\\
t_1 := \log \left(\frac{x}{x + 1}\right)\\
t_2 := \frac{-t_1}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-30}:\\
\;\;\;\;\frac{e^{\frac{\log x}{n}}}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{-87}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-116}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-112}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-104}:\\
\;\;\;\;t_0 - \frac{0.5}{n \cdot {x}^{2}}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-7}:\\
\;\;\;\;t_1 \cdot \frac{1}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+214}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -1e-30Initial program 92.3%
Taylor expanded in x around inf 96.4%
mul-1-neg96.4%
log-rec96.4%
mul-1-neg96.4%
distribute-neg-frac96.4%
mul-1-neg96.4%
remove-double-neg96.4%
*-commutative96.4%
Simplified96.4%
if -1e-30 < (/.f64 1 n) < -1.00000000000000002e-87 or -5.0000000000000003e-116 < (/.f64 1 n) < 1.9999999999999999e-112Initial program 29.0%
Taylor expanded in n around inf 89.3%
+-rgt-identity89.3%
+-rgt-identity89.3%
log1p-def89.3%
Simplified89.3%
log1p-udef89.3%
diff-log89.5%
Applied egg-rr89.5%
clear-num89.5%
log-rec89.5%
Applied egg-rr89.5%
if -1.00000000000000002e-87 < (/.f64 1 n) < -5.0000000000000003e-116Initial program 5.0%
Taylor expanded in n around inf 18.7%
+-rgt-identity18.7%
+-rgt-identity18.7%
log1p-def18.7%
Simplified18.7%
Taylor expanded in x around inf 86.0%
if 1.9999999999999999e-112 < (/.f64 1 n) < 4.99999999999999979e-104Initial program 5.7%
Taylor expanded in n around inf 11.2%
+-rgt-identity11.2%
+-rgt-identity11.2%
log1p-def11.2%
Simplified11.2%
Taylor expanded in x around inf 99.7%
*-commutative99.7%
associate-*r/99.7%
metadata-eval99.7%
*-commutative99.7%
Simplified99.7%
if 4.99999999999999979e-104 < (/.f64 1 n) < 4.99999999999999977e-7Initial program 8.0%
Taylor expanded in n around inf 60.5%
+-rgt-identity60.5%
+-rgt-identity60.5%
log1p-def60.5%
Simplified60.5%
log1p-udef60.5%
diff-log60.8%
Applied egg-rr60.8%
log-div60.5%
log1p-udef60.5%
frac-2neg60.5%
div-inv60.6%
log1p-udef60.6%
log-div60.8%
neg-log60.8%
clear-num60.9%
Applied egg-rr60.9%
if 4.99999999999999977e-7 < (/.f64 1 n) < 9.9999999999999995e213Initial program 77.4%
Taylor expanded in x around 0 77.4%
if 9.9999999999999995e213 < (/.f64 1 n) Initial program 9.7%
Taylor expanded in n around inf 8.7%
+-rgt-identity8.7%
+-rgt-identity8.7%
log1p-def8.7%
Simplified8.7%
Taylor expanded in x around inf 86.2%
*-commutative86.2%
Simplified86.2%
Final simplification87.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (- (log (/ x (+ x 1.0)))) n)) (t_1 (log (+ x 1.0))))
(if (<= n -1.62e+115)
t_0
(if (<= n -1.18e+88)
(/ (/ 1.0 x) n)
(if (<= n -160000.0)
(-
(+
(/ (- t_1 (log x)) n)
(+
(/
(-
(* -0.16666666666666666 (pow (log x) 3.0))
(* -0.16666666666666666 (pow t_1 3.0)))
(pow n 3.0))
(+
(* 0.041666666666666664 (/ (pow t_1 4.0) (pow n 4.0)))
(* 0.5 (/ (pow t_1 2.0) (pow n 2.0))))))
(+
(* 0.041666666666666664 (/ (pow (log x) 4.0) (pow n 4.0)))
(* 0.5 (/ (pow (log x) 2.0) (pow n 2.0)))))
(if (<= n 2200000.0) (- (exp (/ x n)) (pow x (/ 1.0 n))) t_0))))))
double code(double x, double n) {
double t_0 = -log((x / (x + 1.0))) / n;
double t_1 = log((x + 1.0));
double tmp;
if (n <= -1.62e+115) {
tmp = t_0;
} else if (n <= -1.18e+88) {
tmp = (1.0 / x) / n;
} else if (n <= -160000.0) {
tmp = (((t_1 - log(x)) / n) + ((((-0.16666666666666666 * pow(log(x), 3.0)) - (-0.16666666666666666 * pow(t_1, 3.0))) / pow(n, 3.0)) + ((0.041666666666666664 * (pow(t_1, 4.0) / pow(n, 4.0))) + (0.5 * (pow(t_1, 2.0) / pow(n, 2.0)))))) - ((0.041666666666666664 * (pow(log(x), 4.0) / pow(n, 4.0))) + (0.5 * (pow(log(x), 2.0) / pow(n, 2.0))));
} else if (n <= 2200000.0) {
tmp = exp((x / n)) - pow(x, (1.0 / n));
} else {
tmp = 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 = -log((x / (x + 1.0d0))) / n
t_1 = log((x + 1.0d0))
if (n <= (-1.62d+115)) then
tmp = t_0
else if (n <= (-1.18d+88)) then
tmp = (1.0d0 / x) / n
else if (n <= (-160000.0d0)) then
tmp = (((t_1 - log(x)) / n) + (((((-0.16666666666666666d0) * (log(x) ** 3.0d0)) - ((-0.16666666666666666d0) * (t_1 ** 3.0d0))) / (n ** 3.0d0)) + ((0.041666666666666664d0 * ((t_1 ** 4.0d0) / (n ** 4.0d0))) + (0.5d0 * ((t_1 ** 2.0d0) / (n ** 2.0d0)))))) - ((0.041666666666666664d0 * ((log(x) ** 4.0d0) / (n ** 4.0d0))) + (0.5d0 * ((log(x) ** 2.0d0) / (n ** 2.0d0))))
else if (n <= 2200000.0d0) then
tmp = exp((x / n)) - (x ** (1.0d0 / n))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = -Math.log((x / (x + 1.0))) / n;
double t_1 = Math.log((x + 1.0));
double tmp;
if (n <= -1.62e+115) {
tmp = t_0;
} else if (n <= -1.18e+88) {
tmp = (1.0 / x) / n;
} else if (n <= -160000.0) {
tmp = (((t_1 - Math.log(x)) / n) + ((((-0.16666666666666666 * Math.pow(Math.log(x), 3.0)) - (-0.16666666666666666 * Math.pow(t_1, 3.0))) / Math.pow(n, 3.0)) + ((0.041666666666666664 * (Math.pow(t_1, 4.0) / Math.pow(n, 4.0))) + (0.5 * (Math.pow(t_1, 2.0) / Math.pow(n, 2.0)))))) - ((0.041666666666666664 * (Math.pow(Math.log(x), 4.0) / Math.pow(n, 4.0))) + (0.5 * (Math.pow(Math.log(x), 2.0) / Math.pow(n, 2.0))));
} else if (n <= 2200000.0) {
tmp = Math.exp((x / n)) - Math.pow(x, (1.0 / n));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = -math.log((x / (x + 1.0))) / n t_1 = math.log((x + 1.0)) tmp = 0 if n <= -1.62e+115: tmp = t_0 elif n <= -1.18e+88: tmp = (1.0 / x) / n elif n <= -160000.0: tmp = (((t_1 - math.log(x)) / n) + ((((-0.16666666666666666 * math.pow(math.log(x), 3.0)) - (-0.16666666666666666 * math.pow(t_1, 3.0))) / math.pow(n, 3.0)) + ((0.041666666666666664 * (math.pow(t_1, 4.0) / math.pow(n, 4.0))) + (0.5 * (math.pow(t_1, 2.0) / math.pow(n, 2.0)))))) - ((0.041666666666666664 * (math.pow(math.log(x), 4.0) / math.pow(n, 4.0))) + (0.5 * (math.pow(math.log(x), 2.0) / math.pow(n, 2.0)))) elif n <= 2200000.0: tmp = math.exp((x / n)) - math.pow(x, (1.0 / n)) else: tmp = t_0 return tmp
function code(x, n) t_0 = Float64(Float64(-log(Float64(x / Float64(x + 1.0)))) / n) t_1 = log(Float64(x + 1.0)) tmp = 0.0 if (n <= -1.62e+115) tmp = t_0; elseif (n <= -1.18e+88) tmp = Float64(Float64(1.0 / x) / n); elseif (n <= -160000.0) tmp = Float64(Float64(Float64(Float64(t_1 - log(x)) / n) + Float64(Float64(Float64(Float64(-0.16666666666666666 * (log(x) ^ 3.0)) - Float64(-0.16666666666666666 * (t_1 ^ 3.0))) / (n ^ 3.0)) + Float64(Float64(0.041666666666666664 * Float64((t_1 ^ 4.0) / (n ^ 4.0))) + Float64(0.5 * Float64((t_1 ^ 2.0) / (n ^ 2.0)))))) - Float64(Float64(0.041666666666666664 * Float64((log(x) ^ 4.0) / (n ^ 4.0))) + Float64(0.5 * Float64((log(x) ^ 2.0) / (n ^ 2.0))))); elseif (n <= 2200000.0) tmp = Float64(exp(Float64(x / n)) - (x ^ Float64(1.0 / n))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, n) t_0 = -log((x / (x + 1.0))) / n; t_1 = log((x + 1.0)); tmp = 0.0; if (n <= -1.62e+115) tmp = t_0; elseif (n <= -1.18e+88) tmp = (1.0 / x) / n; elseif (n <= -160000.0) tmp = (((t_1 - log(x)) / n) + ((((-0.16666666666666666 * (log(x) ^ 3.0)) - (-0.16666666666666666 * (t_1 ^ 3.0))) / (n ^ 3.0)) + ((0.041666666666666664 * ((t_1 ^ 4.0) / (n ^ 4.0))) + (0.5 * ((t_1 ^ 2.0) / (n ^ 2.0)))))) - ((0.041666666666666664 * ((log(x) ^ 4.0) / (n ^ 4.0))) + (0.5 * ((log(x) ^ 2.0) / (n ^ 2.0)))); elseif (n <= 2200000.0) tmp = exp((x / n)) - (x ^ (1.0 / n)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[((-N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / n), $MachinePrecision]}, Block[{t$95$1 = N[Log[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[n, -1.62e+115], t$95$0, If[LessEqual[n, -1.18e+88], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[n, -160000.0], N[(N[(N[(N[(t$95$1 - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(N[(N[(N[(-0.16666666666666666 * N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] - N[(-0.16666666666666666 * N[Power[t$95$1, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[n, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.041666666666666664 * N[(N[Power[t$95$1, 4.0], $MachinePrecision] / N[Power[n, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[Power[t$95$1, 2.0], $MachinePrecision] / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(0.041666666666666664 * N[(N[Power[N[Log[x], $MachinePrecision], 4.0], $MachinePrecision] / N[Power[n, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2200000.0], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-\log \left(\frac{x}{x + 1}\right)}{n}\\
t_1 := \log \left(x + 1\right)\\
\mathbf{if}\;n \leq -1.62 \cdot 10^{+115}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq -1.18 \cdot 10^{+88}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;n \leq -160000:\\
\;\;\;\;\left(\frac{t_1 - \log x}{n} + \left(\frac{-0.16666666666666666 \cdot {\log x}^{3} - -0.16666666666666666 \cdot {t_1}^{3}}{{n}^{3}} + \left(0.041666666666666664 \cdot \frac{{t_1}^{4}}{{n}^{4}} + 0.5 \cdot \frac{{t_1}^{2}}{{n}^{2}}\right)\right)\right) - \left(0.041666666666666664 \cdot \frac{{\log x}^{4}}{{n}^{4}} + 0.5 \cdot \frac{{\log x}^{2}}{{n}^{2}}\right)\\
\mathbf{elif}\;n \leq 2200000:\\
\;\;\;\;e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -1.62e115 or 2.2e6 < n Initial program 26.6%
Taylor expanded in n around inf 78.9%
+-rgt-identity78.9%
+-rgt-identity78.9%
log1p-def78.9%
Simplified78.9%
log1p-udef78.9%
diff-log79.4%
Applied egg-rr79.4%
clear-num79.4%
log-rec79.6%
Applied egg-rr79.6%
if -1.62e115 < n < -1.1799999999999999e88Initial program 5.0%
Taylor expanded in n around inf 18.7%
+-rgt-identity18.7%
+-rgt-identity18.7%
log1p-def18.7%
Simplified18.7%
Taylor expanded in x around inf 86.0%
if -1.1799999999999999e88 < n < -1.6e5Initial program 10.7%
Taylor expanded in n around -inf 77.2%
if -1.6e5 < n < 2.2e6Initial program 87.5%
Taylor expanded in n around 0 87.5%
log1p-def98.1%
Simplified98.1%
Taylor expanded in x around 0 98.1%
Final simplification87.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (- (log (/ x (+ x 1.0)))) n)))
(if (<= n -2.65e+120)
t_0
(if (<= n -1.3e+88)
(/ (/ 1.0 x) n)
(if (<= n -720000.0)
(+
(/ (- (log1p x) (log x)) n)
(+
(/
(* 0.16666666666666666 (- (pow (log1p x) 3.0) (pow (log x) 3.0)))
(pow n 3.0))
(*
0.5
(-
(/ (pow (log1p x) 2.0) (pow n 2.0))
(/ (pow (log x) 2.0) (pow n 2.0))))))
(if (<= n 2200000.0) (- (exp (/ x n)) (pow x (/ 1.0 n))) t_0))))))
double code(double x, double n) {
double t_0 = -log((x / (x + 1.0))) / n;
double tmp;
if (n <= -2.65e+120) {
tmp = t_0;
} else if (n <= -1.3e+88) {
tmp = (1.0 / x) / n;
} else if (n <= -720000.0) {
tmp = ((log1p(x) - log(x)) / n) + (((0.16666666666666666 * (pow(log1p(x), 3.0) - pow(log(x), 3.0))) / pow(n, 3.0)) + (0.5 * ((pow(log1p(x), 2.0) / pow(n, 2.0)) - (pow(log(x), 2.0) / pow(n, 2.0)))));
} else if (n <= 2200000.0) {
tmp = exp((x / n)) - pow(x, (1.0 / n));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = -Math.log((x / (x + 1.0))) / n;
double tmp;
if (n <= -2.65e+120) {
tmp = t_0;
} else if (n <= -1.3e+88) {
tmp = (1.0 / x) / n;
} else if (n <= -720000.0) {
tmp = ((Math.log1p(x) - Math.log(x)) / n) + (((0.16666666666666666 * (Math.pow(Math.log1p(x), 3.0) - Math.pow(Math.log(x), 3.0))) / Math.pow(n, 3.0)) + (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)))));
} else if (n <= 2200000.0) {
tmp = Math.exp((x / n)) - Math.pow(x, (1.0 / n));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = -math.log((x / (x + 1.0))) / n tmp = 0 if n <= -2.65e+120: tmp = t_0 elif n <= -1.3e+88: tmp = (1.0 / x) / n elif n <= -720000.0: tmp = ((math.log1p(x) - math.log(x)) / n) + (((0.16666666666666666 * (math.pow(math.log1p(x), 3.0) - math.pow(math.log(x), 3.0))) / math.pow(n, 3.0)) + (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))))) elif n <= 2200000.0: tmp = math.exp((x / n)) - math.pow(x, (1.0 / n)) else: tmp = t_0 return tmp
function code(x, n) t_0 = Float64(Float64(-log(Float64(x / Float64(x + 1.0)))) / n) tmp = 0.0 if (n <= -2.65e+120) tmp = t_0; elseif (n <= -1.3e+88) tmp = Float64(Float64(1.0 / x) / n); elseif (n <= -720000.0) tmp = Float64(Float64(Float64(log1p(x) - log(x)) / n) + Float64(Float64(Float64(0.16666666666666666 * Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0))) / (n ^ 3.0)) + Float64(0.5 * Float64(Float64((log1p(x) ^ 2.0) / (n ^ 2.0)) - Float64((log(x) ^ 2.0) / (n ^ 2.0)))))); elseif (n <= 2200000.0) tmp = Float64(exp(Float64(x / n)) - (x ^ Float64(1.0 / n))); else tmp = t_0; end return tmp end
code[x_, n_] := Block[{t$95$0 = N[((-N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[n, -2.65e+120], t$95$0, If[LessEqual[n, -1.3e+88], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[n, -720000.0], N[(N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(N[(N[(0.16666666666666666 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 3.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[n, 3.0], $MachinePrecision]), $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]), $MachinePrecision], If[LessEqual[n, 2200000.0], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-\log \left(\frac{x}{x + 1}\right)}{n}\\
\mathbf{if}\;n \leq -2.65 \cdot 10^{+120}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq -1.3 \cdot 10^{+88}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;n \leq -720000:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n} + \left(\frac{0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right)}{{n}^{3}} + 0.5 \cdot \left(\frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{{n}^{2}} - \frac{{\log x}^{2}}{{n}^{2}}\right)\right)\\
\mathbf{elif}\;n \leq 2200000:\\
\;\;\;\;e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -2.64999999999999993e120 or 2.2e6 < n Initial program 26.6%
Taylor expanded in n around inf 78.9%
+-rgt-identity78.9%
+-rgt-identity78.9%
log1p-def78.9%
Simplified78.9%
log1p-udef78.9%
diff-log79.4%
Applied egg-rr79.4%
clear-num79.4%
log-rec79.6%
Applied egg-rr79.6%
if -2.64999999999999993e120 < n < -1.3e88Initial program 5.0%
Taylor expanded in n around inf 18.7%
+-rgt-identity18.7%
+-rgt-identity18.7%
log1p-def18.7%
Simplified18.7%
Taylor expanded in x around inf 86.0%
if -1.3e88 < n < -7.2e5Initial program 7.2%
Taylor expanded in n around -inf 76.4%
associate--l+76.5%
associate-*r/76.5%
mul-1-neg76.5%
distribute-lft-out--76.5%
mul-1-neg76.5%
remove-double-neg76.5%
log1p-def76.5%
associate--l+76.5%
Simplified76.5%
if -7.2e5 < n < 2.2e6Initial program 87.5%
Taylor expanded in n around 0 87.5%
log1p-def98.0%
Simplified98.0%
Taylor expanded in x around 0 98.0%
Final simplification87.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (- (log (/ x (+ x 1.0)))) n)))
(if (<= n -1.15e+121)
t_0
(if (<= n -1.3e+88)
(/ (/ 1.0 x) n)
(if (<= n -15500000.0)
(+
(/ (- (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 (<= n 2200000.0) (- (exp (/ x n)) (pow x (/ 1.0 n))) t_0))))))
double code(double x, double n) {
double t_0 = -log((x / (x + 1.0))) / n;
double tmp;
if (n <= -1.15e+121) {
tmp = t_0;
} else if (n <= -1.3e+88) {
tmp = (1.0 / x) / n;
} else if (n <= -15500000.0) {
tmp = ((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))));
} else if (n <= 2200000.0) {
tmp = exp((x / n)) - pow(x, (1.0 / n));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = -Math.log((x / (x + 1.0))) / n;
double tmp;
if (n <= -1.15e+121) {
tmp = t_0;
} else if (n <= -1.3e+88) {
tmp = (1.0 / x) / n;
} else if (n <= -15500000.0) {
tmp = ((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))));
} else if (n <= 2200000.0) {
tmp = Math.exp((x / n)) - Math.pow(x, (1.0 / n));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = -math.log((x / (x + 1.0))) / n tmp = 0 if n <= -1.15e+121: tmp = t_0 elif n <= -1.3e+88: tmp = (1.0 / x) / n elif n <= -15500000.0: tmp = ((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)))) elif n <= 2200000.0: tmp = math.exp((x / n)) - math.pow(x, (1.0 / n)) else: tmp = t_0 return tmp
function code(x, n) t_0 = Float64(Float64(-log(Float64(x / Float64(x + 1.0)))) / n) tmp = 0.0 if (n <= -1.15e+121) tmp = t_0; elseif (n <= -1.3e+88) tmp = Float64(Float64(1.0 / x) / n); elseif (n <= -15500000.0) tmp = 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))))); elseif (n <= 2200000.0) tmp = Float64(exp(Float64(x / n)) - (x ^ Float64(1.0 / n))); else tmp = t_0; end return tmp end
code[x_, n_] := Block[{t$95$0 = N[((-N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[n, -1.15e+121], t$95$0, If[LessEqual[n, -1.3e+88], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[n, -15500000.0], 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, 2200000.0], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-\log \left(\frac{x}{x + 1}\right)}{n}\\
\mathbf{if}\;n \leq -1.15 \cdot 10^{+121}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq -1.3 \cdot 10^{+88}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;n \leq -15500000:\\
\;\;\;\;\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{elif}\;n \leq 2200000:\\
\;\;\;\;e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -1.1499999999999999e121 or 2.2e6 < n Initial program 26.6%
Taylor expanded in n around inf 78.9%
+-rgt-identity78.9%
+-rgt-identity78.9%
log1p-def78.9%
Simplified78.9%
log1p-udef78.9%
diff-log79.4%
Applied egg-rr79.4%
clear-num79.4%
log-rec79.6%
Applied egg-rr79.6%
if -1.1499999999999999e121 < n < -1.3e88Initial program 5.0%
Taylor expanded in n around inf 18.7%
+-rgt-identity18.7%
+-rgt-identity18.7%
log1p-def18.7%
Simplified18.7%
Taylor expanded in x around inf 86.0%
if -1.3e88 < n < -1.55e7Initial program 7.2%
Taylor expanded in n around inf 75.8%
associate--l+75.0%
+-commutative75.0%
associate--r+75.8%
div-sub76.1%
remove-double-neg76.1%
mul-1-neg76.1%
distribute-lft-out--76.1%
distribute-neg-frac76.1%
mul-1-neg76.1%
Simplified76.1%
if -1.55e7 < n < 2.2e6Initial program 87.5%
Taylor expanded in n around 0 87.5%
log1p-def98.0%
Simplified98.0%
Taylor expanded in x around 0 98.0%
Final simplification87.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (- (log (/ x (+ x 1.0)))) n)))
(if (<= n -1.62e+115)
t_0
(if (<= n -1.3e+88)
(/ (/ 1.0 x) n)
(if (or (<= n -35000000000.0) (not (<= n 6.2e+24)))
t_0
(- (exp (/ (log1p x) n)) (pow x (/ 1.0 n))))))))
double code(double x, double n) {
double t_0 = -log((x / (x + 1.0))) / n;
double tmp;
if (n <= -1.62e+115) {
tmp = t_0;
} else if (n <= -1.3e+88) {
tmp = (1.0 / x) / n;
} else if ((n <= -35000000000.0) || !(n <= 6.2e+24)) {
tmp = t_0;
} else {
tmp = exp((log1p(x) / n)) - pow(x, (1.0 / n));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = -Math.log((x / (x + 1.0))) / n;
double tmp;
if (n <= -1.62e+115) {
tmp = t_0;
} else if (n <= -1.3e+88) {
tmp = (1.0 / x) / n;
} else if ((n <= -35000000000.0) || !(n <= 6.2e+24)) {
tmp = t_0;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n));
}
return tmp;
}
def code(x, n): t_0 = -math.log((x / (x + 1.0))) / n tmp = 0 if n <= -1.62e+115: tmp = t_0 elif n <= -1.3e+88: tmp = (1.0 / x) / n elif (n <= -35000000000.0) or not (n <= 6.2e+24): tmp = t_0 else: tmp = math.exp((math.log1p(x) / n)) - math.pow(x, (1.0 / n)) return tmp
function code(x, n) t_0 = Float64(Float64(-log(Float64(x / Float64(x + 1.0)))) / n) tmp = 0.0 if (n <= -1.62e+115) tmp = t_0; elseif (n <= -1.3e+88) tmp = Float64(Float64(1.0 / x) / n); elseif ((n <= -35000000000.0) || !(n <= 6.2e+24)) tmp = t_0; else tmp = Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[((-N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[n, -1.62e+115], t$95$0, If[LessEqual[n, -1.3e+88], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], If[Or[LessEqual[n, -35000000000.0], N[Not[LessEqual[n, 6.2e+24]], $MachinePrecision]], t$95$0, 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}
t_0 := \frac{-\log \left(\frac{x}{x + 1}\right)}{n}\\
\mathbf{if}\;n \leq -1.62 \cdot 10^{+115}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq -1.3 \cdot 10^{+88}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;n \leq -35000000000 \lor \neg \left(n \leq 6.2 \cdot 10^{+24}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
if n < -1.62e115 or -1.3e88 < n < -3.5e10 or 6.20000000000000022e24 < n Initial program 23.9%
Taylor expanded in n around inf 81.0%
+-rgt-identity81.0%
+-rgt-identity81.0%
log1p-def81.0%
Simplified81.0%
log1p-udef81.0%
diff-log81.5%
Applied egg-rr81.5%
clear-num81.5%
log-rec81.6%
Applied egg-rr81.6%
if -1.62e115 < n < -1.3e88Initial program 5.0%
Taylor expanded in n around inf 18.7%
+-rgt-identity18.7%
+-rgt-identity18.7%
log1p-def18.7%
Simplified18.7%
Taylor expanded in x around inf 86.0%
if -3.5e10 < n < 6.20000000000000022e24Initial program 83.7%
Taylor expanded in n around 0 83.7%
log1p-def93.7%
Simplified93.7%
Final simplification87.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (- (log (/ x (+ x 1.0)))) n)))
(if (<= n -3.1e+116)
t_0
(if (<= n -1.3e+88)
(/ (/ 1.0 x) n)
(if (or (<= n -2400000000.0) (not (<= n 2200000.0)))
t_0
(- (exp (/ x n)) (pow x (/ 1.0 n))))))))
double code(double x, double n) {
double t_0 = -log((x / (x + 1.0))) / n;
double tmp;
if (n <= -3.1e+116) {
tmp = t_0;
} else if (n <= -1.3e+88) {
tmp = (1.0 / x) / n;
} else if ((n <= -2400000000.0) || !(n <= 2200000.0)) {
tmp = t_0;
} else {
tmp = exp((x / n)) - pow(x, (1.0 / 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 = -log((x / (x + 1.0d0))) / n
if (n <= (-3.1d+116)) then
tmp = t_0
else if (n <= (-1.3d+88)) then
tmp = (1.0d0 / x) / n
else if ((n <= (-2400000000.0d0)) .or. (.not. (n <= 2200000.0d0))) then
tmp = t_0
else
tmp = exp((x / n)) - (x ** (1.0d0 / n))
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = -Math.log((x / (x + 1.0))) / n;
double tmp;
if (n <= -3.1e+116) {
tmp = t_0;
} else if (n <= -1.3e+88) {
tmp = (1.0 / x) / n;
} else if ((n <= -2400000000.0) || !(n <= 2200000.0)) {
tmp = t_0;
} else {
tmp = Math.exp((x / n)) - Math.pow(x, (1.0 / n));
}
return tmp;
}
def code(x, n): t_0 = -math.log((x / (x + 1.0))) / n tmp = 0 if n <= -3.1e+116: tmp = t_0 elif n <= -1.3e+88: tmp = (1.0 / x) / n elif (n <= -2400000000.0) or not (n <= 2200000.0): tmp = t_0 else: tmp = math.exp((x / n)) - math.pow(x, (1.0 / n)) return tmp
function code(x, n) t_0 = Float64(Float64(-log(Float64(x / Float64(x + 1.0)))) / n) tmp = 0.0 if (n <= -3.1e+116) tmp = t_0; elseif (n <= -1.3e+88) tmp = Float64(Float64(1.0 / x) / n); elseif ((n <= -2400000000.0) || !(n <= 2200000.0)) tmp = t_0; else tmp = Float64(exp(Float64(x / n)) - (x ^ Float64(1.0 / n))); end return tmp end
function tmp_2 = code(x, n) t_0 = -log((x / (x + 1.0))) / n; tmp = 0.0; if (n <= -3.1e+116) tmp = t_0; elseif (n <= -1.3e+88) tmp = (1.0 / x) / n; elseif ((n <= -2400000000.0) || ~((n <= 2200000.0))) tmp = t_0; else tmp = exp((x / n)) - (x ^ (1.0 / n)); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[((-N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[n, -3.1e+116], t$95$0, If[LessEqual[n, -1.3e+88], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], If[Or[LessEqual[n, -2400000000.0], N[Not[LessEqual[n, 2200000.0]], $MachinePrecision]], t$95$0, N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-\log \left(\frac{x}{x + 1}\right)}{n}\\
\mathbf{if}\;n \leq -3.1 \cdot 10^{+116}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq -1.3 \cdot 10^{+88}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;n \leq -2400000000 \lor \neg \left(n \leq 2200000\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
if n < -3.09999999999999996e116 or -1.3e88 < n < -2.4e9 or 2.2e6 < n Initial program 23.4%
Taylor expanded in n around inf 78.9%
+-rgt-identity78.9%
+-rgt-identity78.9%
log1p-def78.9%
Simplified78.9%
log1p-udef78.9%
diff-log79.3%
Applied egg-rr79.3%
clear-num79.3%
log-rec79.5%
Applied egg-rr79.5%
if -3.09999999999999996e116 < n < -1.3e88Initial program 5.0%
Taylor expanded in n around inf 18.7%
+-rgt-identity18.7%
+-rgt-identity18.7%
log1p-def18.7%
Simplified18.7%
Taylor expanded in x around inf 86.0%
if -2.4e9 < n < 2.2e6Initial program 86.6%
Taylor expanded in n around 0 86.6%
log1p-def96.9%
Simplified96.9%
Taylor expanded in x around 0 96.9%
Final simplification87.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (log (/ x (+ x 1.0))))
(t_1 (pow x (/ 1.0 n)))
(t_2 (- 1.0 t_1))
(t_3 (/ (- t_0) n))
(t_4 (/ 1.0 (* n x))))
(if (<= (/ 1.0 n) -1e+243)
(/ 0.0 n)
(if (<= (/ 1.0 n) -2e+164)
t_2
(if (<= (/ 1.0 n) -2e+25)
(/ 0.0 n)
(if (<= (/ 1.0 n) -1e-9)
t_2
(if (<= (/ 1.0 n) -1e-87)
t_3
(if (<= (/ 1.0 n) -5e-116)
(/ (/ 1.0 x) n)
(if (<= (/ 1.0 n) 2e-112)
t_3
(if (<= (/ 1.0 n) 5e-104)
t_4
(if (<= (/ 1.0 n) 5e-7)
(* t_0 (/ 1.0 (- n)))
(if (<= (/ 1.0 n) 1e+214)
(- (+ 1.0 (/ x n)) t_1)
t_4))))))))))))
double code(double x, double n) {
double t_0 = log((x / (x + 1.0)));
double t_1 = pow(x, (1.0 / n));
double t_2 = 1.0 - t_1;
double t_3 = -t_0 / n;
double t_4 = 1.0 / (n * x);
double tmp;
if ((1.0 / n) <= -1e+243) {
tmp = 0.0 / n;
} else if ((1.0 / n) <= -2e+164) {
tmp = t_2;
} else if ((1.0 / n) <= -2e+25) {
tmp = 0.0 / n;
} else if ((1.0 / n) <= -1e-9) {
tmp = t_2;
} else if ((1.0 / n) <= -1e-87) {
tmp = t_3;
} else if ((1.0 / n) <= -5e-116) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e-112) {
tmp = t_3;
} else if ((1.0 / n) <= 5e-104) {
tmp = t_4;
} else if ((1.0 / n) <= 5e-7) {
tmp = t_0 * (1.0 / -n);
} else if ((1.0 / n) <= 1e+214) {
tmp = (1.0 + (x / n)) - t_1;
} else {
tmp = t_4;
}
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) :: t_3
real(8) :: t_4
real(8) :: tmp
t_0 = log((x / (x + 1.0d0)))
t_1 = x ** (1.0d0 / n)
t_2 = 1.0d0 - t_1
t_3 = -t_0 / n
t_4 = 1.0d0 / (n * x)
if ((1.0d0 / n) <= (-1d+243)) then
tmp = 0.0d0 / n
else if ((1.0d0 / n) <= (-2d+164)) then
tmp = t_2
else if ((1.0d0 / n) <= (-2d+25)) then
tmp = 0.0d0 / n
else if ((1.0d0 / n) <= (-1d-9)) then
tmp = t_2
else if ((1.0d0 / n) <= (-1d-87)) then
tmp = t_3
else if ((1.0d0 / n) <= (-5d-116)) then
tmp = (1.0d0 / x) / n
else if ((1.0d0 / n) <= 2d-112) then
tmp = t_3
else if ((1.0d0 / n) <= 5d-104) then
tmp = t_4
else if ((1.0d0 / n) <= 5d-7) then
tmp = t_0 * (1.0d0 / -n)
else if ((1.0d0 / n) <= 1d+214) then
tmp = (1.0d0 + (x / n)) - t_1
else
tmp = t_4
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.log((x / (x + 1.0)));
double t_1 = Math.pow(x, (1.0 / n));
double t_2 = 1.0 - t_1;
double t_3 = -t_0 / n;
double t_4 = 1.0 / (n * x);
double tmp;
if ((1.0 / n) <= -1e+243) {
tmp = 0.0 / n;
} else if ((1.0 / n) <= -2e+164) {
tmp = t_2;
} else if ((1.0 / n) <= -2e+25) {
tmp = 0.0 / n;
} else if ((1.0 / n) <= -1e-9) {
tmp = t_2;
} else if ((1.0 / n) <= -1e-87) {
tmp = t_3;
} else if ((1.0 / n) <= -5e-116) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e-112) {
tmp = t_3;
} else if ((1.0 / n) <= 5e-104) {
tmp = t_4;
} else if ((1.0 / n) <= 5e-7) {
tmp = t_0 * (1.0 / -n);
} else if ((1.0 / n) <= 1e+214) {
tmp = (1.0 + (x / n)) - t_1;
} else {
tmp = t_4;
}
return tmp;
}
def code(x, n): t_0 = math.log((x / (x + 1.0))) t_1 = math.pow(x, (1.0 / n)) t_2 = 1.0 - t_1 t_3 = -t_0 / n t_4 = 1.0 / (n * x) tmp = 0 if (1.0 / n) <= -1e+243: tmp = 0.0 / n elif (1.0 / n) <= -2e+164: tmp = t_2 elif (1.0 / n) <= -2e+25: tmp = 0.0 / n elif (1.0 / n) <= -1e-9: tmp = t_2 elif (1.0 / n) <= -1e-87: tmp = t_3 elif (1.0 / n) <= -5e-116: tmp = (1.0 / x) / n elif (1.0 / n) <= 2e-112: tmp = t_3 elif (1.0 / n) <= 5e-104: tmp = t_4 elif (1.0 / n) <= 5e-7: tmp = t_0 * (1.0 / -n) elif (1.0 / n) <= 1e+214: tmp = (1.0 + (x / n)) - t_1 else: tmp = t_4 return tmp
function code(x, n) t_0 = log(Float64(x / Float64(x + 1.0))) t_1 = x ^ Float64(1.0 / n) t_2 = Float64(1.0 - t_1) t_3 = Float64(Float64(-t_0) / n) t_4 = Float64(1.0 / Float64(n * x)) tmp = 0.0 if (Float64(1.0 / n) <= -1e+243) tmp = Float64(0.0 / n); elseif (Float64(1.0 / n) <= -2e+164) tmp = t_2; elseif (Float64(1.0 / n) <= -2e+25) tmp = Float64(0.0 / n); elseif (Float64(1.0 / n) <= -1e-9) tmp = t_2; elseif (Float64(1.0 / n) <= -1e-87) tmp = t_3; elseif (Float64(1.0 / n) <= -5e-116) tmp = Float64(Float64(1.0 / x) / n); elseif (Float64(1.0 / n) <= 2e-112) tmp = t_3; elseif (Float64(1.0 / n) <= 5e-104) tmp = t_4; elseif (Float64(1.0 / n) <= 5e-7) tmp = Float64(t_0 * Float64(1.0 / Float64(-n))); elseif (Float64(1.0 / n) <= 1e+214) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_1); else tmp = t_4; end return tmp end
function tmp_2 = code(x, n) t_0 = log((x / (x + 1.0))); t_1 = x ^ (1.0 / n); t_2 = 1.0 - t_1; t_3 = -t_0 / n; t_4 = 1.0 / (n * x); tmp = 0.0; if ((1.0 / n) <= -1e+243) tmp = 0.0 / n; elseif ((1.0 / n) <= -2e+164) tmp = t_2; elseif ((1.0 / n) <= -2e+25) tmp = 0.0 / n; elseif ((1.0 / n) <= -1e-9) tmp = t_2; elseif ((1.0 / n) <= -1e-87) tmp = t_3; elseif ((1.0 / n) <= -5e-116) tmp = (1.0 / x) / n; elseif ((1.0 / n) <= 2e-112) tmp = t_3; elseif ((1.0 / n) <= 5e-104) tmp = t_4; elseif ((1.0 / n) <= 5e-7) tmp = t_0 * (1.0 / -n); elseif ((1.0 / n) <= 1e+214) tmp = (1.0 + (x / n)) - t_1; else tmp = t_4; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[((-t$95$0) / n), $MachinePrecision]}, Block[{t$95$4 = N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e+243], N[(0.0 / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e+164], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e+25], N[(0.0 / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-9], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-87], t$95$3, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-116], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-112], t$95$3, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-104], t$95$4, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-7], N[(t$95$0 * N[(1.0 / (-n)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+214], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], t$95$4]]]]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\frac{x}{x + 1}\right)\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
t_2 := 1 - t_1\\
t_3 := \frac{-t_0}{n}\\
t_4 := \frac{1}{n \cdot x}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+243}:\\
\;\;\;\;\frac{0}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{+164}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{+25}:\\
\;\;\;\;\frac{0}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{-9}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{-87}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-116}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-112}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-104}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-7}:\\
\;\;\;\;t_0 \cdot \frac{1}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+214}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_1\\
\mathbf{else}:\\
\;\;\;\;t_4\\
\end{array}
\end{array}
if (/.f64 1 n) < -1.0000000000000001e243 or -2e164 < (/.f64 1 n) < -2.00000000000000018e25Initial program 100.0%
Taylor expanded in n around inf 62.1%
+-rgt-identity62.1%
+-rgt-identity62.1%
log1p-def62.1%
Simplified62.1%
log1p-udef62.1%
diff-log62.1%
Applied egg-rr62.1%
Taylor expanded in x around inf 71.5%
if -1.0000000000000001e243 < (/.f64 1 n) < -2e164 or -2.00000000000000018e25 < (/.f64 1 n) < -1.00000000000000006e-9Initial program 93.8%
Taylor expanded in x around 0 67.4%
if -1.00000000000000006e-9 < (/.f64 1 n) < -1.00000000000000002e-87 or -5.0000000000000003e-116 < (/.f64 1 n) < 1.9999999999999999e-112Initial program 28.1%
Taylor expanded in n around inf 87.0%
+-rgt-identity87.0%
+-rgt-identity87.0%
log1p-def87.0%
Simplified87.0%
log1p-udef87.0%
diff-log87.2%
Applied egg-rr87.2%
clear-num87.2%
log-rec87.3%
Applied egg-rr87.3%
if -1.00000000000000002e-87 < (/.f64 1 n) < -5.0000000000000003e-116Initial program 5.0%
Taylor expanded in n around inf 18.7%
+-rgt-identity18.7%
+-rgt-identity18.7%
log1p-def18.7%
Simplified18.7%
Taylor expanded in x around inf 86.0%
if 1.9999999999999999e-112 < (/.f64 1 n) < 4.99999999999999979e-104 or 9.9999999999999995e213 < (/.f64 1 n) Initial program 7.9%
Taylor expanded in n around inf 9.9%
+-rgt-identity9.9%
+-rgt-identity9.9%
log1p-def9.9%
Simplified9.9%
Taylor expanded in x around inf 90.4%
*-commutative90.4%
Simplified90.4%
if 4.99999999999999979e-104 < (/.f64 1 n) < 4.99999999999999977e-7Initial program 8.0%
Taylor expanded in n around inf 60.5%
+-rgt-identity60.5%
+-rgt-identity60.5%
log1p-def60.5%
Simplified60.5%
log1p-udef60.5%
diff-log60.8%
Applied egg-rr60.8%
log-div60.5%
log1p-udef60.5%
frac-2neg60.5%
div-inv60.6%
log1p-udef60.6%
log-div60.8%
neg-log60.8%
clear-num60.9%
Applied egg-rr60.9%
if 4.99999999999999977e-7 < (/.f64 1 n) < 9.9999999999999995e213Initial program 77.4%
Taylor expanded in x around 0 77.4%
Final simplification78.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ 1.0 (* n x)))
(t_1 (/ (log (+ 1.0 (/ 1.0 x))) n))
(t_2 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= (/ 1.0 n) -1e+243)
(/ 0.0 n)
(if (<= (/ 1.0 n) -2e+164)
t_2
(if (<= (/ 1.0 n) -2e+25)
(/ 0.0 n)
(if (<= (/ 1.0 n) -1e-9)
t_2
(if (<= (/ 1.0 n) -1e-87)
t_1
(if (<= (/ 1.0 n) -5e-116)
(/ (/ 1.0 x) n)
(if (<= (/ 1.0 n) 2e-112)
t_1
(if (<= (/ 1.0 n) 5e-104)
t_0
(if (<= (/ 1.0 n) 5e-7)
t_1
(if (<= (/ 1.0 n) 1e+214) t_2 t_0))))))))))))
double code(double x, double n) {
double t_0 = 1.0 / (n * x);
double t_1 = log((1.0 + (1.0 / x))) / n;
double t_2 = 1.0 - pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e+243) {
tmp = 0.0 / n;
} else if ((1.0 / n) <= -2e+164) {
tmp = t_2;
} else if ((1.0 / n) <= -2e+25) {
tmp = 0.0 / n;
} else if ((1.0 / n) <= -1e-9) {
tmp = t_2;
} else if ((1.0 / n) <= -1e-87) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-116) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e-112) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-104) {
tmp = t_0;
} else if ((1.0 / n) <= 5e-7) {
tmp = t_1;
} else if ((1.0 / n) <= 1e+214) {
tmp = t_2;
} else {
tmp = 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 = log((1.0d0 + (1.0d0 / x))) / n
t_2 = 1.0d0 - (x ** (1.0d0 / n))
if ((1.0d0 / n) <= (-1d+243)) then
tmp = 0.0d0 / n
else if ((1.0d0 / n) <= (-2d+164)) then
tmp = t_2
else if ((1.0d0 / n) <= (-2d+25)) then
tmp = 0.0d0 / n
else if ((1.0d0 / n) <= (-1d-9)) then
tmp = t_2
else if ((1.0d0 / n) <= (-1d-87)) then
tmp = t_1
else if ((1.0d0 / n) <= (-5d-116)) then
tmp = (1.0d0 / x) / n
else if ((1.0d0 / n) <= 2d-112) then
tmp = t_1
else if ((1.0d0 / n) <= 5d-104) then
tmp = t_0
else if ((1.0d0 / n) <= 5d-7) then
tmp = t_1
else if ((1.0d0 / n) <= 1d+214) then
tmp = t_2
else
tmp = 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.log((1.0 + (1.0 / x))) / n;
double t_2 = 1.0 - Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e+243) {
tmp = 0.0 / n;
} else if ((1.0 / n) <= -2e+164) {
tmp = t_2;
} else if ((1.0 / n) <= -2e+25) {
tmp = 0.0 / n;
} else if ((1.0 / n) <= -1e-9) {
tmp = t_2;
} else if ((1.0 / n) <= -1e-87) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-116) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e-112) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-104) {
tmp = t_0;
} else if ((1.0 / n) <= 5e-7) {
tmp = t_1;
} else if ((1.0 / n) <= 1e+214) {
tmp = t_2;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = 1.0 / (n * x) t_1 = math.log((1.0 + (1.0 / x))) / n t_2 = 1.0 - math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e+243: tmp = 0.0 / n elif (1.0 / n) <= -2e+164: tmp = t_2 elif (1.0 / n) <= -2e+25: tmp = 0.0 / n elif (1.0 / n) <= -1e-9: tmp = t_2 elif (1.0 / n) <= -1e-87: tmp = t_1 elif (1.0 / n) <= -5e-116: tmp = (1.0 / x) / n elif (1.0 / n) <= 2e-112: tmp = t_1 elif (1.0 / n) <= 5e-104: tmp = t_0 elif (1.0 / n) <= 5e-7: tmp = t_1 elif (1.0 / n) <= 1e+214: tmp = t_2 else: tmp = t_0 return tmp
function code(x, n) t_0 = Float64(1.0 / Float64(n * x)) t_1 = Float64(log(Float64(1.0 + Float64(1.0 / x))) / n) t_2 = Float64(1.0 - (x ^ Float64(1.0 / n))) tmp = 0.0 if (Float64(1.0 / n) <= -1e+243) tmp = Float64(0.0 / n); elseif (Float64(1.0 / n) <= -2e+164) tmp = t_2; elseif (Float64(1.0 / n) <= -2e+25) tmp = Float64(0.0 / n); elseif (Float64(1.0 / n) <= -1e-9) tmp = t_2; elseif (Float64(1.0 / n) <= -1e-87) tmp = t_1; elseif (Float64(1.0 / n) <= -5e-116) tmp = Float64(Float64(1.0 / x) / n); elseif (Float64(1.0 / n) <= 2e-112) tmp = t_1; elseif (Float64(1.0 / n) <= 5e-104) tmp = t_0; elseif (Float64(1.0 / n) <= 5e-7) tmp = t_1; elseif (Float64(1.0 / n) <= 1e+214) tmp = t_2; else tmp = t_0; end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 / (n * x); t_1 = log((1.0 + (1.0 / x))) / n; t_2 = 1.0 - (x ^ (1.0 / n)); tmp = 0.0; if ((1.0 / n) <= -1e+243) tmp = 0.0 / n; elseif ((1.0 / n) <= -2e+164) tmp = t_2; elseif ((1.0 / n) <= -2e+25) tmp = 0.0 / n; elseif ((1.0 / n) <= -1e-9) tmp = t_2; elseif ((1.0 / n) <= -1e-87) tmp = t_1; elseif ((1.0 / n) <= -5e-116) tmp = (1.0 / x) / n; elseif ((1.0 / n) <= 2e-112) tmp = t_1; elseif ((1.0 / n) <= 5e-104) tmp = t_0; elseif ((1.0 / n) <= 5e-7) tmp = t_1; elseif ((1.0 / n) <= 1e+214) tmp = t_2; else tmp = 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[(N[Log[N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e+243], N[(0.0 / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e+164], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e+25], N[(0.0 / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-9], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-87], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-116], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-112], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-104], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-7], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+214], t$95$2, t$95$0]]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{n \cdot x}\\
t_1 := \frac{\log \left(1 + \frac{1}{x}\right)}{n}\\
t_2 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+243}:\\
\;\;\;\;\frac{0}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{+164}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{+25}:\\
\;\;\;\;\frac{0}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{-9}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{-87}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-116}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-112}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-104}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-7}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+214}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -1.0000000000000001e243 or -2e164 < (/.f64 1 n) < -2.00000000000000018e25Initial program 100.0%
Taylor expanded in n around inf 62.1%
+-rgt-identity62.1%
+-rgt-identity62.1%
log1p-def62.1%
Simplified62.1%
log1p-udef62.1%
diff-log62.1%
Applied egg-rr62.1%
Taylor expanded in x around inf 71.5%
if -1.0000000000000001e243 < (/.f64 1 n) < -2e164 or -2.00000000000000018e25 < (/.f64 1 n) < -1.00000000000000006e-9 or 4.99999999999999977e-7 < (/.f64 1 n) < 9.9999999999999995e213Initial program 87.0%
Taylor expanded in x around 0 71.5%
if -1.00000000000000006e-9 < (/.f64 1 n) < -1.00000000000000002e-87 or -5.0000000000000003e-116 < (/.f64 1 n) < 1.9999999999999999e-112 or 4.99999999999999979e-104 < (/.f64 1 n) < 4.99999999999999977e-7Initial program 24.2%
Taylor expanded in n around inf 81.9%
+-rgt-identity81.9%
+-rgt-identity81.9%
log1p-def81.9%
Simplified81.9%
log1p-udef81.9%
diff-log82.1%
Applied egg-rr82.1%
Taylor expanded in x around 0 82.2%
if -1.00000000000000002e-87 < (/.f64 1 n) < -5.0000000000000003e-116Initial program 5.0%
Taylor expanded in n around inf 18.7%
+-rgt-identity18.7%
+-rgt-identity18.7%
log1p-def18.7%
Simplified18.7%
Taylor expanded in x around inf 86.0%
if 1.9999999999999999e-112 < (/.f64 1 n) < 4.99999999999999979e-104 or 9.9999999999999995e213 < (/.f64 1 n) Initial program 7.9%
Taylor expanded in n around inf 9.9%
+-rgt-identity9.9%
+-rgt-identity9.9%
log1p-def9.9%
Simplified9.9%
Taylor expanded in x around inf 90.4%
*-commutative90.4%
Simplified90.4%
Final simplification78.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n))))
(t_1 (/ (- (log (/ x (+ x 1.0)))) n))
(t_2 (/ 1.0 (* n x))))
(if (<= (/ 1.0 n) -1e+243)
(/ 0.0 n)
(if (<= (/ 1.0 n) -2e+164)
t_0
(if (<= (/ 1.0 n) -2e+25)
(/ 0.0 n)
(if (<= (/ 1.0 n) -1e-9)
t_0
(if (<= (/ 1.0 n) -1e-87)
t_1
(if (<= (/ 1.0 n) -5e-116)
(/ (/ 1.0 x) n)
(if (<= (/ 1.0 n) 2e-112)
t_1
(if (<= (/ 1.0 n) 5e-104)
t_2
(if (<= (/ 1.0 n) 5e-7)
t_1
(if (<= (/ 1.0 n) 1e+214) t_0 t_2))))))))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double t_1 = -log((x / (x + 1.0))) / n;
double t_2 = 1.0 / (n * x);
double tmp;
if ((1.0 / n) <= -1e+243) {
tmp = 0.0 / n;
} else if ((1.0 / n) <= -2e+164) {
tmp = t_0;
} else if ((1.0 / n) <= -2e+25) {
tmp = 0.0 / n;
} else if ((1.0 / n) <= -1e-9) {
tmp = t_0;
} else if ((1.0 / n) <= -1e-87) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-116) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e-112) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-104) {
tmp = t_2;
} else if ((1.0 / n) <= 5e-7) {
tmp = t_1;
} else if ((1.0 / n) <= 1e+214) {
tmp = t_0;
} else {
tmp = t_2;
}
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 - (x ** (1.0d0 / n))
t_1 = -log((x / (x + 1.0d0))) / n
t_2 = 1.0d0 / (n * x)
if ((1.0d0 / n) <= (-1d+243)) then
tmp = 0.0d0 / n
else if ((1.0d0 / n) <= (-2d+164)) then
tmp = t_0
else if ((1.0d0 / n) <= (-2d+25)) then
tmp = 0.0d0 / n
else if ((1.0d0 / n) <= (-1d-9)) then
tmp = t_0
else if ((1.0d0 / n) <= (-1d-87)) then
tmp = t_1
else if ((1.0d0 / n) <= (-5d-116)) then
tmp = (1.0d0 / x) / n
else if ((1.0d0 / n) <= 2d-112) then
tmp = t_1
else if ((1.0d0 / n) <= 5d-104) then
tmp = t_2
else if ((1.0d0 / n) <= 5d-7) then
tmp = t_1
else if ((1.0d0 / n) <= 1d+214) then
tmp = t_0
else
tmp = t_2
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((x / (x + 1.0))) / n;
double t_2 = 1.0 / (n * x);
double tmp;
if ((1.0 / n) <= -1e+243) {
tmp = 0.0 / n;
} else if ((1.0 / n) <= -2e+164) {
tmp = t_0;
} else if ((1.0 / n) <= -2e+25) {
tmp = 0.0 / n;
} else if ((1.0 / n) <= -1e-9) {
tmp = t_0;
} else if ((1.0 / n) <= -1e-87) {
tmp = t_1;
} else if ((1.0 / n) <= -5e-116) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e-112) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-104) {
tmp = t_2;
} else if ((1.0 / n) <= 5e-7) {
tmp = t_1;
} else if ((1.0 / n) <= 1e+214) {
tmp = t_0;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) t_1 = -math.log((x / (x + 1.0))) / n t_2 = 1.0 / (n * x) tmp = 0 if (1.0 / n) <= -1e+243: tmp = 0.0 / n elif (1.0 / n) <= -2e+164: tmp = t_0 elif (1.0 / n) <= -2e+25: tmp = 0.0 / n elif (1.0 / n) <= -1e-9: tmp = t_0 elif (1.0 / n) <= -1e-87: tmp = t_1 elif (1.0 / n) <= -5e-116: tmp = (1.0 / x) / n elif (1.0 / n) <= 2e-112: tmp = t_1 elif (1.0 / n) <= 5e-104: tmp = t_2 elif (1.0 / n) <= 5e-7: tmp = t_1 elif (1.0 / n) <= 1e+214: tmp = t_0 else: tmp = t_2 return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) t_1 = Float64(Float64(-log(Float64(x / Float64(x + 1.0)))) / n) t_2 = Float64(1.0 / Float64(n * x)) tmp = 0.0 if (Float64(1.0 / n) <= -1e+243) tmp = Float64(0.0 / n); elseif (Float64(1.0 / n) <= -2e+164) tmp = t_0; elseif (Float64(1.0 / n) <= -2e+25) tmp = Float64(0.0 / n); elseif (Float64(1.0 / n) <= -1e-9) tmp = t_0; elseif (Float64(1.0 / n) <= -1e-87) tmp = t_1; elseif (Float64(1.0 / n) <= -5e-116) tmp = Float64(Float64(1.0 / x) / n); elseif (Float64(1.0 / n) <= 2e-112) tmp = t_1; elseif (Float64(1.0 / n) <= 5e-104) tmp = t_2; elseif (Float64(1.0 / n) <= 5e-7) tmp = t_1; elseif (Float64(1.0 / n) <= 1e+214) tmp = t_0; else tmp = t_2; end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); t_1 = -log((x / (x + 1.0))) / n; t_2 = 1.0 / (n * x); tmp = 0.0; if ((1.0 / n) <= -1e+243) tmp = 0.0 / n; elseif ((1.0 / n) <= -2e+164) tmp = t_0; elseif ((1.0 / n) <= -2e+25) tmp = 0.0 / n; elseif ((1.0 / n) <= -1e-9) tmp = t_0; elseif ((1.0 / n) <= -1e-87) tmp = t_1; elseif ((1.0 / n) <= -5e-116) tmp = (1.0 / x) / n; elseif ((1.0 / n) <= 2e-112) tmp = t_1; elseif ((1.0 / n) <= 5e-104) tmp = t_2; elseif ((1.0 / n) <= 5e-7) tmp = t_1; elseif ((1.0 / n) <= 1e+214) tmp = t_0; else tmp = t_2; 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[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / n), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e+243], N[(0.0 / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e+164], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e+25], N[(0.0 / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-9], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-87], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-116], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-112], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-104], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-7], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+214], t$95$0, t$95$2]]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{-\log \left(\frac{x}{x + 1}\right)}{n}\\
t_2 := \frac{1}{n \cdot x}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+243}:\\
\;\;\;\;\frac{0}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{+164}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{+25}:\\
\;\;\;\;\frac{0}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{-9}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{-87}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-116}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-112}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-104}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-7}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+214}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if (/.f64 1 n) < -1.0000000000000001e243 or -2e164 < (/.f64 1 n) < -2.00000000000000018e25Initial program 100.0%
Taylor expanded in n around inf 62.1%
+-rgt-identity62.1%
+-rgt-identity62.1%
log1p-def62.1%
Simplified62.1%
log1p-udef62.1%
diff-log62.1%
Applied egg-rr62.1%
Taylor expanded in x around inf 71.5%
if -1.0000000000000001e243 < (/.f64 1 n) < -2e164 or -2.00000000000000018e25 < (/.f64 1 n) < -1.00000000000000006e-9 or 4.99999999999999977e-7 < (/.f64 1 n) < 9.9999999999999995e213Initial program 87.0%
Taylor expanded in x around 0 71.5%
if -1.00000000000000006e-9 < (/.f64 1 n) < -1.00000000000000002e-87 or -5.0000000000000003e-116 < (/.f64 1 n) < 1.9999999999999999e-112 or 4.99999999999999979e-104 < (/.f64 1 n) < 4.99999999999999977e-7Initial program 24.2%
Taylor expanded in n around inf 81.9%
+-rgt-identity81.9%
+-rgt-identity81.9%
log1p-def81.9%
Simplified81.9%
log1p-udef81.9%
diff-log82.1%
Applied egg-rr82.1%
clear-num82.1%
log-rec82.2%
Applied egg-rr82.2%
if -1.00000000000000002e-87 < (/.f64 1 n) < -5.0000000000000003e-116Initial program 5.0%
Taylor expanded in n around inf 18.7%
+-rgt-identity18.7%
+-rgt-identity18.7%
log1p-def18.7%
Simplified18.7%
Taylor expanded in x around inf 86.0%
if 1.9999999999999999e-112 < (/.f64 1 n) < 4.99999999999999979e-104 or 9.9999999999999995e213 < (/.f64 1 n) Initial program 7.9%
Taylor expanded in n around inf 9.9%
+-rgt-identity9.9%
+-rgt-identity9.9%
log1p-def9.9%
Simplified9.9%
Taylor expanded in x around inf 90.4%
*-commutative90.4%
Simplified90.4%
Final simplification78.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (log (/ x (+ x 1.0))))
(t_1 (- 1.0 (pow x (/ 1.0 n))))
(t_2 (/ (- t_0) n))
(t_3 (/ 1.0 (* n x))))
(if (<= (/ 1.0 n) -1e+243)
(/ 0.0 n)
(if (<= (/ 1.0 n) -2e+164)
t_1
(if (<= (/ 1.0 n) -2e+25)
(/ 0.0 n)
(if (<= (/ 1.0 n) -1e-9)
t_1
(if (<= (/ 1.0 n) -1e-87)
t_2
(if (<= (/ 1.0 n) -5e-116)
(/ (/ 1.0 x) n)
(if (<= (/ 1.0 n) 2e-112)
t_2
(if (<= (/ 1.0 n) 5e-104)
t_3
(if (<= (/ 1.0 n) 5e-7)
(* t_0 (/ 1.0 (- n)))
(if (<= (/ 1.0 n) 1e+214) t_1 t_3))))))))))))
double code(double x, double n) {
double t_0 = log((x / (x + 1.0)));
double t_1 = 1.0 - pow(x, (1.0 / n));
double t_2 = -t_0 / n;
double t_3 = 1.0 / (n * x);
double tmp;
if ((1.0 / n) <= -1e+243) {
tmp = 0.0 / n;
} else if ((1.0 / n) <= -2e+164) {
tmp = t_1;
} else if ((1.0 / n) <= -2e+25) {
tmp = 0.0 / n;
} else if ((1.0 / n) <= -1e-9) {
tmp = t_1;
} else if ((1.0 / n) <= -1e-87) {
tmp = t_2;
} else if ((1.0 / n) <= -5e-116) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e-112) {
tmp = t_2;
} else if ((1.0 / n) <= 5e-104) {
tmp = t_3;
} else if ((1.0 / n) <= 5e-7) {
tmp = t_0 * (1.0 / -n);
} else if ((1.0 / n) <= 1e+214) {
tmp = t_1;
} else {
tmp = t_3;
}
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) :: t_3
real(8) :: tmp
t_0 = log((x / (x + 1.0d0)))
t_1 = 1.0d0 - (x ** (1.0d0 / n))
t_2 = -t_0 / n
t_3 = 1.0d0 / (n * x)
if ((1.0d0 / n) <= (-1d+243)) then
tmp = 0.0d0 / n
else if ((1.0d0 / n) <= (-2d+164)) then
tmp = t_1
else if ((1.0d0 / n) <= (-2d+25)) then
tmp = 0.0d0 / n
else if ((1.0d0 / n) <= (-1d-9)) then
tmp = t_1
else if ((1.0d0 / n) <= (-1d-87)) then
tmp = t_2
else if ((1.0d0 / n) <= (-5d-116)) then
tmp = (1.0d0 / x) / n
else if ((1.0d0 / n) <= 2d-112) then
tmp = t_2
else if ((1.0d0 / n) <= 5d-104) then
tmp = t_3
else if ((1.0d0 / n) <= 5d-7) then
tmp = t_0 * (1.0d0 / -n)
else if ((1.0d0 / n) <= 1d+214) then
tmp = t_1
else
tmp = t_3
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.log((x / (x + 1.0)));
double t_1 = 1.0 - Math.pow(x, (1.0 / n));
double t_2 = -t_0 / n;
double t_3 = 1.0 / (n * x);
double tmp;
if ((1.0 / n) <= -1e+243) {
tmp = 0.0 / n;
} else if ((1.0 / n) <= -2e+164) {
tmp = t_1;
} else if ((1.0 / n) <= -2e+25) {
tmp = 0.0 / n;
} else if ((1.0 / n) <= -1e-9) {
tmp = t_1;
} else if ((1.0 / n) <= -1e-87) {
tmp = t_2;
} else if ((1.0 / n) <= -5e-116) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e-112) {
tmp = t_2;
} else if ((1.0 / n) <= 5e-104) {
tmp = t_3;
} else if ((1.0 / n) <= 5e-7) {
tmp = t_0 * (1.0 / -n);
} else if ((1.0 / n) <= 1e+214) {
tmp = t_1;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, n): t_0 = math.log((x / (x + 1.0))) t_1 = 1.0 - math.pow(x, (1.0 / n)) t_2 = -t_0 / n t_3 = 1.0 / (n * x) tmp = 0 if (1.0 / n) <= -1e+243: tmp = 0.0 / n elif (1.0 / n) <= -2e+164: tmp = t_1 elif (1.0 / n) <= -2e+25: tmp = 0.0 / n elif (1.0 / n) <= -1e-9: tmp = t_1 elif (1.0 / n) <= -1e-87: tmp = t_2 elif (1.0 / n) <= -5e-116: tmp = (1.0 / x) / n elif (1.0 / n) <= 2e-112: tmp = t_2 elif (1.0 / n) <= 5e-104: tmp = t_3 elif (1.0 / n) <= 5e-7: tmp = t_0 * (1.0 / -n) elif (1.0 / n) <= 1e+214: tmp = t_1 else: tmp = t_3 return tmp
function code(x, n) t_0 = log(Float64(x / Float64(x + 1.0))) t_1 = Float64(1.0 - (x ^ Float64(1.0 / n))) t_2 = Float64(Float64(-t_0) / n) t_3 = Float64(1.0 / Float64(n * x)) tmp = 0.0 if (Float64(1.0 / n) <= -1e+243) tmp = Float64(0.0 / n); elseif (Float64(1.0 / n) <= -2e+164) tmp = t_1; elseif (Float64(1.0 / n) <= -2e+25) tmp = Float64(0.0 / n); elseif (Float64(1.0 / n) <= -1e-9) tmp = t_1; elseif (Float64(1.0 / n) <= -1e-87) tmp = t_2; elseif (Float64(1.0 / n) <= -5e-116) tmp = Float64(Float64(1.0 / x) / n); elseif (Float64(1.0 / n) <= 2e-112) tmp = t_2; elseif (Float64(1.0 / n) <= 5e-104) tmp = t_3; elseif (Float64(1.0 / n) <= 5e-7) tmp = Float64(t_0 * Float64(1.0 / Float64(-n))); elseif (Float64(1.0 / n) <= 1e+214) tmp = t_1; else tmp = t_3; end return tmp end
function tmp_2 = code(x, n) t_0 = log((x / (x + 1.0))); t_1 = 1.0 - (x ^ (1.0 / n)); t_2 = -t_0 / n; t_3 = 1.0 / (n * x); tmp = 0.0; if ((1.0 / n) <= -1e+243) tmp = 0.0 / n; elseif ((1.0 / n) <= -2e+164) tmp = t_1; elseif ((1.0 / n) <= -2e+25) tmp = 0.0 / n; elseif ((1.0 / n) <= -1e-9) tmp = t_1; elseif ((1.0 / n) <= -1e-87) tmp = t_2; elseif ((1.0 / n) <= -5e-116) tmp = (1.0 / x) / n; elseif ((1.0 / n) <= 2e-112) tmp = t_2; elseif ((1.0 / n) <= 5e-104) tmp = t_3; elseif ((1.0 / n) <= 5e-7) tmp = t_0 * (1.0 / -n); elseif ((1.0 / n) <= 1e+214) tmp = t_1; else tmp = t_3; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Log[N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-t$95$0) / n), $MachinePrecision]}, Block[{t$95$3 = N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e+243], N[(0.0 / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e+164], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e+25], N[(0.0 / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-9], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-87], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-116], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-112], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-104], t$95$3, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-7], N[(t$95$0 * N[(1.0 / (-n)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+214], t$95$1, t$95$3]]]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\frac{x}{x + 1}\right)\\
t_1 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
t_2 := \frac{-t_0}{n}\\
t_3 := \frac{1}{n \cdot x}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+243}:\\
\;\;\;\;\frac{0}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{+164}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{+25}:\\
\;\;\;\;\frac{0}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{-9}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{-87}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-116}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-112}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-104}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-7}:\\
\;\;\;\;t_0 \cdot \frac{1}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+214}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\end{array}
if (/.f64 1 n) < -1.0000000000000001e243 or -2e164 < (/.f64 1 n) < -2.00000000000000018e25Initial program 100.0%
Taylor expanded in n around inf 62.1%
+-rgt-identity62.1%
+-rgt-identity62.1%
log1p-def62.1%
Simplified62.1%
log1p-udef62.1%
diff-log62.1%
Applied egg-rr62.1%
Taylor expanded in x around inf 71.5%
if -1.0000000000000001e243 < (/.f64 1 n) < -2e164 or -2.00000000000000018e25 < (/.f64 1 n) < -1.00000000000000006e-9 or 4.99999999999999977e-7 < (/.f64 1 n) < 9.9999999999999995e213Initial program 87.0%
Taylor expanded in x around 0 71.5%
if -1.00000000000000006e-9 < (/.f64 1 n) < -1.00000000000000002e-87 or -5.0000000000000003e-116 < (/.f64 1 n) < 1.9999999999999999e-112Initial program 28.1%
Taylor expanded in n around inf 87.0%
+-rgt-identity87.0%
+-rgt-identity87.0%
log1p-def87.0%
Simplified87.0%
log1p-udef87.0%
diff-log87.2%
Applied egg-rr87.2%
clear-num87.2%
log-rec87.3%
Applied egg-rr87.3%
if -1.00000000000000002e-87 < (/.f64 1 n) < -5.0000000000000003e-116Initial program 5.0%
Taylor expanded in n around inf 18.7%
+-rgt-identity18.7%
+-rgt-identity18.7%
log1p-def18.7%
Simplified18.7%
Taylor expanded in x around inf 86.0%
if 1.9999999999999999e-112 < (/.f64 1 n) < 4.99999999999999979e-104 or 9.9999999999999995e213 < (/.f64 1 n) Initial program 7.9%
Taylor expanded in n around inf 9.9%
+-rgt-identity9.9%
+-rgt-identity9.9%
log1p-def9.9%
Simplified9.9%
Taylor expanded in x around inf 90.4%
*-commutative90.4%
Simplified90.4%
if 4.99999999999999979e-104 < (/.f64 1 n) < 4.99999999999999977e-7Initial program 8.0%
Taylor expanded in n around inf 60.5%
+-rgt-identity60.5%
+-rgt-identity60.5%
log1p-def60.5%
Simplified60.5%
log1p-udef60.5%
diff-log60.8%
Applied egg-rr60.8%
log-div60.5%
log1p-udef60.5%
frac-2neg60.5%
div-inv60.6%
log1p-udef60.6%
log-div60.8%
neg-log60.8%
clear-num60.9%
Applied egg-rr60.9%
Final simplification78.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ 1.0 (* n x)))
(t_1 (/ x (+ x 1.0)))
(t_2 (log t_1))
(t_3 (/ (- t_2) n)))
(if (<= (/ 1.0 n) -500.0)
(/ (- (log1p (+ -1.0 t_1))) n)
(if (<= (/ 1.0 n) -1e-87)
t_3
(if (<= (/ 1.0 n) -5e-116)
(/ (/ 1.0 x) n)
(if (<= (/ 1.0 n) 2e-112)
t_3
(if (<= (/ 1.0 n) 5e-104)
t_0
(if (<= (/ 1.0 n) 5e-7)
(* t_2 (/ 1.0 (- n)))
(if (<= (/ 1.0 n) 1e+214)
(- (+ 1.0 (/ x n)) (pow x (/ 1.0 n)))
t_0)))))))))
double code(double x, double n) {
double t_0 = 1.0 / (n * x);
double t_1 = x / (x + 1.0);
double t_2 = log(t_1);
double t_3 = -t_2 / n;
double tmp;
if ((1.0 / n) <= -500.0) {
tmp = -log1p((-1.0 + t_1)) / n;
} else if ((1.0 / n) <= -1e-87) {
tmp = t_3;
} else if ((1.0 / n) <= -5e-116) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e-112) {
tmp = t_3;
} else if ((1.0 / n) <= 5e-104) {
tmp = t_0;
} else if ((1.0 / n) <= 5e-7) {
tmp = t_2 * (1.0 / -n);
} else if ((1.0 / n) <= 1e+214) {
tmp = (1.0 + (x / n)) - pow(x, (1.0 / n));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = 1.0 / (n * x);
double t_1 = x / (x + 1.0);
double t_2 = Math.log(t_1);
double t_3 = -t_2 / n;
double tmp;
if ((1.0 / n) <= -500.0) {
tmp = -Math.log1p((-1.0 + t_1)) / n;
} else if ((1.0 / n) <= -1e-87) {
tmp = t_3;
} else if ((1.0 / n) <= -5e-116) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e-112) {
tmp = t_3;
} else if ((1.0 / n) <= 5e-104) {
tmp = t_0;
} else if ((1.0 / n) <= 5e-7) {
tmp = t_2 * (1.0 / -n);
} else if ((1.0 / n) <= 1e+214) {
tmp = (1.0 + (x / n)) - Math.pow(x, (1.0 / n));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = 1.0 / (n * x) t_1 = x / (x + 1.0) t_2 = math.log(t_1) t_3 = -t_2 / n tmp = 0 if (1.0 / n) <= -500.0: tmp = -math.log1p((-1.0 + t_1)) / n elif (1.0 / n) <= -1e-87: tmp = t_3 elif (1.0 / n) <= -5e-116: tmp = (1.0 / x) / n elif (1.0 / n) <= 2e-112: tmp = t_3 elif (1.0 / n) <= 5e-104: tmp = t_0 elif (1.0 / n) <= 5e-7: tmp = t_2 * (1.0 / -n) elif (1.0 / n) <= 1e+214: tmp = (1.0 + (x / n)) - math.pow(x, (1.0 / n)) else: tmp = t_0 return tmp
function code(x, n) t_0 = Float64(1.0 / Float64(n * x)) t_1 = Float64(x / Float64(x + 1.0)) t_2 = log(t_1) t_3 = Float64(Float64(-t_2) / n) tmp = 0.0 if (Float64(1.0 / n) <= -500.0) tmp = Float64(Float64(-log1p(Float64(-1.0 + t_1))) / n); elseif (Float64(1.0 / n) <= -1e-87) tmp = t_3; elseif (Float64(1.0 / n) <= -5e-116) tmp = Float64(Float64(1.0 / x) / n); elseif (Float64(1.0 / n) <= 2e-112) tmp = t_3; elseif (Float64(1.0 / n) <= 5e-104) tmp = t_0; elseif (Float64(1.0 / n) <= 5e-7) tmp = Float64(t_2 * Float64(1.0 / Float64(-n))); elseif (Float64(1.0 / n) <= 1e+214) tmp = Float64(Float64(1.0 + Float64(x / n)) - (x ^ Float64(1.0 / n))); else tmp = t_0; end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Log[t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[((-t$95$2) / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -500.0], N[((-N[Log[1 + N[(-1.0 + t$95$1), $MachinePrecision]], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-87], t$95$3, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-116], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-112], t$95$3, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-104], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-7], N[(t$95$2 * N[(1.0 / (-n)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+214], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{n \cdot x}\\
t_1 := \frac{x}{x + 1}\\
t_2 := \log t_1\\
t_3 := \frac{-t_2}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -500:\\
\;\;\;\;\frac{-\mathsf{log1p}\left(-1 + t_1\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{-87}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-116}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-112}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-104}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-7}:\\
\;\;\;\;t_2 \cdot \frac{1}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+214}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -500Initial program 100.0%
Taylor expanded in n around inf 48.8%
+-rgt-identity48.8%
+-rgt-identity48.8%
log1p-def48.8%
Simplified48.8%
log1p-udef48.8%
diff-log48.8%
Applied egg-rr48.8%
clear-num48.8%
log-rec48.8%
Applied egg-rr48.8%
add-sqr-sqrt46.5%
sqrt-unprod46.8%
sqr-neg46.8%
sqrt-unprod46.8%
log1p-expm1-u46.8%
add-sqr-sqrt46.8%
neg-log46.8%
clear-num46.8%
diff-log46.8%
log1p-udef46.8%
log1p-udef46.8%
diff-log46.8%
clear-num46.8%
neg-log46.8%
add-sqr-sqrt46.8%
sqrt-unprod46.8%
Applied egg-rr93.2%
if -500 < (/.f64 1 n) < -1.00000000000000002e-87 or -5.0000000000000003e-116 < (/.f64 1 n) < 1.9999999999999999e-112Initial program 28.6%
Taylor expanded in n around inf 84.9%
+-rgt-identity84.9%
+-rgt-identity84.9%
log1p-def84.9%
Simplified84.9%
log1p-udef84.9%
diff-log85.1%
Applied egg-rr85.1%
clear-num85.1%
log-rec85.1%
Applied egg-rr85.1%
if -1.00000000000000002e-87 < (/.f64 1 n) < -5.0000000000000003e-116Initial program 5.0%
Taylor expanded in n around inf 18.7%
+-rgt-identity18.7%
+-rgt-identity18.7%
log1p-def18.7%
Simplified18.7%
Taylor expanded in x around inf 86.0%
if 1.9999999999999999e-112 < (/.f64 1 n) < 4.99999999999999979e-104 or 9.9999999999999995e213 < (/.f64 1 n) Initial program 7.9%
Taylor expanded in n around inf 9.9%
+-rgt-identity9.9%
+-rgt-identity9.9%
log1p-def9.9%
Simplified9.9%
Taylor expanded in x around inf 90.4%
*-commutative90.4%
Simplified90.4%
if 4.99999999999999979e-104 < (/.f64 1 n) < 4.99999999999999977e-7Initial program 8.0%
Taylor expanded in n around inf 60.5%
+-rgt-identity60.5%
+-rgt-identity60.5%
log1p-def60.5%
Simplified60.5%
log1p-udef60.5%
diff-log60.8%
Applied egg-rr60.8%
log-div60.5%
log1p-udef60.5%
frac-2neg60.5%
div-inv60.6%
log1p-udef60.6%
log-div60.8%
neg-log60.8%
clear-num60.9%
Applied egg-rr60.9%
if 4.99999999999999977e-7 < (/.f64 1 n) < 9.9999999999999995e213Initial program 77.4%
Taylor expanded in x around 0 77.4%
Final simplification84.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ x (+ x 1.0))) (t_1 (log t_0)) (t_2 (/ (- t_1) n)))
(if (<= (/ 1.0 n) -500.0)
(/ (- (log1p (+ -1.0 t_0))) n)
(if (<= (/ 1.0 n) -1e-87)
t_2
(if (<= (/ 1.0 n) -5e-116)
(/ (/ 1.0 x) n)
(if (<= (/ 1.0 n) 2e-112)
t_2
(if (<= (/ 1.0 n) 5e-104)
(/ (- (/ 1.0 x) (/ 0.5 (pow x 2.0))) n)
(if (<= (/ 1.0 n) 5e-7)
(* t_1 (/ 1.0 (- n)))
(if (<= (/ 1.0 n) 1e+214)
(- (+ 1.0 (/ x n)) (pow x (/ 1.0 n)))
(/ 1.0 (* n x)))))))))))
double code(double x, double n) {
double t_0 = x / (x + 1.0);
double t_1 = log(t_0);
double t_2 = -t_1 / n;
double tmp;
if ((1.0 / n) <= -500.0) {
tmp = -log1p((-1.0 + t_0)) / n;
} else if ((1.0 / n) <= -1e-87) {
tmp = t_2;
} else if ((1.0 / n) <= -5e-116) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e-112) {
tmp = t_2;
} else if ((1.0 / n) <= 5e-104) {
tmp = ((1.0 / x) - (0.5 / pow(x, 2.0))) / n;
} else if ((1.0 / n) <= 5e-7) {
tmp = t_1 * (1.0 / -n);
} else if ((1.0 / n) <= 1e+214) {
tmp = (1.0 + (x / n)) - pow(x, (1.0 / n));
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = x / (x + 1.0);
double t_1 = Math.log(t_0);
double t_2 = -t_1 / n;
double tmp;
if ((1.0 / n) <= -500.0) {
tmp = -Math.log1p((-1.0 + t_0)) / n;
} else if ((1.0 / n) <= -1e-87) {
tmp = t_2;
} else if ((1.0 / n) <= -5e-116) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e-112) {
tmp = t_2;
} else if ((1.0 / n) <= 5e-104) {
tmp = ((1.0 / x) - (0.5 / Math.pow(x, 2.0))) / n;
} else if ((1.0 / n) <= 5e-7) {
tmp = t_1 * (1.0 / -n);
} else if ((1.0 / n) <= 1e+214) {
tmp = (1.0 + (x / n)) - Math.pow(x, (1.0 / n));
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = x / (x + 1.0) t_1 = math.log(t_0) t_2 = -t_1 / n tmp = 0 if (1.0 / n) <= -500.0: tmp = -math.log1p((-1.0 + t_0)) / n elif (1.0 / n) <= -1e-87: tmp = t_2 elif (1.0 / n) <= -5e-116: tmp = (1.0 / x) / n elif (1.0 / n) <= 2e-112: tmp = t_2 elif (1.0 / n) <= 5e-104: tmp = ((1.0 / x) - (0.5 / math.pow(x, 2.0))) / n elif (1.0 / n) <= 5e-7: tmp = t_1 * (1.0 / -n) elif (1.0 / n) <= 1e+214: tmp = (1.0 + (x / n)) - math.pow(x, (1.0 / n)) else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = Float64(x / Float64(x + 1.0)) t_1 = log(t_0) t_2 = Float64(Float64(-t_1) / n) tmp = 0.0 if (Float64(1.0 / n) <= -500.0) tmp = Float64(Float64(-log1p(Float64(-1.0 + t_0))) / n); elseif (Float64(1.0 / n) <= -1e-87) tmp = t_2; elseif (Float64(1.0 / n) <= -5e-116) tmp = Float64(Float64(1.0 / x) / n); elseif (Float64(1.0 / n) <= 2e-112) tmp = t_2; elseif (Float64(1.0 / n) <= 5e-104) tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / (x ^ 2.0))) / n); elseif (Float64(1.0 / n) <= 5e-7) tmp = Float64(t_1 * Float64(1.0 / Float64(-n))); elseif (Float64(1.0 / n) <= 1e+214) tmp = Float64(Float64(1.0 + Float64(x / n)) - (x ^ Float64(1.0 / n))); else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Log[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[((-t$95$1) / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -500.0], N[((-N[Log[1 + N[(-1.0 + t$95$0), $MachinePrecision]], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-87], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-116], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-112], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-104], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-7], N[(t$95$1 * N[(1.0 / (-n)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+214], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1}\\
t_1 := \log t_0\\
t_2 := \frac{-t_1}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -500:\\
\;\;\;\;\frac{-\mathsf{log1p}\left(-1 + t_0\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{-87}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-116}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-112}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-104}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{{x}^{2}}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-7}:\\
\;\;\;\;t_1 \cdot \frac{1}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+214}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 1 n) < -500Initial program 100.0%
Taylor expanded in n around inf 48.8%
+-rgt-identity48.8%
+-rgt-identity48.8%
log1p-def48.8%
Simplified48.8%
log1p-udef48.8%
diff-log48.8%
Applied egg-rr48.8%
clear-num48.8%
log-rec48.8%
Applied egg-rr48.8%
add-sqr-sqrt46.5%
sqrt-unprod46.8%
sqr-neg46.8%
sqrt-unprod46.8%
log1p-expm1-u46.8%
add-sqr-sqrt46.8%
neg-log46.8%
clear-num46.8%
diff-log46.8%
log1p-udef46.8%
log1p-udef46.8%
diff-log46.8%
clear-num46.8%
neg-log46.8%
add-sqr-sqrt46.8%
sqrt-unprod46.8%
Applied egg-rr93.2%
if -500 < (/.f64 1 n) < -1.00000000000000002e-87 or -5.0000000000000003e-116 < (/.f64 1 n) < 1.9999999999999999e-112Initial program 28.6%
Taylor expanded in n around inf 84.9%
+-rgt-identity84.9%
+-rgt-identity84.9%
log1p-def84.9%
Simplified84.9%
log1p-udef84.9%
diff-log85.1%
Applied egg-rr85.1%
clear-num85.1%
log-rec85.1%
Applied egg-rr85.1%
if -1.00000000000000002e-87 < (/.f64 1 n) < -5.0000000000000003e-116Initial program 5.0%
Taylor expanded in n around inf 18.7%
+-rgt-identity18.7%
+-rgt-identity18.7%
log1p-def18.7%
Simplified18.7%
Taylor expanded in x around inf 86.0%
if 1.9999999999999999e-112 < (/.f64 1 n) < 4.99999999999999979e-104Initial program 5.7%
Taylor expanded in n around inf 11.2%
+-rgt-identity11.2%
+-rgt-identity11.2%
log1p-def11.2%
Simplified11.2%
Taylor expanded in x around inf 99.5%
associate-*r/99.5%
metadata-eval99.5%
Simplified99.5%
if 4.99999999999999979e-104 < (/.f64 1 n) < 4.99999999999999977e-7Initial program 8.0%
Taylor expanded in n around inf 60.5%
+-rgt-identity60.5%
+-rgt-identity60.5%
log1p-def60.5%
Simplified60.5%
log1p-udef60.5%
diff-log60.8%
Applied egg-rr60.8%
log-div60.5%
log1p-udef60.5%
frac-2neg60.5%
div-inv60.6%
log1p-udef60.6%
log-div60.8%
neg-log60.8%
clear-num60.9%
Applied egg-rr60.9%
if 4.99999999999999977e-7 < (/.f64 1 n) < 9.9999999999999995e213Initial program 77.4%
Taylor expanded in x around 0 77.4%
if 9.9999999999999995e213 < (/.f64 1 n) Initial program 9.7%
Taylor expanded in n around inf 8.7%
+-rgt-identity8.7%
+-rgt-identity8.7%
log1p-def8.7%
Simplified8.7%
Taylor expanded in x around inf 86.2%
*-commutative86.2%
Simplified86.2%
Final simplification84.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ 1.0 (* n x)))
(t_1 (/ x (+ x 1.0)))
(t_2 (log t_1))
(t_3 (/ (- t_2) n)))
(if (<= (/ 1.0 n) -500.0)
(/ (- (log1p (+ -1.0 t_1))) n)
(if (<= (/ 1.0 n) -1e-87)
t_3
(if (<= (/ 1.0 n) -5e-116)
(/ (/ 1.0 x) n)
(if (<= (/ 1.0 n) 2e-112)
t_3
(if (<= (/ 1.0 n) 5e-104)
(- t_0 (/ 0.5 (* n (pow x 2.0))))
(if (<= (/ 1.0 n) 5e-7)
(* t_2 (/ 1.0 (- n)))
(if (<= (/ 1.0 n) 1e+214)
(- (+ 1.0 (/ x n)) (pow x (/ 1.0 n)))
t_0)))))))))
double code(double x, double n) {
double t_0 = 1.0 / (n * x);
double t_1 = x / (x + 1.0);
double t_2 = log(t_1);
double t_3 = -t_2 / n;
double tmp;
if ((1.0 / n) <= -500.0) {
tmp = -log1p((-1.0 + t_1)) / n;
} else if ((1.0 / n) <= -1e-87) {
tmp = t_3;
} else if ((1.0 / n) <= -5e-116) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e-112) {
tmp = t_3;
} else if ((1.0 / n) <= 5e-104) {
tmp = t_0 - (0.5 / (n * pow(x, 2.0)));
} else if ((1.0 / n) <= 5e-7) {
tmp = t_2 * (1.0 / -n);
} else if ((1.0 / n) <= 1e+214) {
tmp = (1.0 + (x / n)) - pow(x, (1.0 / n));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = 1.0 / (n * x);
double t_1 = x / (x + 1.0);
double t_2 = Math.log(t_1);
double t_3 = -t_2 / n;
double tmp;
if ((1.0 / n) <= -500.0) {
tmp = -Math.log1p((-1.0 + t_1)) / n;
} else if ((1.0 / n) <= -1e-87) {
tmp = t_3;
} else if ((1.0 / n) <= -5e-116) {
tmp = (1.0 / x) / n;
} else if ((1.0 / n) <= 2e-112) {
tmp = t_3;
} else if ((1.0 / n) <= 5e-104) {
tmp = t_0 - (0.5 / (n * Math.pow(x, 2.0)));
} else if ((1.0 / n) <= 5e-7) {
tmp = t_2 * (1.0 / -n);
} else if ((1.0 / n) <= 1e+214) {
tmp = (1.0 + (x / n)) - Math.pow(x, (1.0 / n));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = 1.0 / (n * x) t_1 = x / (x + 1.0) t_2 = math.log(t_1) t_3 = -t_2 / n tmp = 0 if (1.0 / n) <= -500.0: tmp = -math.log1p((-1.0 + t_1)) / n elif (1.0 / n) <= -1e-87: tmp = t_3 elif (1.0 / n) <= -5e-116: tmp = (1.0 / x) / n elif (1.0 / n) <= 2e-112: tmp = t_3 elif (1.0 / n) <= 5e-104: tmp = t_0 - (0.5 / (n * math.pow(x, 2.0))) elif (1.0 / n) <= 5e-7: tmp = t_2 * (1.0 / -n) elif (1.0 / n) <= 1e+214: tmp = (1.0 + (x / n)) - math.pow(x, (1.0 / n)) else: tmp = t_0 return tmp
function code(x, n) t_0 = Float64(1.0 / Float64(n * x)) t_1 = Float64(x / Float64(x + 1.0)) t_2 = log(t_1) t_3 = Float64(Float64(-t_2) / n) tmp = 0.0 if (Float64(1.0 / n) <= -500.0) tmp = Float64(Float64(-log1p(Float64(-1.0 + t_1))) / n); elseif (Float64(1.0 / n) <= -1e-87) tmp = t_3; elseif (Float64(1.0 / n) <= -5e-116) tmp = Float64(Float64(1.0 / x) / n); elseif (Float64(1.0 / n) <= 2e-112) tmp = t_3; elseif (Float64(1.0 / n) <= 5e-104) tmp = Float64(t_0 - Float64(0.5 / Float64(n * (x ^ 2.0)))); elseif (Float64(1.0 / n) <= 5e-7) tmp = Float64(t_2 * Float64(1.0 / Float64(-n))); elseif (Float64(1.0 / n) <= 1e+214) tmp = Float64(Float64(1.0 + Float64(x / n)) - (x ^ Float64(1.0 / n))); else tmp = t_0; end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Log[t$95$1], $MachinePrecision]}, Block[{t$95$3 = N[((-t$95$2) / n), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -500.0], N[((-N[Log[1 + N[(-1.0 + t$95$1), $MachinePrecision]], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-87], t$95$3, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e-116], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-112], t$95$3, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-104], N[(t$95$0 - N[(0.5 / N[(n * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-7], N[(t$95$2 * N[(1.0 / (-n)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+214], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{n \cdot x}\\
t_1 := \frac{x}{x + 1}\\
t_2 := \log t_1\\
t_3 := \frac{-t_2}{n}\\
\mathbf{if}\;\frac{1}{n} \leq -500:\\
\;\;\;\;\frac{-\mathsf{log1p}\left(-1 + t_1\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{-87}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{-116}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-112}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-104}:\\
\;\;\;\;t_0 - \frac{0.5}{n \cdot {x}^{2}}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-7}:\\
\;\;\;\;t_2 \cdot \frac{1}{-n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+214}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -500Initial program 100.0%
Taylor expanded in n around inf 48.8%
+-rgt-identity48.8%
+-rgt-identity48.8%
log1p-def48.8%
Simplified48.8%
log1p-udef48.8%
diff-log48.8%
Applied egg-rr48.8%
clear-num48.8%
log-rec48.8%
Applied egg-rr48.8%
add-sqr-sqrt46.5%
sqrt-unprod46.8%
sqr-neg46.8%
sqrt-unprod46.8%
log1p-expm1-u46.8%
add-sqr-sqrt46.8%
neg-log46.8%
clear-num46.8%
diff-log46.8%
log1p-udef46.8%
log1p-udef46.8%
diff-log46.8%
clear-num46.8%
neg-log46.8%
add-sqr-sqrt46.8%
sqrt-unprod46.8%
Applied egg-rr93.2%
if -500 < (/.f64 1 n) < -1.00000000000000002e-87 or -5.0000000000000003e-116 < (/.f64 1 n) < 1.9999999999999999e-112Initial program 28.6%
Taylor expanded in n around inf 84.9%
+-rgt-identity84.9%
+-rgt-identity84.9%
log1p-def84.9%
Simplified84.9%
log1p-udef84.9%
diff-log85.1%
Applied egg-rr85.1%
clear-num85.1%
log-rec85.1%
Applied egg-rr85.1%
if -1.00000000000000002e-87 < (/.f64 1 n) < -5.0000000000000003e-116Initial program 5.0%
Taylor expanded in n around inf 18.7%
+-rgt-identity18.7%
+-rgt-identity18.7%
log1p-def18.7%
Simplified18.7%
Taylor expanded in x around inf 86.0%
if 1.9999999999999999e-112 < (/.f64 1 n) < 4.99999999999999979e-104Initial program 5.7%
Taylor expanded in n around inf 11.2%
+-rgt-identity11.2%
+-rgt-identity11.2%
log1p-def11.2%
Simplified11.2%
Taylor expanded in x around inf 99.7%
*-commutative99.7%
associate-*r/99.7%
metadata-eval99.7%
*-commutative99.7%
Simplified99.7%
if 4.99999999999999979e-104 < (/.f64 1 n) < 4.99999999999999977e-7Initial program 8.0%
Taylor expanded in n around inf 60.5%
+-rgt-identity60.5%
+-rgt-identity60.5%
log1p-def60.5%
Simplified60.5%
log1p-udef60.5%
diff-log60.8%
Applied egg-rr60.8%
log-div60.5%
log1p-udef60.5%
frac-2neg60.5%
div-inv60.6%
log1p-udef60.6%
log-div60.8%
neg-log60.8%
clear-num60.9%
Applied egg-rr60.9%
if 4.99999999999999977e-7 < (/.f64 1 n) < 9.9999999999999995e213Initial program 77.4%
Taylor expanded in x around 0 77.4%
if 9.9999999999999995e213 < (/.f64 1 n) Initial program 9.7%
Taylor expanded in n around inf 8.7%
+-rgt-identity8.7%
+-rgt-identity8.7%
log1p-def8.7%
Simplified8.7%
Taylor expanded in x around inf 86.2%
*-commutative86.2%
Simplified86.2%
Final simplification84.5%
(FPCore (x n)
:precision binary64
(if (<= x 1.62e-74)
(/ (- (log x)) n)
(if (<= x 7.2e-43)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 1.0)
(/ (- x (log x)) n)
(if (<= x 1.1e+175) (/ (/ 1.0 x) n) (/ 0.0 n))))))
double code(double x, double n) {
double tmp;
if (x <= 1.62e-74) {
tmp = -log(x) / n;
} else if (x <= 7.2e-43) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 1.0) {
tmp = (x - log(x)) / n;
} else if (x <= 1.1e+175) {
tmp = (1.0 / x) / n;
} else {
tmp = 0.0 / 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.62d-74) then
tmp = -log(x) / n
else if (x <= 7.2d-43) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 1.0d0) then
tmp = (x - log(x)) / n
else if (x <= 1.1d+175) then
tmp = (1.0d0 / x) / n
else
tmp = 0.0d0 / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 1.62e-74) {
tmp = -Math.log(x) / n;
} else if (x <= 7.2e-43) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 1.0) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 1.1e+175) {
tmp = (1.0 / x) / n;
} else {
tmp = 0.0 / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.62e-74: tmp = -math.log(x) / n elif x <= 7.2e-43: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 1.0: tmp = (x - math.log(x)) / n elif x <= 1.1e+175: tmp = (1.0 / x) / n else: tmp = 0.0 / n return tmp
function code(x, n) tmp = 0.0 if (x <= 1.62e-74) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 7.2e-43) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 1.0) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 1.1e+175) tmp = Float64(Float64(1.0 / x) / n); else tmp = Float64(0.0 / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.62e-74) tmp = -log(x) / n; elseif (x <= 7.2e-43) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 1.0) tmp = (x - log(x)) / n; elseif (x <= 1.1e+175) tmp = (1.0 / x) / n; else tmp = 0.0 / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.62e-74], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 7.2e-43], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.0], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 1.1e+175], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], N[(0.0 / n), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.62 \cdot 10^{-74}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{-43}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{+175}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{n}\\
\end{array}
\end{array}
if x < 1.62000000000000007e-74Initial program 37.7%
Taylor expanded in n around inf 59.0%
+-rgt-identity59.0%
+-rgt-identity59.0%
log1p-def59.0%
Simplified59.0%
Taylor expanded in x around 0 59.0%
neg-mul-159.0%
Simplified59.0%
if 1.62000000000000007e-74 < x < 7.1999999999999998e-43Initial program 79.4%
Taylor expanded in x around 0 79.4%
if 7.1999999999999998e-43 < x < 1Initial program 21.1%
Taylor expanded in n around inf 75.9%
+-rgt-identity75.9%
+-rgt-identity75.9%
log1p-def75.9%
Simplified75.9%
Taylor expanded in x around 0 67.7%
neg-mul-167.7%
unsub-neg67.7%
Simplified67.7%
if 1 < x < 1.1e175Initial program 51.9%
Taylor expanded in n around inf 51.7%
+-rgt-identity51.7%
+-rgt-identity51.7%
log1p-def51.7%
Simplified51.7%
Taylor expanded in x around inf 64.2%
if 1.1e175 < x Initial program 81.4%
Taylor expanded in n around inf 81.4%
+-rgt-identity81.4%
+-rgt-identity81.4%
log1p-def81.4%
Simplified81.4%
log1p-udef81.4%
diff-log81.4%
Applied egg-rr81.4%
Taylor expanded in x around inf 81.4%
Final simplification65.2%
(FPCore (x n) :precision binary64 (if (<= x 1.0) (/ (- x (log x)) n) (if (<= x 2.05e+173) (/ (/ 1.0 x) n) (/ 0.0 n))))
double code(double x, double n) {
double tmp;
if (x <= 1.0) {
tmp = (x - log(x)) / n;
} else if (x <= 2.05e+173) {
tmp = (1.0 / x) / n;
} else {
tmp = 0.0 / 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 if (x <= 2.05d+173) then
tmp = (1.0d0 / x) / n
else
tmp = 0.0d0 / 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 if (x <= 2.05e+173) {
tmp = (1.0 / x) / n;
} else {
tmp = 0.0 / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.0: tmp = (x - math.log(x)) / n elif x <= 2.05e+173: tmp = (1.0 / x) / n else: tmp = 0.0 / n return tmp
function code(x, n) tmp = 0.0 if (x <= 1.0) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 2.05e+173) tmp = Float64(Float64(1.0 / x) / n); else tmp = Float64(0.0 / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.0) tmp = (x - log(x)) / n; elseif (x <= 2.05e+173) tmp = (1.0 / x) / n; else tmp = 0.0 / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.0], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 2.05e+173], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], N[(0.0 / n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 2.05 \cdot 10^{+173}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{n}\\
\end{array}
\end{array}
if x < 1Initial program 40.9%
Taylor expanded in n around inf 57.2%
+-rgt-identity57.2%
+-rgt-identity57.2%
log1p-def57.2%
Simplified57.2%
Taylor expanded in x around 0 56.5%
neg-mul-156.5%
unsub-neg56.5%
Simplified56.5%
if 1 < x < 2.04999999999999988e173Initial program 51.9%
Taylor expanded in n around inf 51.7%
+-rgt-identity51.7%
+-rgt-identity51.7%
log1p-def51.7%
Simplified51.7%
Taylor expanded in x around inf 64.2%
if 2.04999999999999988e173 < x Initial program 81.4%
Taylor expanded in n around inf 81.4%
+-rgt-identity81.4%
+-rgt-identity81.4%
log1p-def81.4%
Simplified81.4%
log1p-udef81.4%
diff-log81.4%
Applied egg-rr81.4%
Taylor expanded in x around inf 81.4%
Final simplification62.1%
(FPCore (x n) :precision binary64 (if (<= x 0.55) (/ (- (log x)) n) (if (<= x 1.4e+173) (/ (/ 1.0 x) n) (/ 0.0 n))))
double code(double x, double n) {
double tmp;
if (x <= 0.55) {
tmp = -log(x) / n;
} else if (x <= 1.4e+173) {
tmp = (1.0 / x) / n;
} else {
tmp = 0.0 / 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 if (x <= 1.4d+173) then
tmp = (1.0d0 / x) / n
else
tmp = 0.0d0 / 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 if (x <= 1.4e+173) {
tmp = (1.0 / x) / n;
} else {
tmp = 0.0 / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.55: tmp = -math.log(x) / n elif x <= 1.4e+173: tmp = (1.0 / x) / n else: tmp = 0.0 / n return tmp
function code(x, n) tmp = 0.0 if (x <= 0.55) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 1.4e+173) tmp = Float64(Float64(1.0 / x) / n); else tmp = Float64(0.0 / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.55) tmp = -log(x) / n; elseif (x <= 1.4e+173) tmp = (1.0 / x) / n; else tmp = 0.0 / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.55], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 1.4e+173], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision], N[(0.0 / n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.55:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{+173}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{n}\\
\end{array}
\end{array}
if x < 0.55000000000000004Initial program 40.9%
Taylor expanded in n around inf 57.2%
+-rgt-identity57.2%
+-rgt-identity57.2%
log1p-def57.2%
Simplified57.2%
Taylor expanded in x around 0 55.6%
neg-mul-155.6%
Simplified55.6%
if 0.55000000000000004 < x < 1.39999999999999991e173Initial program 51.9%
Taylor expanded in n around inf 51.7%
+-rgt-identity51.7%
+-rgt-identity51.7%
log1p-def51.7%
Simplified51.7%
Taylor expanded in x around inf 64.2%
if 1.39999999999999991e173 < x Initial program 81.4%
Taylor expanded in n around inf 81.4%
+-rgt-identity81.4%
+-rgt-identity81.4%
log1p-def81.4%
Simplified81.4%
log1p-udef81.4%
diff-log81.4%
Applied egg-rr81.4%
Taylor expanded in x around inf 81.4%
Final simplification61.6%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) -10000000.0) (/ 0.0 n) (/ (/ 1.0 x) n)))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -10000000.0) {
tmp = 0.0 / 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 ((1.0d0 / n) <= (-10000000.0d0)) then
tmp = 0.0d0 / n
else
tmp = (1.0d0 / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -10000000.0) {
tmp = 0.0 / n;
} else {
tmp = (1.0 / x) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -10000000.0: tmp = 0.0 / n else: tmp = (1.0 / x) / n return tmp
function code(x, n) tmp = 0.0 if (Float64(1.0 / n) <= -10000000.0) tmp = Float64(0.0 / n); else tmp = Float64(Float64(1.0 / x) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if ((1.0 / n) <= -10000000.0) tmp = 0.0 / n; else tmp = (1.0 / x) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[N[(1.0 / n), $MachinePrecision], -10000000.0], N[(0.0 / n), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -10000000:\\
\;\;\;\;\frac{0}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{n}\\
\end{array}
\end{array}
if (/.f64 1 n) < -1e7Initial program 100.0%
Taylor expanded in n around inf 50.1%
+-rgt-identity50.1%
+-rgt-identity50.1%
log1p-def50.1%
Simplified50.1%
log1p-udef50.1%
diff-log50.1%
Applied egg-rr50.1%
Taylor expanded in x around inf 54.3%
if -1e7 < (/.f64 1 n) Initial program 30.9%
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 40.6%
Final simplification44.3%
(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 49.6%
Taylor expanded in n around inf 58.9%
+-rgt-identity58.9%
+-rgt-identity58.9%
log1p-def58.9%
Simplified58.9%
Taylor expanded in x around inf 34.9%
*-commutative34.9%
Simplified34.9%
Final simplification34.9%
(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 49.6%
Taylor expanded in n around inf 58.9%
+-rgt-identity58.9%
+-rgt-identity58.9%
log1p-def58.9%
Simplified58.9%
Taylor expanded in x around inf 35.0%
Final simplification35.0%
herbie shell --seed 2024011
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))