
(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 18 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 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-102)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 5000.0)
(-
(fma 0.5 (/ (pow (log1p x) 2.0) (* n n)) (/ (log1p x) n))
(fma 0.5 (/ (pow (log x) 2.0) (* n n)) (/ (log x) n)))
(- (exp (/ x n)) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-102) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 5000.0) {
tmp = fma(0.5, (pow(log1p(x), 2.0) / (n * n)), (log1p(x) / n)) - fma(0.5, (pow(log(x), 2.0) / (n * n)), (log(x) / n));
} else {
tmp = exp((x / n)) - t_0;
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-102) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 5000.0) tmp = Float64(fma(0.5, Float64((log1p(x) ^ 2.0) / Float64(n * n)), Float64(log1p(x) / n)) - fma(0.5, Float64((log(x) ^ 2.0) / Float64(n * n)), Float64(log(x) / n))); else tmp = Float64(exp(Float64(x / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-102], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5000.0], N[(N[(0.5 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision] + N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[(0.5 * N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision] + N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-102}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5000:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\mathsf{log1p}\left(x\right)}{n}\right) - \mathsf{fma}\left(0.5, \frac{{\log x}^{2}}{n \cdot n}, \frac{\log x}{n}\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -1.99999999999999987e-102Initial program 76.9%
Taylor expanded in x around inf 91.1%
mul-1-neg91.1%
log-rec91.1%
distribute-frac-neg91.1%
remove-double-neg91.1%
*-commutative91.1%
Simplified91.1%
Taylor expanded in x around 0 91.1%
*-rgt-identity91.1%
associate-*r/91.1%
exp-to-pow91.1%
*-commutative91.1%
Simplified91.1%
if -1.99999999999999987e-102 < (/.f64 1 n) < 5e3Initial program 32.7%
Taylor expanded in n around inf 88.1%
fma-def88.1%
log1p-def88.1%
unpow288.1%
log1p-def88.1%
fma-def88.1%
unpow288.1%
Simplified88.1%
if 5e3 < (/.f64 1 n) Initial program 62.8%
Taylor expanded in n around 0 62.8%
log1p-def100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
Final simplification91.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-102)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 5e-21)
(/ (- (log1p x) (log x)) n)
(if (<= (/ 1.0 n) 1e+218) (fabs (- 1.0 t_0)) (/ 1.0 (* n x)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-102) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 5e-21) {
tmp = (log1p(x) - log(x)) / n;
} else if ((1.0 / n) <= 1e+218) {
tmp = fabs((1.0 - t_0));
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-102) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 5e-21) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else if ((1.0 / n) <= 1e+218) {
tmp = Math.abs((1.0 - t_0));
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-102: tmp = t_0 / (n * x) elif (1.0 / n) <= 5e-21: tmp = (math.log1p(x) - math.log(x)) / n elif (1.0 / n) <= 1e+218: tmp = math.fabs((1.0 - t_0)) else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-102) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 5e-21) tmp = Float64(Float64(log1p(x) - log(x)) / n); elseif (Float64(1.0 / n) <= 1e+218) tmp = abs(Float64(1.0 - t_0)); else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-102], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-21], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+218], N[Abs[N[(1.0 - t$95$0), $MachinePrecision]], $MachinePrecision], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-102}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-21}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+218}:\\
\;\;\;\;\left|1 - t_0\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 1 n) < -1.99999999999999987e-102Initial program 76.9%
Taylor expanded in x around inf 91.1%
mul-1-neg91.1%
log-rec91.1%
distribute-frac-neg91.1%
remove-double-neg91.1%
*-commutative91.1%
Simplified91.1%
Taylor expanded in x around 0 91.1%
*-rgt-identity91.1%
associate-*r/91.1%
exp-to-pow91.1%
*-commutative91.1%
Simplified91.1%
if -1.99999999999999987e-102 < (/.f64 1 n) < 4.99999999999999973e-21Initial program 32.7%
Taylor expanded in n around inf 88.9%
+-rgt-identity88.9%
+-rgt-identity88.9%
log1p-def88.9%
Simplified88.9%
if 4.99999999999999973e-21 < (/.f64 1 n) < 1.00000000000000008e218Initial program 79.5%
Taylor expanded in x around 0 76.1%
add-sqr-sqrt76.1%
sqrt-unprod79.6%
pow279.6%
Applied egg-rr79.6%
unpow279.6%
rem-sqrt-square79.6%
Simplified79.6%
if 1.00000000000000008e218 < (/.f64 1 n) Initial program 19.3%
Taylor expanded in n around inf 15.8%
+-rgt-identity15.8%
+-rgt-identity15.8%
log1p-def15.8%
Simplified15.8%
Taylor expanded in x around inf 83.9%
*-commutative83.9%
Simplified83.9%
Final simplification88.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-102)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 5e-21)
(- (/ (log1p x) n) (/ (log x) n))
(if (<= (/ 1.0 n) 1e+218) (fabs (- 1.0 t_0)) (/ 1.0 (* n x)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-102) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 5e-21) {
tmp = (log1p(x) / n) - (log(x) / n);
} else if ((1.0 / n) <= 1e+218) {
tmp = fabs((1.0 - t_0));
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-102) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 5e-21) {
tmp = (Math.log1p(x) / n) - (Math.log(x) / n);
} else if ((1.0 / n) <= 1e+218) {
tmp = Math.abs((1.0 - t_0));
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-102: tmp = t_0 / (n * x) elif (1.0 / n) <= 5e-21: tmp = (math.log1p(x) / n) - (math.log(x) / n) elif (1.0 / n) <= 1e+218: tmp = math.fabs((1.0 - t_0)) else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-102) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 5e-21) tmp = Float64(Float64(log1p(x) / n) - Float64(log(x) / n)); elseif (Float64(1.0 / n) <= 1e+218) tmp = abs(Float64(1.0 - t_0)); else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-102], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-21], N[(N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+218], N[Abs[N[(1.0 - t$95$0), $MachinePrecision]], $MachinePrecision], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-102}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-21}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right)}{n} - \frac{\log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+218}:\\
\;\;\;\;\left|1 - t_0\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 1 n) < -1.99999999999999987e-102Initial program 76.9%
Taylor expanded in x around inf 91.1%
mul-1-neg91.1%
log-rec91.1%
distribute-frac-neg91.1%
remove-double-neg91.1%
*-commutative91.1%
Simplified91.1%
Taylor expanded in x around 0 91.1%
*-rgt-identity91.1%
associate-*r/91.1%
exp-to-pow91.1%
*-commutative91.1%
Simplified91.1%
if -1.99999999999999987e-102 < (/.f64 1 n) < 4.99999999999999973e-21Initial program 32.7%
Taylor expanded in n around inf 88.9%
+-rgt-identity88.9%
+-rgt-identity88.9%
log1p-def88.9%
Simplified88.9%
div-sub88.9%
Applied egg-rr88.9%
if 4.99999999999999973e-21 < (/.f64 1 n) < 1.00000000000000008e218Initial program 79.5%
Taylor expanded in x around 0 76.1%
add-sqr-sqrt76.1%
sqrt-unprod79.6%
pow279.6%
Applied egg-rr79.6%
unpow279.6%
rem-sqrt-square79.6%
Simplified79.6%
if 1.00000000000000008e218 < (/.f64 1 n) Initial program 19.3%
Taylor expanded in n around inf 15.8%
+-rgt-identity15.8%
+-rgt-identity15.8%
log1p-def15.8%
Simplified15.8%
Taylor expanded in x around inf 83.9%
*-commutative83.9%
Simplified83.9%
Final simplification88.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-102)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 5e-21)
(- (/ (log1p x) n) (/ (log x) n))
(- (exp (/ x n)) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-102) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 5e-21) {
tmp = (log1p(x) / n) - (log(x) / n);
} else {
tmp = exp((x / n)) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-102) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 5e-21) {
tmp = (Math.log1p(x) / n) - (Math.log(x) / n);
} else {
tmp = Math.exp((x / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-102: tmp = t_0 / (n * x) elif (1.0 / n) <= 5e-21: tmp = (math.log1p(x) / n) - (math.log(x) / n) else: tmp = math.exp((x / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-102) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 5e-21) tmp = Float64(Float64(log1p(x) / n) - Float64(log(x) / n)); else tmp = Float64(exp(Float64(x / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-102], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-21], N[(N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-102}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-21}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right)}{n} - \frac{\log x}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -1.99999999999999987e-102Initial program 76.9%
Taylor expanded in x around inf 91.1%
mul-1-neg91.1%
log-rec91.1%
distribute-frac-neg91.1%
remove-double-neg91.1%
*-commutative91.1%
Simplified91.1%
Taylor expanded in x around 0 91.1%
*-rgt-identity91.1%
associate-*r/91.1%
exp-to-pow91.1%
*-commutative91.1%
Simplified91.1%
if -1.99999999999999987e-102 < (/.f64 1 n) < 4.99999999999999973e-21Initial program 32.7%
Taylor expanded in n around inf 88.9%
+-rgt-identity88.9%
+-rgt-identity88.9%
log1p-def88.9%
Simplified88.9%
div-sub88.9%
Applied egg-rr88.9%
if 4.99999999999999973e-21 < (/.f64 1 n) Initial program 61.5%
Taylor expanded in n around 0 61.5%
log1p-def96.8%
Simplified96.8%
Taylor expanded in x around 0 96.8%
Final simplification91.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-102)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 5e-21)
(/ (- (log1p x) (log x)) n)
(if (<= (/ 1.0 n) 1e+218) (- (+ 1.0 (/ x n)) t_0) (/ 1.0 (* n x)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-102) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 5e-21) {
tmp = (log1p(x) - log(x)) / n;
} else if ((1.0 / n) <= 1e+218) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-102) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 5e-21) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else if ((1.0 / n) <= 1e+218) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-102: tmp = t_0 / (n * x) elif (1.0 / n) <= 5e-21: tmp = (math.log1p(x) - math.log(x)) / n elif (1.0 / n) <= 1e+218: tmp = (1.0 + (x / n)) - t_0 else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-102) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 5e-21) tmp = Float64(Float64(log1p(x) - log(x)) / n); elseif (Float64(1.0 / n) <= 1e+218) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-102], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-21], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+218], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-102}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-21}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+218}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 1 n) < -1.99999999999999987e-102Initial program 76.9%
Taylor expanded in x around inf 91.1%
mul-1-neg91.1%
log-rec91.1%
distribute-frac-neg91.1%
remove-double-neg91.1%
*-commutative91.1%
Simplified91.1%
Taylor expanded in x around 0 91.1%
*-rgt-identity91.1%
associate-*r/91.1%
exp-to-pow91.1%
*-commutative91.1%
Simplified91.1%
if -1.99999999999999987e-102 < (/.f64 1 n) < 4.99999999999999973e-21Initial program 32.7%
Taylor expanded in n around inf 88.9%
+-rgt-identity88.9%
+-rgt-identity88.9%
log1p-def88.9%
Simplified88.9%
if 4.99999999999999973e-21 < (/.f64 1 n) < 1.00000000000000008e218Initial program 79.5%
Taylor expanded in x around 0 77.2%
if 1.00000000000000008e218 < (/.f64 1 n) Initial program 19.3%
Taylor expanded in n around inf 15.8%
+-rgt-identity15.8%
+-rgt-identity15.8%
log1p-def15.8%
Simplified15.8%
Taylor expanded in x around inf 83.9%
*-commutative83.9%
Simplified83.9%
Final simplification88.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= (/ 1.0 n) -200000.0)
t_0
(if (<= (/ 1.0 n) -2e-140)
(* (/ 1.0 n) (/ 1.0 x))
(if (<= (/ 1.0 n) -1.6e-258)
(/ (- (log x)) n)
(if (<= (/ 1.0 n) 5e-285)
t_0
(if (<= (/ 1.0 n) 5e-22)
(/ (- x (log x)) n)
(if (<= (/ 1.0 n) 1e+218) t_0 (/ 1.0 (* n x))))))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -200000.0) {
tmp = t_0;
} else if ((1.0 / n) <= -2e-140) {
tmp = (1.0 / n) * (1.0 / x);
} else if ((1.0 / n) <= -1.6e-258) {
tmp = -log(x) / n;
} else if ((1.0 / n) <= 5e-285) {
tmp = t_0;
} else if ((1.0 / n) <= 5e-22) {
tmp = (x - log(x)) / n;
} else if ((1.0 / n) <= 1e+218) {
tmp = t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (x ** (1.0d0 / n))
if ((1.0d0 / n) <= (-200000.0d0)) then
tmp = t_0
else if ((1.0d0 / n) <= (-2d-140)) then
tmp = (1.0d0 / n) * (1.0d0 / x)
else if ((1.0d0 / n) <= (-1.6d-258)) then
tmp = -log(x) / n
else if ((1.0d0 / n) <= 5d-285) then
tmp = t_0
else if ((1.0d0 / n) <= 5d-22) then
tmp = (x - log(x)) / n
else if ((1.0d0 / n) <= 1d+218) then
tmp = t_0
else
tmp = 1.0d0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 - Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -200000.0) {
tmp = t_0;
} else if ((1.0 / n) <= -2e-140) {
tmp = (1.0 / n) * (1.0 / x);
} else if ((1.0 / n) <= -1.6e-258) {
tmp = -Math.log(x) / n;
} else if ((1.0 / n) <= 5e-285) {
tmp = t_0;
} else if ((1.0 / n) <= 5e-22) {
tmp = (x - Math.log(x)) / n;
} else if ((1.0 / n) <= 1e+218) {
tmp = t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -200000.0: tmp = t_0 elif (1.0 / n) <= -2e-140: tmp = (1.0 / n) * (1.0 / x) elif (1.0 / n) <= -1.6e-258: tmp = -math.log(x) / n elif (1.0 / n) <= 5e-285: tmp = t_0 elif (1.0 / n) <= 5e-22: tmp = (x - math.log(x)) / n elif (1.0 / n) <= 1e+218: tmp = t_0 else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) tmp = 0.0 if (Float64(1.0 / n) <= -200000.0) tmp = t_0; elseif (Float64(1.0 / n) <= -2e-140) tmp = Float64(Float64(1.0 / n) * Float64(1.0 / x)); elseif (Float64(1.0 / n) <= -1.6e-258) tmp = Float64(Float64(-log(x)) / n); elseif (Float64(1.0 / n) <= 5e-285) tmp = t_0; elseif (Float64(1.0 / n) <= 5e-22) tmp = Float64(Float64(x - log(x)) / n); elseif (Float64(1.0 / n) <= 1e+218) tmp = t_0; else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); tmp = 0.0; if ((1.0 / n) <= -200000.0) tmp = t_0; elseif ((1.0 / n) <= -2e-140) tmp = (1.0 / n) * (1.0 / x); elseif ((1.0 / n) <= -1.6e-258) tmp = -log(x) / n; elseif ((1.0 / n) <= 5e-285) tmp = t_0; elseif ((1.0 / n) <= 5e-22) tmp = (x - log(x)) / n; elseif ((1.0 / n) <= 1e+218) tmp = t_0; else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -200000.0], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-140], N[(N[(1.0 / n), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -1.6e-258], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-285], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-22], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+218], t$95$0, N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -200000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq -2 \cdot 10^{-140}:\\
\;\;\;\;\frac{1}{n} \cdot \frac{1}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq -1.6 \cdot 10^{-258}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-285}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-22}:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+218}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 1 n) < -2e5 or -1.6000000000000001e-258 < (/.f64 1 n) < 5.00000000000000018e-285 or 4.99999999999999954e-22 < (/.f64 1 n) < 1.00000000000000008e218Initial program 90.7%
Taylor expanded in x around 0 67.8%
if -2e5 < (/.f64 1 n) < -2e-140Initial program 9.5%
Taylor expanded in n around inf 45.6%
+-rgt-identity45.6%
+-rgt-identity45.6%
log1p-def45.5%
Simplified45.5%
Taylor expanded in x around inf 62.0%
*-commutative62.0%
Simplified62.0%
inv-pow62.0%
unpow-prod-down62.1%
inv-pow62.1%
inv-pow62.1%
Applied egg-rr62.1%
if -2e-140 < (/.f64 1 n) < -1.6000000000000001e-258Initial program 21.8%
Taylor expanded in x around 0 21.8%
Taylor expanded in n around inf 78.9%
associate-*r/78.9%
mul-1-neg78.9%
Simplified78.9%
if 5.00000000000000018e-285 < (/.f64 1 n) < 4.99999999999999954e-22Initial program 24.0%
Taylor expanded in n around inf 83.3%
+-rgt-identity83.3%
+-rgt-identity83.3%
log1p-def83.3%
Simplified83.3%
Taylor expanded in x around 0 62.4%
if 1.00000000000000008e218 < (/.f64 1 n) Initial program 19.3%
Taylor expanded in n around inf 15.8%
+-rgt-identity15.8%
+-rgt-identity15.8%
log1p-def15.8%
Simplified15.8%
Taylor expanded in x around inf 83.9%
*-commutative83.9%
Simplified83.9%
Final simplification67.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-140)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) -1.6e-258)
(/ (- (log x)) n)
(if (<= (/ 1.0 n) 5e-285)
(- 1.0 t_0)
(if (<= (/ 1.0 n) 5e-21)
(- (/ x n) (/ (log x) n))
(if (<= (/ 1.0 n) 1e+218)
(- (+ 1.0 (/ x n)) t_0)
(/ 1.0 (* n x)))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-140) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= -1.6e-258) {
tmp = -log(x) / n;
} else if ((1.0 / n) <= 5e-285) {
tmp = 1.0 - t_0;
} else if ((1.0 / n) <= 5e-21) {
tmp = (x / n) - (log(x) / n);
} else if ((1.0 / n) <= 1e+218) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-2d-140)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= (-1.6d-258)) then
tmp = -log(x) / n
else if ((1.0d0 / n) <= 5d-285) then
tmp = 1.0d0 - t_0
else if ((1.0d0 / n) <= 5d-21) then
tmp = (x / n) - (log(x) / n)
else if ((1.0d0 / n) <= 1d+218) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = 1.0d0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-140) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= -1.6e-258) {
tmp = -Math.log(x) / n;
} else if ((1.0 / n) <= 5e-285) {
tmp = 1.0 - t_0;
} else if ((1.0 / n) <= 5e-21) {
tmp = (x / n) - (Math.log(x) / n);
} else if ((1.0 / n) <= 1e+218) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-140: tmp = t_0 / (n * x) elif (1.0 / n) <= -1.6e-258: tmp = -math.log(x) / n elif (1.0 / n) <= 5e-285: tmp = 1.0 - t_0 elif (1.0 / n) <= 5e-21: tmp = (x / n) - (math.log(x) / n) elif (1.0 / n) <= 1e+218: tmp = (1.0 + (x / n)) - t_0 else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-140) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= -1.6e-258) tmp = Float64(Float64(-log(x)) / n); elseif (Float64(1.0 / n) <= 5e-285) tmp = Float64(1.0 - t_0); elseif (Float64(1.0 / n) <= 5e-21) tmp = Float64(Float64(x / n) - Float64(log(x) / n)); elseif (Float64(1.0 / n) <= 1e+218) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -2e-140) tmp = t_0 / (n * x); elseif ((1.0 / n) <= -1.6e-258) tmp = -log(x) / n; elseif ((1.0 / n) <= 5e-285) tmp = 1.0 - t_0; elseif ((1.0 / n) <= 5e-21) tmp = (x / n) - (log(x) / n); elseif ((1.0 / n) <= 1e+218) tmp = (1.0 + (x / n)) - t_0; else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-140], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -1.6e-258], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-285], N[(1.0 - t$95$0), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-21], N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+218], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-140}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq -1.6 \cdot 10^{-258}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-285}:\\
\;\;\;\;1 - t_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-21}:\\
\;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+218}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 1 n) < -2e-140Initial program 75.2%
Taylor expanded in x around inf 89.9%
mul-1-neg89.9%
log-rec89.9%
distribute-frac-neg89.9%
remove-double-neg89.9%
*-commutative89.9%
Simplified89.9%
Taylor expanded in x around 0 89.9%
*-rgt-identity89.9%
associate-*r/89.9%
exp-to-pow89.9%
*-commutative89.9%
Simplified89.9%
if -2e-140 < (/.f64 1 n) < -1.6000000000000001e-258Initial program 21.8%
Taylor expanded in x around 0 21.8%
Taylor expanded in n around inf 78.9%
associate-*r/78.9%
mul-1-neg78.9%
Simplified78.9%
if -1.6000000000000001e-258 < (/.f64 1 n) < 5.00000000000000018e-285Initial program 71.4%
Taylor expanded in x around 0 71.4%
if 5.00000000000000018e-285 < (/.f64 1 n) < 4.99999999999999973e-21Initial program 24.9%
Taylor expanded in n around inf 83.8%
+-rgt-identity83.8%
+-rgt-identity83.8%
log1p-def83.8%
Simplified83.8%
Taylor expanded in x around 0 62.0%
+-commutative62.0%
mul-1-neg62.0%
unsub-neg62.0%
Simplified62.0%
if 4.99999999999999973e-21 < (/.f64 1 n) < 1.00000000000000008e218Initial program 79.5%
Taylor expanded in x around 0 77.2%
if 1.00000000000000008e218 < (/.f64 1 n) Initial program 19.3%
Taylor expanded in n around inf 15.8%
+-rgt-identity15.8%
+-rgt-identity15.8%
log1p-def15.8%
Simplified15.8%
Taylor expanded in x around inf 83.9%
*-commutative83.9%
Simplified83.9%
Final simplification79.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -2e-140)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) -1.6e-258)
(/ (- (log x)) n)
(if (<= (/ 1.0 n) 5e-285)
(- 1.0 t_0)
(if (<= (/ 1.0 n) 5e-21)
(/ (- (+ x (* (* x x) -0.5)) (log x)) n)
(if (<= (/ 1.0 n) 1e+218)
(- (+ 1.0 (/ x n)) t_0)
(/ 1.0 (* n x)))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-140) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= -1.6e-258) {
tmp = -log(x) / n;
} else if ((1.0 / n) <= 5e-285) {
tmp = 1.0 - t_0;
} else if ((1.0 / n) <= 5e-21) {
tmp = ((x + ((x * x) * -0.5)) - log(x)) / n;
} else if ((1.0 / n) <= 1e+218) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-2d-140)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= (-1.6d-258)) then
tmp = -log(x) / n
else if ((1.0d0 / n) <= 5d-285) then
tmp = 1.0d0 - t_0
else if ((1.0d0 / n) <= 5d-21) then
tmp = ((x + ((x * x) * (-0.5d0))) - log(x)) / n
else if ((1.0d0 / n) <= 1d+218) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = 1.0d0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -2e-140) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= -1.6e-258) {
tmp = -Math.log(x) / n;
} else if ((1.0 / n) <= 5e-285) {
tmp = 1.0 - t_0;
} else if ((1.0 / n) <= 5e-21) {
tmp = ((x + ((x * x) * -0.5)) - Math.log(x)) / n;
} else if ((1.0 / n) <= 1e+218) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -2e-140: tmp = t_0 / (n * x) elif (1.0 / n) <= -1.6e-258: tmp = -math.log(x) / n elif (1.0 / n) <= 5e-285: tmp = 1.0 - t_0 elif (1.0 / n) <= 5e-21: tmp = ((x + ((x * x) * -0.5)) - math.log(x)) / n elif (1.0 / n) <= 1e+218: tmp = (1.0 + (x / n)) - t_0 else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -2e-140) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= -1.6e-258) tmp = Float64(Float64(-log(x)) / n); elseif (Float64(1.0 / n) <= 5e-285) tmp = Float64(1.0 - t_0); elseif (Float64(1.0 / n) <= 5e-21) tmp = Float64(Float64(Float64(x + Float64(Float64(x * x) * -0.5)) - log(x)) / n); elseif (Float64(1.0 / n) <= 1e+218) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -2e-140) tmp = t_0 / (n * x); elseif ((1.0 / n) <= -1.6e-258) tmp = -log(x) / n; elseif ((1.0 / n) <= 5e-285) tmp = 1.0 - t_0; elseif ((1.0 / n) <= 5e-21) tmp = ((x + ((x * x) * -0.5)) - log(x)) / n; elseif ((1.0 / n) <= 1e+218) tmp = (1.0 + (x / n)) - t_0; else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-140], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -1.6e-258], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-285], N[(1.0 - t$95$0), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-21], N[(N[(N[(x + N[(N[(x * x), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+218], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-140}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq -1.6 \cdot 10^{-258}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-285}:\\
\;\;\;\;1 - t_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-21}:\\
\;\;\;\;\frac{\left(x + \left(x \cdot x\right) \cdot -0.5\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+218}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 1 n) < -2e-140Initial program 75.2%
Taylor expanded in x around inf 89.9%
mul-1-neg89.9%
log-rec89.9%
distribute-frac-neg89.9%
remove-double-neg89.9%
*-commutative89.9%
Simplified89.9%
Taylor expanded in x around 0 89.9%
*-rgt-identity89.9%
associate-*r/89.9%
exp-to-pow89.9%
*-commutative89.9%
Simplified89.9%
if -2e-140 < (/.f64 1 n) < -1.6000000000000001e-258Initial program 21.8%
Taylor expanded in x around 0 21.8%
Taylor expanded in n around inf 78.9%
associate-*r/78.9%
mul-1-neg78.9%
Simplified78.9%
if -1.6000000000000001e-258 < (/.f64 1 n) < 5.00000000000000018e-285Initial program 71.4%
Taylor expanded in x around 0 71.4%
if 5.00000000000000018e-285 < (/.f64 1 n) < 4.99999999999999973e-21Initial program 24.9%
Taylor expanded in n around inf 83.8%
+-rgt-identity83.8%
+-rgt-identity83.8%
log1p-def83.8%
Simplified83.8%
Taylor expanded in x around 0 62.3%
*-commutative62.3%
unpow262.3%
Simplified62.3%
if 4.99999999999999973e-21 < (/.f64 1 n) < 1.00000000000000008e218Initial program 79.5%
Taylor expanded in x around 0 77.2%
if 1.00000000000000008e218 < (/.f64 1 n) Initial program 19.3%
Taylor expanded in n around inf 15.8%
+-rgt-identity15.8%
+-rgt-identity15.8%
log1p-def15.8%
Simplified15.8%
Taylor expanded in x around inf 83.9%
*-commutative83.9%
Simplified83.9%
Final simplification79.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (- 1.0 t_0)))
(if (<= (/ 1.0 n) -2e-140)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) -1.6e-258)
(/ (- (log x)) n)
(if (<= (/ 1.0 n) 5e-285)
t_1
(if (<= (/ 1.0 n) 5e-22)
(- (/ x n) (/ (log x) n))
(if (<= (/ 1.0 n) 1e+218) t_1 (/ 1.0 (* n x)))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = 1.0 - t_0;
double tmp;
if ((1.0 / n) <= -2e-140) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= -1.6e-258) {
tmp = -log(x) / n;
} else if ((1.0 / n) <= 5e-285) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-22) {
tmp = (x / n) - (log(x) / n);
} else if ((1.0 / n) <= 1e+218) {
tmp = t_1;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
t_1 = 1.0d0 - t_0
if ((1.0d0 / n) <= (-2d-140)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= (-1.6d-258)) then
tmp = -log(x) / n
else if ((1.0d0 / n) <= 5d-285) then
tmp = t_1
else if ((1.0d0 / n) <= 5d-22) then
tmp = (x / n) - (log(x) / n)
else if ((1.0d0 / n) <= 1d+218) then
tmp = t_1
else
tmp = 1.0d0 / (n * x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = 1.0 - t_0;
double tmp;
if ((1.0 / n) <= -2e-140) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= -1.6e-258) {
tmp = -Math.log(x) / n;
} else if ((1.0 / n) <= 5e-285) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-22) {
tmp = (x / n) - (Math.log(x) / n);
} else if ((1.0 / n) <= 1e+218) {
tmp = t_1;
} else {
tmp = 1.0 / (n * x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = 1.0 - t_0 tmp = 0 if (1.0 / n) <= -2e-140: tmp = t_0 / (n * x) elif (1.0 / n) <= -1.6e-258: tmp = -math.log(x) / n elif (1.0 / n) <= 5e-285: tmp = t_1 elif (1.0 / n) <= 5e-22: tmp = (x / n) - (math.log(x) / n) elif (1.0 / n) <= 1e+218: tmp = t_1 else: tmp = 1.0 / (n * x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(1.0 - t_0) tmp = 0.0 if (Float64(1.0 / n) <= -2e-140) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= -1.6e-258) tmp = Float64(Float64(-log(x)) / n); elseif (Float64(1.0 / n) <= 5e-285) tmp = t_1; elseif (Float64(1.0 / n) <= 5e-22) tmp = Float64(Float64(x / n) - Float64(log(x) / n)); elseif (Float64(1.0 / n) <= 1e+218) tmp = t_1; else tmp = Float64(1.0 / Float64(n * x)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = 1.0 - t_0; tmp = 0.0; if ((1.0 / n) <= -2e-140) tmp = t_0 / (n * x); elseif ((1.0 / n) <= -1.6e-258) tmp = -log(x) / n; elseif ((1.0 / n) <= 5e-285) tmp = t_1; elseif ((1.0 / n) <= 5e-22) tmp = (x / n) - (log(x) / n); elseif ((1.0 / n) <= 1e+218) tmp = t_1; else tmp = 1.0 / (n * x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - t$95$0), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2e-140], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], -1.6e-258], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-285], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-22], N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+218], t$95$1, N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := 1 - t_0\\
\mathbf{if}\;\frac{1}{n} \leq -2 \cdot 10^{-140}:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq -1.6 \cdot 10^{-258}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-285}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-22}:\\
\;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+218}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\end{array}
\end{array}
if (/.f64 1 n) < -2e-140Initial program 75.2%
Taylor expanded in x around inf 89.9%
mul-1-neg89.9%
log-rec89.9%
distribute-frac-neg89.9%
remove-double-neg89.9%
*-commutative89.9%
Simplified89.9%
Taylor expanded in x around 0 89.9%
*-rgt-identity89.9%
associate-*r/89.9%
exp-to-pow89.9%
*-commutative89.9%
Simplified89.9%
if -2e-140 < (/.f64 1 n) < -1.6000000000000001e-258Initial program 21.8%
Taylor expanded in x around 0 21.8%
Taylor expanded in n around inf 78.9%
associate-*r/78.9%
mul-1-neg78.9%
Simplified78.9%
if -1.6000000000000001e-258 < (/.f64 1 n) < 5.00000000000000018e-285 or 4.99999999999999954e-22 < (/.f64 1 n) < 1.00000000000000008e218Initial program 75.3%
Taylor expanded in x around 0 73.3%
if 5.00000000000000018e-285 < (/.f64 1 n) < 4.99999999999999954e-22Initial program 24.0%
Taylor expanded in n around inf 83.3%
+-rgt-identity83.3%
+-rgt-identity83.3%
log1p-def83.3%
Simplified83.3%
Taylor expanded in x around 0 62.4%
+-commutative62.4%
mul-1-neg62.4%
unsub-neg62.4%
Simplified62.4%
if 1.00000000000000008e218 < (/.f64 1 n) Initial program 19.3%
Taylor expanded in n around inf 15.8%
+-rgt-identity15.8%
+-rgt-identity15.8%
log1p-def15.8%
Simplified15.8%
Taylor expanded in x around inf 83.9%
*-commutative83.9%
Simplified83.9%
Final simplification79.1%
(FPCore (x n)
:precision binary64
(if (<= n -3.1e+139)
(/ (- (log x)) n)
(if (<= n -14.5)
(* (/ 1.0 n) (/ 1.0 x))
(if (<= n 8e-219)
(/ 0.3333333333333333 (* n (pow x 3.0)))
(if (or (<= n 5e+20) (not (<= n 3.9e+284)))
(- 1.0 (pow x (/ 1.0 n)))
(* (/ 1.0 n) (- x (log x))))))))
double code(double x, double n) {
double tmp;
if (n <= -3.1e+139) {
tmp = -log(x) / n;
} else if (n <= -14.5) {
tmp = (1.0 / n) * (1.0 / x);
} else if (n <= 8e-219) {
tmp = 0.3333333333333333 / (n * pow(x, 3.0));
} else if ((n <= 5e+20) || !(n <= 3.9e+284)) {
tmp = 1.0 - pow(x, (1.0 / n));
} else {
tmp = (1.0 / n) * (x - log(x));
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-3.1d+139)) then
tmp = -log(x) / n
else if (n <= (-14.5d0)) then
tmp = (1.0d0 / n) * (1.0d0 / x)
else if (n <= 8d-219) then
tmp = 0.3333333333333333d0 / (n * (x ** 3.0d0))
else if ((n <= 5d+20) .or. (.not. (n <= 3.9d+284))) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else
tmp = (1.0d0 / n) * (x - log(x))
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (n <= -3.1e+139) {
tmp = -Math.log(x) / n;
} else if (n <= -14.5) {
tmp = (1.0 / n) * (1.0 / x);
} else if (n <= 8e-219) {
tmp = 0.3333333333333333 / (n * Math.pow(x, 3.0));
} else if ((n <= 5e+20) || !(n <= 3.9e+284)) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = (1.0 / n) * (x - Math.log(x));
}
return tmp;
}
def code(x, n): tmp = 0 if n <= -3.1e+139: tmp = -math.log(x) / n elif n <= -14.5: tmp = (1.0 / n) * (1.0 / x) elif n <= 8e-219: tmp = 0.3333333333333333 / (n * math.pow(x, 3.0)) elif (n <= 5e+20) or not (n <= 3.9e+284): tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = (1.0 / n) * (x - math.log(x)) return tmp
function code(x, n) tmp = 0.0 if (n <= -3.1e+139) tmp = Float64(Float64(-log(x)) / n); elseif (n <= -14.5) tmp = Float64(Float64(1.0 / n) * Float64(1.0 / x)); elseif (n <= 8e-219) tmp = Float64(0.3333333333333333 / Float64(n * (x ^ 3.0))); elseif ((n <= 5e+20) || !(n <= 3.9e+284)) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = Float64(Float64(1.0 / n) * Float64(x - log(x))); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (n <= -3.1e+139) tmp = -log(x) / n; elseif (n <= -14.5) tmp = (1.0 / n) * (1.0 / x); elseif (n <= 8e-219) tmp = 0.3333333333333333 / (n * (x ^ 3.0)); elseif ((n <= 5e+20) || ~((n <= 3.9e+284))) tmp = 1.0 - (x ^ (1.0 / n)); else tmp = (1.0 / n) * (x - log(x)); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[n, -3.1e+139], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[n, -14.5], N[(N[(1.0 / n), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 8e-219], N[(0.3333333333333333 / N[(n * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[n, 5e+20], N[Not[LessEqual[n, 3.9e+284]], $MachinePrecision]], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / n), $MachinePrecision] * N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -3.1 \cdot 10^{+139}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;n \leq -14.5:\\
\;\;\;\;\frac{1}{n} \cdot \frac{1}{x}\\
\mathbf{elif}\;n \leq 8 \cdot 10^{-219}:\\
\;\;\;\;\frac{0.3333333333333333}{n \cdot {x}^{3}}\\
\mathbf{elif}\;n \leq 5 \cdot 10^{+20} \lor \neg \left(n \leq 3.9 \cdot 10^{+284}\right):\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n} \cdot \left(x - \log x\right)\\
\end{array}
\end{array}
if n < -3.1e139Initial program 33.7%
Taylor expanded in x around 0 33.7%
Taylor expanded in n around inf 69.6%
associate-*r/69.6%
mul-1-neg69.6%
Simplified69.6%
if -3.1e139 < n < -14.5Initial program 9.5%
Taylor expanded in n around inf 45.6%
+-rgt-identity45.6%
+-rgt-identity45.6%
log1p-def45.5%
Simplified45.5%
Taylor expanded in x around inf 62.0%
*-commutative62.0%
Simplified62.0%
inv-pow62.0%
unpow-prod-down62.1%
inv-pow62.1%
inv-pow62.1%
Applied egg-rr62.1%
if -14.5 < n < 8.0000000000000003e-219Initial program 89.7%
Taylor expanded in n around inf 34.3%
+-rgt-identity34.3%
+-rgt-identity34.3%
log1p-def34.3%
Simplified34.3%
Taylor expanded in x around inf 29.2%
sub-neg29.2%
+-commutative29.2%
associate-+l+29.2%
associate-*r/29.2%
metadata-eval29.2%
associate-*r/29.2%
metadata-eval29.2%
distribute-neg-frac29.2%
metadata-eval29.2%
unpow229.2%
Simplified29.2%
Taylor expanded in x around 0 79.7%
if 8.0000000000000003e-219 < n < 5e20 or 3.89999999999999976e284 < n Initial program 80.1%
Taylor expanded in x around 0 77.5%
if 5e20 < n < 3.89999999999999976e284Initial program 24.0%
Taylor expanded in n around inf 83.3%
+-rgt-identity83.3%
+-rgt-identity83.3%
log1p-def83.3%
Simplified83.3%
Taylor expanded in x around 0 62.4%
div-inv62.4%
Applied egg-rr62.4%
Final simplification71.9%
(FPCore (x n)
:precision binary64
(if (<= n -1.15e+141)
(/ (- (log x)) n)
(if (<= n -15.2)
(* (/ 1.0 n) (/ 1.0 x))
(if (<= n 1e-218)
(/ 0.3333333333333333 (* n (pow x 3.0)))
(if (or (<= n 5e+20) (not (<= n 2.5e+284)))
(- 1.0 (pow x (/ 1.0 n)))
(- (/ x n) (/ (log x) n)))))))
double code(double x, double n) {
double tmp;
if (n <= -1.15e+141) {
tmp = -log(x) / n;
} else if (n <= -15.2) {
tmp = (1.0 / n) * (1.0 / x);
} else if (n <= 1e-218) {
tmp = 0.3333333333333333 / (n * pow(x, 3.0));
} else if ((n <= 5e+20) || !(n <= 2.5e+284)) {
tmp = 1.0 - pow(x, (1.0 / n));
} else {
tmp = (x / n) - (log(x) / n);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-1.15d+141)) then
tmp = -log(x) / n
else if (n <= (-15.2d0)) then
tmp = (1.0d0 / n) * (1.0d0 / x)
else if (n <= 1d-218) then
tmp = 0.3333333333333333d0 / (n * (x ** 3.0d0))
else if ((n <= 5d+20) .or. (.not. (n <= 2.5d+284))) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else
tmp = (x / n) - (log(x) / n)
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (n <= -1.15e+141) {
tmp = -Math.log(x) / n;
} else if (n <= -15.2) {
tmp = (1.0 / n) * (1.0 / x);
} else if (n <= 1e-218) {
tmp = 0.3333333333333333 / (n * Math.pow(x, 3.0));
} else if ((n <= 5e+20) || !(n <= 2.5e+284)) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = (x / n) - (Math.log(x) / n);
}
return tmp;
}
def code(x, n): tmp = 0 if n <= -1.15e+141: tmp = -math.log(x) / n elif n <= -15.2: tmp = (1.0 / n) * (1.0 / x) elif n <= 1e-218: tmp = 0.3333333333333333 / (n * math.pow(x, 3.0)) elif (n <= 5e+20) or not (n <= 2.5e+284): tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = (x / n) - (math.log(x) / n) return tmp
function code(x, n) tmp = 0.0 if (n <= -1.15e+141) tmp = Float64(Float64(-log(x)) / n); elseif (n <= -15.2) tmp = Float64(Float64(1.0 / n) * Float64(1.0 / x)); elseif (n <= 1e-218) tmp = Float64(0.3333333333333333 / Float64(n * (x ^ 3.0))); elseif ((n <= 5e+20) || !(n <= 2.5e+284)) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = Float64(Float64(x / n) - Float64(log(x) / n)); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (n <= -1.15e+141) tmp = -log(x) / n; elseif (n <= -15.2) tmp = (1.0 / n) * (1.0 / x); elseif (n <= 1e-218) tmp = 0.3333333333333333 / (n * (x ^ 3.0)); elseif ((n <= 5e+20) || ~((n <= 2.5e+284))) tmp = 1.0 - (x ^ (1.0 / n)); else tmp = (x / n) - (log(x) / n); end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[n, -1.15e+141], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[n, -15.2], N[(N[(1.0 / n), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1e-218], N[(0.3333333333333333 / N[(n * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[n, 5e+20], N[Not[LessEqual[n, 2.5e+284]], $MachinePrecision]], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(x / n), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.15 \cdot 10^{+141}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;n \leq -15.2:\\
\;\;\;\;\frac{1}{n} \cdot \frac{1}{x}\\
\mathbf{elif}\;n \leq 10^{-218}:\\
\;\;\;\;\frac{0.3333333333333333}{n \cdot {x}^{3}}\\
\mathbf{elif}\;n \leq 5 \cdot 10^{+20} \lor \neg \left(n \leq 2.5 \cdot 10^{+284}\right):\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{n} - \frac{\log x}{n}\\
\end{array}
\end{array}
if n < -1.1500000000000001e141Initial program 33.7%
Taylor expanded in x around 0 33.7%
Taylor expanded in n around inf 69.6%
associate-*r/69.6%
mul-1-neg69.6%
Simplified69.6%
if -1.1500000000000001e141 < n < -15.199999999999999Initial program 9.5%
Taylor expanded in n around inf 45.6%
+-rgt-identity45.6%
+-rgt-identity45.6%
log1p-def45.5%
Simplified45.5%
Taylor expanded in x around inf 62.0%
*-commutative62.0%
Simplified62.0%
inv-pow62.0%
unpow-prod-down62.1%
inv-pow62.1%
inv-pow62.1%
Applied egg-rr62.1%
if -15.199999999999999 < n < 1e-218Initial program 89.7%
Taylor expanded in n around inf 34.3%
+-rgt-identity34.3%
+-rgt-identity34.3%
log1p-def34.3%
Simplified34.3%
Taylor expanded in x around inf 29.2%
sub-neg29.2%
+-commutative29.2%
associate-+l+29.2%
associate-*r/29.2%
metadata-eval29.2%
associate-*r/29.2%
metadata-eval29.2%
distribute-neg-frac29.2%
metadata-eval29.2%
unpow229.2%
Simplified29.2%
Taylor expanded in x around 0 79.7%
if 1e-218 < n < 5e20 or 2.5e284 < n Initial program 80.1%
Taylor expanded in x around 0 77.5%
if 5e20 < n < 2.5e284Initial program 24.0%
Taylor expanded in n around inf 83.3%
+-rgt-identity83.3%
+-rgt-identity83.3%
log1p-def83.3%
Simplified83.3%
Taylor expanded in x around 0 62.4%
+-commutative62.4%
mul-1-neg62.4%
unsub-neg62.4%
Simplified62.4%
Final simplification71.9%
(FPCore (x n)
:precision binary64
(if (<= n -2.8e+141)
(/ (- (log x)) n)
(if (<= n -5.4)
(* (/ 1.0 n) (/ 1.0 x))
(if (<= n 1.35e-219)
(/ 0.3333333333333333 (* n (pow x 3.0)))
(if (or (<= n 5e+20) (not (<= n 3.3e+284)))
(- 1.0 (pow x (/ 1.0 n)))
(/ (- x (log x)) n))))))
double code(double x, double n) {
double tmp;
if (n <= -2.8e+141) {
tmp = -log(x) / n;
} else if (n <= -5.4) {
tmp = (1.0 / n) * (1.0 / x);
} else if (n <= 1.35e-219) {
tmp = 0.3333333333333333 / (n * pow(x, 3.0));
} else if ((n <= 5e+20) || !(n <= 3.3e+284)) {
tmp = 1.0 - pow(x, (1.0 / n));
} else {
tmp = (x - log(x)) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-2.8d+141)) then
tmp = -log(x) / n
else if (n <= (-5.4d0)) then
tmp = (1.0d0 / n) * (1.0d0 / x)
else if (n <= 1.35d-219) then
tmp = 0.3333333333333333d0 / (n * (x ** 3.0d0))
else if ((n <= 5d+20) .or. (.not. (n <= 3.3d+284))) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else
tmp = (x - log(x)) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (n <= -2.8e+141) {
tmp = -Math.log(x) / n;
} else if (n <= -5.4) {
tmp = (1.0 / n) * (1.0 / x);
} else if (n <= 1.35e-219) {
tmp = 0.3333333333333333 / (n * Math.pow(x, 3.0));
} else if ((n <= 5e+20) || !(n <= 3.3e+284)) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = (x - Math.log(x)) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if n <= -2.8e+141: tmp = -math.log(x) / n elif n <= -5.4: tmp = (1.0 / n) * (1.0 / x) elif n <= 1.35e-219: tmp = 0.3333333333333333 / (n * math.pow(x, 3.0)) elif (n <= 5e+20) or not (n <= 3.3e+284): tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = (x - math.log(x)) / n return tmp
function code(x, n) tmp = 0.0 if (n <= -2.8e+141) tmp = Float64(Float64(-log(x)) / n); elseif (n <= -5.4) tmp = Float64(Float64(1.0 / n) * Float64(1.0 / x)); elseif (n <= 1.35e-219) tmp = Float64(0.3333333333333333 / Float64(n * (x ^ 3.0))); elseif ((n <= 5e+20) || !(n <= 3.3e+284)) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = Float64(Float64(x - log(x)) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (n <= -2.8e+141) tmp = -log(x) / n; elseif (n <= -5.4) tmp = (1.0 / n) * (1.0 / x); elseif (n <= 1.35e-219) tmp = 0.3333333333333333 / (n * (x ^ 3.0)); elseif ((n <= 5e+20) || ~((n <= 3.3e+284))) tmp = 1.0 - (x ^ (1.0 / n)); else tmp = (x - log(x)) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[n, -2.8e+141], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[n, -5.4], N[(N[(1.0 / n), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.35e-219], N[(0.3333333333333333 / N[(n * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[n, 5e+20], N[Not[LessEqual[n, 3.3e+284]], $MachinePrecision]], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.8 \cdot 10^{+141}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;n \leq -5.4:\\
\;\;\;\;\frac{1}{n} \cdot \frac{1}{x}\\
\mathbf{elif}\;n \leq 1.35 \cdot 10^{-219}:\\
\;\;\;\;\frac{0.3333333333333333}{n \cdot {x}^{3}}\\
\mathbf{elif}\;n \leq 5 \cdot 10^{+20} \lor \neg \left(n \leq 3.3 \cdot 10^{+284}\right):\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - \log x}{n}\\
\end{array}
\end{array}
if n < -2.79999999999999991e141Initial program 33.7%
Taylor expanded in x around 0 33.7%
Taylor expanded in n around inf 69.6%
associate-*r/69.6%
mul-1-neg69.6%
Simplified69.6%
if -2.79999999999999991e141 < n < -5.4000000000000004Initial program 9.5%
Taylor expanded in n around inf 45.6%
+-rgt-identity45.6%
+-rgt-identity45.6%
log1p-def45.5%
Simplified45.5%
Taylor expanded in x around inf 62.0%
*-commutative62.0%
Simplified62.0%
inv-pow62.0%
unpow-prod-down62.1%
inv-pow62.1%
inv-pow62.1%
Applied egg-rr62.1%
if -5.4000000000000004 < n < 1.35e-219Initial program 89.7%
Taylor expanded in n around inf 34.3%
+-rgt-identity34.3%
+-rgt-identity34.3%
log1p-def34.3%
Simplified34.3%
Taylor expanded in x around inf 29.2%
sub-neg29.2%
+-commutative29.2%
associate-+l+29.2%
associate-*r/29.2%
metadata-eval29.2%
associate-*r/29.2%
metadata-eval29.2%
distribute-neg-frac29.2%
metadata-eval29.2%
unpow229.2%
Simplified29.2%
Taylor expanded in x around 0 79.7%
if 1.35e-219 < n < 5e20 or 3.2999999999999997e284 < n Initial program 80.1%
Taylor expanded in x around 0 77.5%
if 5e20 < n < 3.2999999999999997e284Initial program 24.0%
Taylor expanded in n around inf 83.3%
+-rgt-identity83.3%
+-rgt-identity83.3%
log1p-def83.3%
Simplified83.3%
Taylor expanded in x around 0 62.4%
Final simplification71.9%
(FPCore (x n)
:precision binary64
(if (<= x 1.5e-278)
(/ (- (log x)) n)
(if (<= x 1.4e-225)
(/ 1.0 (* n x))
(if (<= x 0.95)
(/ (- x (log x)) n)
(/ (- (/ 1.0 x) (/ 0.5 (* x x))) n)))))
double code(double x, double n) {
double tmp;
if (x <= 1.5e-278) {
tmp = -log(x) / n;
} else if (x <= 1.4e-225) {
tmp = 1.0 / (n * x);
} else if (x <= 0.95) {
tmp = (x - log(x)) / n;
} else {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 1.5d-278) then
tmp = -log(x) / n
else if (x <= 1.4d-225) then
tmp = 1.0d0 / (n * x)
else if (x <= 0.95d0) then
tmp = (x - log(x)) / n
else
tmp = ((1.0d0 / x) - (0.5d0 / (x * x))) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 1.5e-278) {
tmp = -Math.log(x) / n;
} else if (x <= 1.4e-225) {
tmp = 1.0 / (n * x);
} else if (x <= 0.95) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.5e-278: tmp = -math.log(x) / n elif x <= 1.4e-225: tmp = 1.0 / (n * x) elif x <= 0.95: tmp = (x - math.log(x)) / n else: tmp = ((1.0 / x) - (0.5 / (x * x))) / n return tmp
function code(x, n) tmp = 0.0 if (x <= 1.5e-278) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 1.4e-225) tmp = Float64(1.0 / Float64(n * x)); elseif (x <= 0.95) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / Float64(x * x))) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.5e-278) tmp = -log(x) / n; elseif (x <= 1.4e-225) tmp = 1.0 / (n * x); elseif (x <= 0.95) tmp = (x - log(x)) / n; else tmp = ((1.0 / x) - (0.5 / (x * x))) / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.5e-278], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 1.4e-225], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.95], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.5 \cdot 10^{-278}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{-225}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{elif}\;x \leq 0.95:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\
\end{array}
\end{array}
if x < 1.5e-278Initial program 45.3%
Taylor expanded in x around 0 45.3%
Taylor expanded in n around inf 59.6%
associate-*r/59.6%
mul-1-neg59.6%
Simplified59.6%
if 1.5e-278 < x < 1.4e-225Initial program 89.9%
Taylor expanded in n around inf 14.7%
+-rgt-identity14.7%
+-rgt-identity14.7%
log1p-def14.7%
Simplified14.7%
Taylor expanded in x around inf 59.6%
*-commutative59.6%
Simplified59.6%
if 1.4e-225 < x < 0.94999999999999996Initial program 44.2%
Taylor expanded in n around inf 51.6%
+-rgt-identity51.6%
+-rgt-identity51.6%
log1p-def51.6%
Simplified51.6%
Taylor expanded in x around 0 51.0%
if 0.94999999999999996 < x Initial program 67.2%
Taylor expanded in n around inf 66.5%
+-rgt-identity66.5%
+-rgt-identity66.5%
log1p-def66.5%
Simplified66.5%
Taylor expanded in x around inf 65.6%
associate-*r/65.6%
metadata-eval65.6%
unpow265.6%
Simplified65.6%
Final simplification57.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (- (log x)) n)))
(if (<= x 8.2e-279)
t_0
(if (<= x 2.6e-226)
(/ 1.0 (* n x))
(if (<= x 0.68) t_0 (/ (- (/ 1.0 x) (/ 0.5 (* x x))) n))))))
double code(double x, double n) {
double t_0 = -log(x) / n;
double tmp;
if (x <= 8.2e-279) {
tmp = t_0;
} else if (x <= 2.6e-226) {
tmp = 1.0 / (n * x);
} else if (x <= 0.68) {
tmp = t_0;
} else {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = -log(x) / n
if (x <= 8.2d-279) then
tmp = t_0
else if (x <= 2.6d-226) then
tmp = 1.0d0 / (n * x)
else if (x <= 0.68d0) then
tmp = t_0
else
tmp = ((1.0d0 / x) - (0.5d0 / (x * x))) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = -Math.log(x) / n;
double tmp;
if (x <= 8.2e-279) {
tmp = t_0;
} else if (x <= 2.6e-226) {
tmp = 1.0 / (n * x);
} else if (x <= 0.68) {
tmp = t_0;
} else {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
}
return tmp;
}
def code(x, n): t_0 = -math.log(x) / n tmp = 0 if x <= 8.2e-279: tmp = t_0 elif x <= 2.6e-226: tmp = 1.0 / (n * x) elif x <= 0.68: tmp = t_0 else: tmp = ((1.0 / x) - (0.5 / (x * x))) / n return tmp
function code(x, n) t_0 = Float64(Float64(-log(x)) / n) tmp = 0.0 if (x <= 8.2e-279) tmp = t_0; elseif (x <= 2.6e-226) tmp = Float64(1.0 / Float64(n * x)); elseif (x <= 0.68) tmp = t_0; else tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / Float64(x * x))) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = -log(x) / n; tmp = 0.0; if (x <= 8.2e-279) tmp = t_0; elseif (x <= 2.6e-226) tmp = 1.0 / (n * x); elseif (x <= 0.68) tmp = t_0; else tmp = ((1.0 / x) - (0.5 / (x * x))) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[x, 8.2e-279], t$95$0, If[LessEqual[x, 2.6e-226], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.68], t$95$0, N[(N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-\log x}{n}\\
\mathbf{if}\;x \leq 8.2 \cdot 10^{-279}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-226}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{elif}\;x \leq 0.68:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\
\end{array}
\end{array}
if x < 8.20000000000000034e-279 or 2.5999999999999998e-226 < x < 0.680000000000000049Initial program 44.3%
Taylor expanded in x around 0 43.6%
Taylor expanded in n around inf 51.6%
associate-*r/51.6%
mul-1-neg51.6%
Simplified51.6%
if 8.20000000000000034e-279 < x < 2.5999999999999998e-226Initial program 89.9%
Taylor expanded in n around inf 14.7%
+-rgt-identity14.7%
+-rgt-identity14.7%
log1p-def14.7%
Simplified14.7%
Taylor expanded in x around inf 59.6%
*-commutative59.6%
Simplified59.6%
if 0.680000000000000049 < x Initial program 67.2%
Taylor expanded in n around inf 66.5%
+-rgt-identity66.5%
+-rgt-identity66.5%
log1p-def66.5%
Simplified66.5%
Taylor expanded in x around inf 65.6%
associate-*r/65.6%
metadata-eval65.6%
unpow265.6%
Simplified65.6%
Final simplification57.3%
(FPCore (x n) :precision binary64 (* (/ 1.0 n) (/ 1.0 x)))
double code(double x, double n) {
return (1.0 / n) * (1.0 / x);
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = (1.0d0 / n) * (1.0d0 / x)
end function
public static double code(double x, double n) {
return (1.0 / n) * (1.0 / x);
}
def code(x, n): return (1.0 / n) * (1.0 / x)
function code(x, n) return Float64(Float64(1.0 / n) * Float64(1.0 / x)) end
function tmp = code(x, n) tmp = (1.0 / n) * (1.0 / x); end
code[x_, n_] := N[(N[(1.0 / n), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{n} \cdot \frac{1}{x}
\end{array}
Initial program 56.0%
Taylor expanded in n around inf 54.9%
+-rgt-identity54.9%
+-rgt-identity54.9%
log1p-def54.9%
Simplified54.9%
Taylor expanded in x around inf 41.7%
*-commutative41.7%
Simplified41.7%
inv-pow41.7%
unpow-prod-down41.9%
inv-pow41.9%
inv-pow41.9%
Applied egg-rr41.9%
Final simplification41.9%
(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 56.0%
Taylor expanded in n around inf 54.9%
+-rgt-identity54.9%
+-rgt-identity54.9%
log1p-def54.9%
Simplified54.9%
Taylor expanded in x around inf 41.7%
*-commutative41.7%
Simplified41.7%
Final simplification41.7%
(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 56.0%
Taylor expanded in n around inf 54.9%
+-rgt-identity54.9%
+-rgt-identity54.9%
log1p-def54.9%
Simplified54.9%
Taylor expanded in x around inf 41.9%
Final simplification41.9%
(FPCore (x n) :precision binary64 (/ x n))
double code(double x, double n) {
return x / n;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = x / n
end function
public static double code(double x, double n) {
return x / n;
}
def code(x, n): return x / n
function code(x, n) return Float64(x / n) end
function tmp = code(x, n) tmp = x / n; end
code[x_, n_] := N[(x / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{n}
\end{array}
Initial program 56.0%
Taylor expanded in n around inf 54.9%
+-rgt-identity54.9%
+-rgt-identity54.9%
log1p-def54.9%
Simplified54.9%
Taylor expanded in x around 0 31.7%
Taylor expanded in x around inf 4.8%
Final simplification4.8%
herbie shell --seed 2023283
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))