
(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 (log (+ 1.0 x))) (t_1 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -0.02)
(- (pow (+ 1.0 x) (/ 1.0 n)) (pow (cbrt t_1) 3.0))
(if (<= (/ 1.0 n) 1e-11)
(-
(+
(* 0.5 (/ (pow t_0 2.0) (pow n 2.0)))
(+
(* 0.041666666666666664 (/ (pow t_0 4.0) (pow n 4.0)))
(+
(/
(-
(* -0.16666666666666666 (pow (log x) 3.0))
(* -0.16666666666666666 (pow t_0 3.0)))
(pow n 3.0))
(/ (- t_0 (log x)) n))))
(+
(* 0.5 (/ (pow (log x) 2.0) (pow n 2.0)))
(* 0.041666666666666664 (/ (pow (log x) 4.0) (pow n 4.0)))))
(- (exp (/ (log1p x) n)) t_1)))))
double code(double x, double n) {
double t_0 = log((1.0 + x));
double t_1 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -0.02) {
tmp = pow((1.0 + x), (1.0 / n)) - pow(cbrt(t_1), 3.0);
} else if ((1.0 / n) <= 1e-11) {
tmp = ((0.5 * (pow(t_0, 2.0) / pow(n, 2.0))) + ((0.041666666666666664 * (pow(t_0, 4.0) / pow(n, 4.0))) + ((((-0.16666666666666666 * pow(log(x), 3.0)) - (-0.16666666666666666 * pow(t_0, 3.0))) / pow(n, 3.0)) + ((t_0 - log(x)) / n)))) - ((0.5 * (pow(log(x), 2.0) / pow(n, 2.0))) + (0.041666666666666664 * (pow(log(x), 4.0) / pow(n, 4.0))));
} else {
tmp = exp((log1p(x) / n)) - t_1;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.log((1.0 + x));
double t_1 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -0.02) {
tmp = Math.pow((1.0 + x), (1.0 / n)) - Math.pow(Math.cbrt(t_1), 3.0);
} else if ((1.0 / n) <= 1e-11) {
tmp = ((0.5 * (Math.pow(t_0, 2.0) / Math.pow(n, 2.0))) + ((0.041666666666666664 * (Math.pow(t_0, 4.0) / Math.pow(n, 4.0))) + ((((-0.16666666666666666 * Math.pow(Math.log(x), 3.0)) - (-0.16666666666666666 * Math.pow(t_0, 3.0))) / Math.pow(n, 3.0)) + ((t_0 - Math.log(x)) / n)))) - ((0.5 * (Math.pow(Math.log(x), 2.0) / Math.pow(n, 2.0))) + (0.041666666666666664 * (Math.pow(Math.log(x), 4.0) / Math.pow(n, 4.0))));
} else {
tmp = Math.exp((Math.log1p(x) / n)) - t_1;
}
return tmp;
}
function code(x, n) t_0 = log(Float64(1.0 + x)) t_1 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -0.02) tmp = Float64((Float64(1.0 + x) ^ Float64(1.0 / n)) - (cbrt(t_1) ^ 3.0)); elseif (Float64(1.0 / n) <= 1e-11) tmp = Float64(Float64(Float64(0.5 * Float64((t_0 ^ 2.0) / (n ^ 2.0))) + Float64(Float64(0.041666666666666664 * Float64((t_0 ^ 4.0) / (n ^ 4.0))) + Float64(Float64(Float64(Float64(-0.16666666666666666 * (log(x) ^ 3.0)) - Float64(-0.16666666666666666 * (t_0 ^ 3.0))) / (n ^ 3.0)) + Float64(Float64(t_0 - log(x)) / n)))) - Float64(Float64(0.5 * Float64((log(x) ^ 2.0) / (n ^ 2.0))) + Float64(0.041666666666666664 * Float64((log(x) ^ 4.0) / (n ^ 4.0))))); else tmp = Float64(exp(Float64(log1p(x) / n)) - t_1); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Log[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -0.02], N[(N[Power[N[(1.0 + x), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[N[Power[t$95$1, 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-11], N[(N[(N[(0.5 * N[(N[Power[t$95$0, 2.0], $MachinePrecision] / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.041666666666666664 * N[(N[Power[t$95$0, 4.0], $MachinePrecision] / N[Power[n, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(-0.16666666666666666 * N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] - N[(-0.16666666666666666 * N[Power[t$95$0, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[n, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$0 - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(0.5 * N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.041666666666666664 * N[(N[Power[N[Log[x], $MachinePrecision], 4.0], $MachinePrecision] / N[Power[n, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(1 + x\right)\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -0.02:\\
\;\;\;\;{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {\left(\sqrt[3]{t_1}\right)}^{3}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-11}:\\
\;\;\;\;\left(0.5 \cdot \frac{{t_0}^{2}}{{n}^{2}} + \left(0.041666666666666664 \cdot \frac{{t_0}^{4}}{{n}^{4}} + \left(\frac{-0.16666666666666666 \cdot {\log x}^{3} - -0.16666666666666666 \cdot {t_0}^{3}}{{n}^{3}} + \frac{t_0 - \log x}{n}\right)\right)\right) - \left(0.5 \cdot \frac{{\log x}^{2}}{{n}^{2}} + 0.041666666666666664 \cdot \frac{{\log x}^{4}}{{n}^{4}}\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t_1\\
\end{array}
\end{array}
if (/.f64 1 n) < -0.0200000000000000004Initial program 100.0%
add-sqr-sqrt100.0%
unpow-prod-down100.0%
inv-pow100.0%
inv-pow100.0%
Applied egg-rr100.0%
add-cube-cbrt100.0%
pow3100.0%
pow-prod-down100.0%
add-sqr-sqrt100.0%
inv-pow100.0%
Applied egg-rr100.0%
if -0.0200000000000000004 < (/.f64 1 n) < 9.99999999999999939e-12Initial program 30.6%
Taylor expanded in n around -inf 80.1%
if 9.99999999999999939e-12 < (/.f64 1 n) Initial program 43.3%
Taylor expanded in n around 0 43.2%
log1p-def86.1%
*-rgt-identity86.1%
associate-*r/86.0%
unpow-186.0%
exp-to-pow86.0%
/-rgt-identity86.0%
metadata-eval86.0%
associate-/l*86.0%
*-commutative86.0%
*-commutative86.0%
associate-/l*86.0%
metadata-eval86.0%
/-rgt-identity86.0%
unpow-186.0%
Simplified86.0%
Final simplification86.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -0.02)
(- (pow (+ 1.0 x) (/ 1.0 n)) (pow (cbrt t_0) 3.0))
(if (<= (/ 1.0 n) 1e-11)
(+
(+
(fma 0.5 (/ (pow (log1p x) 2.0) (* n n)) (/ (- (log1p x) (log x)) n))
(/
(* 0.16666666666666666 (- (pow (log1p x) 3.0) (pow (log x) 3.0)))
(pow n 3.0)))
(* (/ (pow (log x) 2.0) (* n n)) -0.5))
(- (exp (/ (log1p x) n)) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -0.02) {
tmp = pow((1.0 + x), (1.0 / n)) - pow(cbrt(t_0), 3.0);
} else if ((1.0 / n) <= 1e-11) {
tmp = (fma(0.5, (pow(log1p(x), 2.0) / (n * n)), ((log1p(x) - log(x)) / n)) + ((0.16666666666666666 * (pow(log1p(x), 3.0) - pow(log(x), 3.0))) / pow(n, 3.0))) + ((pow(log(x), 2.0) / (n * n)) * -0.5);
} else {
tmp = exp((log1p(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) <= -0.02) tmp = Float64((Float64(1.0 + x) ^ Float64(1.0 / n)) - (cbrt(t_0) ^ 3.0)); elseif (Float64(1.0 / n) <= 1e-11) tmp = Float64(Float64(fma(0.5, Float64((log1p(x) ^ 2.0) / Float64(n * n)), Float64(Float64(log1p(x) - log(x)) / n)) + Float64(Float64(0.16666666666666666 * Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0))) / (n ^ 3.0))) + Float64(Float64((log(x) ^ 2.0) / Float64(n * n)) * -0.5)); else tmp = Float64(exp(Float64(log1p(x) / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -0.02], N[(N[Power[N[(1.0 + x), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[N[Power[t$95$0, 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-11], N[(N[(N[(0.5 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] + 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]), $MachinePrecision] + N[(N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -0.02:\\
\;\;\;\;{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {\left(\sqrt[3]{t_0}\right)}^{3}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-11}:\\
\;\;\;\;\left(\mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\mathsf{log1p}\left(x\right) - \log x}{n}\right) + \frac{0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right)}{{n}^{3}}\right) + \frac{{\log x}^{2}}{n \cdot n} \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -0.0200000000000000004Initial program 100.0%
add-sqr-sqrt100.0%
unpow-prod-down100.0%
inv-pow100.0%
inv-pow100.0%
Applied egg-rr100.0%
add-cube-cbrt100.0%
pow3100.0%
pow-prod-down100.0%
add-sqr-sqrt100.0%
inv-pow100.0%
Applied egg-rr100.0%
if -0.0200000000000000004 < (/.f64 1 n) < 9.99999999999999939e-12Initial program 30.6%
Taylor expanded in n around -inf 80.1%
sub-neg80.1%
Simplified80.1%
if 9.99999999999999939e-12 < (/.f64 1 n) Initial program 43.3%
Taylor expanded in n around 0 43.2%
log1p-def86.1%
*-rgt-identity86.1%
associate-*r/86.0%
unpow-186.0%
exp-to-pow86.0%
/-rgt-identity86.0%
metadata-eval86.0%
associate-/l*86.0%
*-commutative86.0%
*-commutative86.0%
associate-/l*86.0%
metadata-eval86.0%
/-rgt-identity86.0%
unpow-186.0%
Simplified86.0%
Final simplification86.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-7)
(- (pow (+ 1.0 x) (/ 1.0 n)) (pow (cbrt t_0) 3.0))
(if (<= (/ 1.0 n) 1e-11)
(+
(fma 0.5 (/ (pow (log1p x) 2.0) (* n n)) (/ (- (log1p x) (log x)) n))
(* (/ (pow (log x) 2.0) (* n n)) -0.5))
(- (exp (/ (log1p x) n)) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-7) {
tmp = pow((1.0 + x), (1.0 / n)) - pow(cbrt(t_0), 3.0);
} else if ((1.0 / n) <= 1e-11) {
tmp = fma(0.5, (pow(log1p(x), 2.0) / (n * n)), ((log1p(x) - log(x)) / n)) + ((pow(log(x), 2.0) / (n * n)) * -0.5);
} else {
tmp = exp((log1p(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) <= -1e-7) tmp = Float64((Float64(1.0 + x) ^ Float64(1.0 / n)) - (cbrt(t_0) ^ 3.0)); elseif (Float64(1.0 / n) <= 1e-11) tmp = Float64(fma(0.5, Float64((log1p(x) ^ 2.0) / Float64(n * n)), Float64(Float64(log1p(x) - log(x)) / n)) + Float64(Float64((log(x) ^ 2.0) / Float64(n * n)) * -0.5)); else tmp = Float64(exp(Float64(log1p(x) / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-7], N[(N[Power[N[(1.0 + x), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[N[Power[t$95$0, 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-11], N[(N[(0.5 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-7}:\\
\;\;\;\;{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {\left(\sqrt[3]{t_0}\right)}^{3}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-11}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, \frac{\mathsf{log1p}\left(x\right) - \log x}{n}\right) + \frac{{\log x}^{2}}{n \cdot n} \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -9.9999999999999995e-8Initial program 99.7%
add-sqr-sqrt99.7%
unpow-prod-down99.7%
inv-pow99.7%
inv-pow99.7%
Applied egg-rr99.7%
add-cube-cbrt99.7%
pow399.7%
pow-prod-down99.8%
add-sqr-sqrt99.8%
inv-pow99.8%
Applied egg-rr99.8%
if -9.9999999999999995e-8 < (/.f64 1 n) < 9.99999999999999939e-12Initial program 30.2%
Taylor expanded in n around inf 80.0%
associate--r+72.2%
sub-neg72.2%
Simplified80.0%
if 9.99999999999999939e-12 < (/.f64 1 n) Initial program 43.3%
Taylor expanded in n around 0 43.2%
log1p-def86.1%
*-rgt-identity86.1%
associate-*r/86.0%
unpow-186.0%
exp-to-pow86.0%
/-rgt-identity86.0%
metadata-eval86.0%
associate-/l*86.0%
*-commutative86.0%
*-commutative86.0%
associate-/l*86.0%
metadata-eval86.0%
/-rgt-identity86.0%
unpow-186.0%
Simplified86.0%
Final simplification86.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-7)
(- (pow (+ 1.0 x) (/ 1.0 n)) (pow (cbrt t_0) 3.0))
(if (<= (/ 1.0 n) 1e-11)
(/ (log (/ (+ 1.0 x) x)) n)
(- (exp (/ (log1p x) n)) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-7) {
tmp = pow((1.0 + x), (1.0 / n)) - pow(cbrt(t_0), 3.0);
} else if ((1.0 / n) <= 1e-11) {
tmp = log(((1.0 + x) / x)) / n;
} else {
tmp = exp((log1p(x) / n)) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-7) {
tmp = Math.pow((1.0 + x), (1.0 / n)) - Math.pow(Math.cbrt(t_0), 3.0);
} else if ((1.0 / n) <= 1e-11) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - t_0;
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-7) tmp = Float64((Float64(1.0 + x) ^ Float64(1.0 / n)) - (cbrt(t_0) ^ 3.0)); elseif (Float64(1.0 / n) <= 1e-11) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); else tmp = Float64(exp(Float64(log1p(x) / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-7], N[(N[Power[N[(1.0 + x), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[N[Power[t$95$0, 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-11], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-7}:\\
\;\;\;\;{\left(1 + x\right)}^{\left(\frac{1}{n}\right)} - {\left(\sqrt[3]{t_0}\right)}^{3}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-11}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -9.9999999999999995e-8Initial program 99.7%
add-sqr-sqrt99.7%
unpow-prod-down99.7%
inv-pow99.7%
inv-pow99.7%
Applied egg-rr99.7%
add-cube-cbrt99.7%
pow399.7%
pow-prod-down99.8%
add-sqr-sqrt99.8%
inv-pow99.8%
Applied egg-rr99.8%
if -9.9999999999999995e-8 < (/.f64 1 n) < 9.99999999999999939e-12Initial program 30.2%
Taylor expanded in n around inf 79.1%
log1p-def79.1%
Simplified79.1%
log1p-udef79.1%
+-commutative79.1%
diff-log79.4%
Applied egg-rr79.4%
if 9.99999999999999939e-12 < (/.f64 1 n) Initial program 43.3%
Taylor expanded in n around 0 43.2%
log1p-def86.1%
*-rgt-identity86.1%
associate-*r/86.0%
unpow-186.0%
exp-to-pow86.0%
/-rgt-identity86.0%
metadata-eval86.0%
associate-/l*86.0%
*-commutative86.0%
*-commutative86.0%
associate-/l*86.0%
metadata-eval86.0%
/-rgt-identity86.0%
unpow-186.0%
Simplified86.0%
Final simplification86.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-7)
(- (exp (/ x n)) t_0)
(if (<= (/ 1.0 n) 1e-11)
(/ (log (/ (+ 1.0 x) x)) n)
(- (exp (/ (log1p x) n)) t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-7) {
tmp = exp((x / n)) - t_0;
} else if ((1.0 / n) <= 1e-11) {
tmp = log(((1.0 + x) / x)) / n;
} else {
tmp = exp((log1p(x) / n)) - t_0;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-7) {
tmp = Math.exp((x / n)) - t_0;
} else if ((1.0 / n) <= 1e-11) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-7: tmp = math.exp((x / n)) - t_0 elif (1.0 / n) <= 1e-11: tmp = math.log(((1.0 + x) / x)) / n else: tmp = math.exp((math.log1p(x) / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-7) tmp = Float64(exp(Float64(x / n)) - t_0); elseif (Float64(1.0 / n) <= 1e-11) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); else tmp = Float64(exp(Float64(log1p(x) / n)) - t_0); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-7], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-11], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-7}:\\
\;\;\;\;e^{\frac{x}{n}} - t_0\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-11}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -9.9999999999999995e-8Initial program 99.7%
Taylor expanded in n around 0 99.7%
log1p-def99.7%
*-rgt-identity99.7%
associate-*r/99.7%
unpow-199.7%
exp-to-pow99.7%
/-rgt-identity99.7%
metadata-eval99.7%
associate-/l*99.7%
*-commutative99.7%
*-commutative99.7%
associate-/l*99.7%
metadata-eval99.7%
/-rgt-identity99.7%
unpow-199.7%
Simplified99.7%
Taylor expanded in x around 0 99.7%
if -9.9999999999999995e-8 < (/.f64 1 n) < 9.99999999999999939e-12Initial program 30.2%
Taylor expanded in n around inf 79.1%
log1p-def79.1%
Simplified79.1%
log1p-udef79.1%
+-commutative79.1%
diff-log79.4%
Applied egg-rr79.4%
if 9.99999999999999939e-12 < (/.f64 1 n) Initial program 43.3%
Taylor expanded in n around 0 43.2%
log1p-def86.1%
*-rgt-identity86.1%
associate-*r/86.0%
unpow-186.0%
exp-to-pow86.0%
/-rgt-identity86.0%
metadata-eval86.0%
associate-/l*86.0%
*-commutative86.0%
*-commutative86.0%
associate-/l*86.0%
metadata-eval86.0%
/-rgt-identity86.0%
unpow-186.0%
Simplified86.0%
Final simplification86.0%
(FPCore (x n) :precision binary64 (if (or (<= (/ 1.0 n) -1e-7) (not (<= (/ 1.0 n) 4e-5))) (- (exp (/ x n)) (pow x (/ 1.0 n))) (/ (log (/ (+ 1.0 x) x)) n)))
double code(double x, double n) {
double tmp;
if (((1.0 / n) <= -1e-7) || !((1.0 / n) <= 4e-5)) {
tmp = exp((x / n)) - pow(x, (1.0 / n));
} else {
tmp = log(((1.0 + 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 (((1.0d0 / n) <= (-1d-7)) .or. (.not. ((1.0d0 / n) <= 4d-5))) then
tmp = exp((x / n)) - (x ** (1.0d0 / n))
else
tmp = log(((1.0d0 + x) / x)) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (((1.0 / n) <= -1e-7) || !((1.0 / n) <= 4e-5)) {
tmp = Math.exp((x / n)) - Math.pow(x, (1.0 / n));
} else {
tmp = Math.log(((1.0 + x) / x)) / n;
}
return tmp;
}
def code(x, n): tmp = 0 if ((1.0 / n) <= -1e-7) or not ((1.0 / n) <= 4e-5): tmp = math.exp((x / n)) - math.pow(x, (1.0 / n)) else: tmp = math.log(((1.0 + x) / x)) / n return tmp
function code(x, n) tmp = 0.0 if ((Float64(1.0 / n) <= -1e-7) || !(Float64(1.0 / n) <= 4e-5)) tmp = Float64(exp(Float64(x / n)) - (x ^ Float64(1.0 / n))); else tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (((1.0 / n) <= -1e-7) || ~(((1.0 / n) <= 4e-5))) tmp = exp((x / n)) - (x ^ (1.0 / n)); else tmp = log(((1.0 + x) / x)) / n; end tmp_2 = tmp; end
code[x_, n_] := If[Or[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-7], N[Not[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-5]], $MachinePrecision]], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-7} \lor \neg \left(\frac{1}{n} \leq 4 \cdot 10^{-5}\right):\\
\;\;\;\;e^{\frac{x}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\end{array}
\end{array}
if (/.f64 1 n) < -9.9999999999999995e-8 or 4.00000000000000033e-5 < (/.f64 1 n) Initial program 78.3%
Taylor expanded in n around 0 78.2%
log1p-def96.4%
*-rgt-identity96.4%
associate-*r/96.4%
unpow-196.4%
exp-to-pow96.4%
/-rgt-identity96.4%
metadata-eval96.4%
associate-/l*96.4%
*-commutative96.4%
*-commutative96.4%
associate-/l*96.4%
metadata-eval96.4%
/-rgt-identity96.4%
unpow-196.4%
Simplified96.4%
Taylor expanded in x around 0 96.2%
if -9.9999999999999995e-8 < (/.f64 1 n) < 4.00000000000000033e-5Initial program 29.7%
Taylor expanded in n around inf 77.6%
log1p-def77.6%
Simplified77.6%
log1p-udef77.6%
+-commutative77.6%
diff-log77.8%
Applied egg-rr77.8%
Final simplification85.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ 1.0 (* n x))))
(if (<= (/ 1.0 n) -10000.0)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 4e-5)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 2e+91)
(- (+ 1.0 (/ x n)) t_0)
(cbrt (* t_1 (/ t_1 (* n x)))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = 1.0 / (n * x);
double tmp;
if ((1.0 / n) <= -10000.0) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 4e-5) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 2e+91) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = cbrt((t_1 * (t_1 / (n * x))));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = 1.0 / (n * x);
double tmp;
if ((1.0 / n) <= -10000.0) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 4e-5) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 2e+91) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = Math.cbrt((t_1 * (t_1 / (n * x))));
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(1.0 / Float64(n * x)) tmp = 0.0 if (Float64(1.0 / n) <= -10000.0) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 4e-5) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (Float64(1.0 / n) <= 2e+91) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = cbrt(Float64(t_1 * Float64(t_1 / Float64(n * x)))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -10000.0], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-5], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+91], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[Power[N[(t$95$1 * N[(t$95$1 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{1}{n \cdot x}\\
\mathbf{if}\;\frac{1}{n} \leq -10000:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-5}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+91}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{t_1 \cdot \frac{t_1}{n \cdot x}}\\
\end{array}
\end{array}
if (/.f64 1 n) < -1e4Initial program 100.0%
Taylor expanded in x around inf 100.0%
log-rec100.0%
mul-1-neg100.0%
mul-1-neg100.0%
distribute-frac-neg100.0%
neg-mul-1100.0%
remove-double-neg100.0%
*-rgt-identity100.0%
associate-*r/100.0%
unpow-1100.0%
exp-to-pow100.0%
unpow-1100.0%
*-commutative100.0%
Simplified100.0%
if -1e4 < (/.f64 1 n) < 4.00000000000000033e-5Initial program 30.5%
Taylor expanded in n around inf 76.9%
log1p-def76.9%
Simplified76.9%
log1p-udef76.9%
+-commutative76.9%
diff-log77.1%
Applied egg-rr77.1%
if 4.00000000000000033e-5 < (/.f64 1 n) < 2.00000000000000016e91Initial program 74.0%
Taylor expanded in x around 0 72.8%
if 2.00000000000000016e91 < (/.f64 1 n) Initial program 27.2%
Taylor expanded in n around inf 10.1%
log1p-def10.1%
Simplified10.1%
Taylor expanded in x around inf 57.6%
*-commutative57.6%
Simplified57.6%
add-cbrt-cube75.0%
Applied egg-rr75.0%
associate-*r/75.0%
*-rgt-identity75.0%
associate-*r/75.0%
Simplified75.0%
Final simplification82.5%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -10000.0)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 4e-5)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 2e+204)
(- (+ 1.0 (/ x n)) t_0)
(/ 0.3333333333333333 (* n (pow x 3.0))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -10000.0) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 4e-5) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 2e+204) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 0.3333333333333333 / (n * pow(x, 3.0));
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-10000.0d0)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 4d-5) then
tmp = log(((1.0d0 + x) / x)) / n
else if ((1.0d0 / n) <= 2d+204) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = 0.3333333333333333d0 / (n * (x ** 3.0d0))
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) <= -10000.0) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 4e-5) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 2e+204) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 0.3333333333333333 / (n * Math.pow(x, 3.0));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -10000.0: tmp = t_0 / (n * x) elif (1.0 / n) <= 4e-5: tmp = math.log(((1.0 + x) / x)) / n elif (1.0 / n) <= 2e+204: tmp = (1.0 + (x / n)) - t_0 else: tmp = 0.3333333333333333 / (n * math.pow(x, 3.0)) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -10000.0) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 4e-5) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (Float64(1.0 / n) <= 2e+204) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(0.3333333333333333 / Float64(n * (x ^ 3.0))); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -10000.0) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 4e-5) tmp = log(((1.0 + x) / x)) / n; elseif ((1.0 / n) <= 2e+204) tmp = (1.0 + (x / n)) - t_0; else tmp = 0.3333333333333333 / (n * (x ^ 3.0)); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -10000.0], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-5], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+204], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(0.3333333333333333 / N[(n * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -10000:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-5}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+204}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{0.3333333333333333}{n \cdot {x}^{3}}\\
\end{array}
\end{array}
if (/.f64 1 n) < -1e4Initial program 100.0%
Taylor expanded in x around inf 100.0%
log-rec100.0%
mul-1-neg100.0%
mul-1-neg100.0%
distribute-frac-neg100.0%
neg-mul-1100.0%
remove-double-neg100.0%
*-rgt-identity100.0%
associate-*r/100.0%
unpow-1100.0%
exp-to-pow100.0%
unpow-1100.0%
*-commutative100.0%
Simplified100.0%
if -1e4 < (/.f64 1 n) < 4.00000000000000033e-5Initial program 30.5%
Taylor expanded in n around inf 76.9%
log1p-def76.9%
Simplified76.9%
log1p-udef76.9%
+-commutative76.9%
diff-log77.1%
Applied egg-rr77.1%
if 4.00000000000000033e-5 < (/.f64 1 n) < 1.99999999999999998e204Initial program 69.8%
Taylor expanded in x around 0 62.7%
if 1.99999999999999998e204 < (/.f64 1 n) Initial program 13.3%
Taylor expanded in n around inf 12.4%
log1p-def12.4%
Simplified12.4%
Taylor expanded in x around inf 26.3%
associate--l+26.3%
associate-*r/26.3%
metadata-eval26.3%
associate-*r/26.3%
metadata-eval26.3%
unpow226.3%
Simplified26.3%
Taylor expanded in x around 0 79.7%
*-commutative79.7%
Simplified79.7%
Final simplification81.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ 0.3333333333333333 (* n (pow x 3.0)))))
(if (<= (/ 1.0 n) -10000.0)
t_0
(if (<= (/ 1.0 n) 4e-5)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 2e+91) (- 1.0 (pow x (/ 1.0 n))) t_0)))))
double code(double x, double n) {
double t_0 = 0.3333333333333333 / (n * pow(x, 3.0));
double tmp;
if ((1.0 / n) <= -10000.0) {
tmp = t_0;
} else if ((1.0 / n) <= 4e-5) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 2e+91) {
tmp = 1.0 - 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) :: tmp
t_0 = 0.3333333333333333d0 / (n * (x ** 3.0d0))
if ((1.0d0 / n) <= (-10000.0d0)) then
tmp = t_0
else if ((1.0d0 / n) <= 4d-5) then
tmp = log(((1.0d0 + x) / x)) / n
else if ((1.0d0 / n) <= 2d+91) then
tmp = 1.0d0 - (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 = 0.3333333333333333 / (n * Math.pow(x, 3.0));
double tmp;
if ((1.0 / n) <= -10000.0) {
tmp = t_0;
} else if ((1.0 / n) <= 4e-5) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 2e+91) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = 0.3333333333333333 / (n * math.pow(x, 3.0)) tmp = 0 if (1.0 / n) <= -10000.0: tmp = t_0 elif (1.0 / n) <= 4e-5: tmp = math.log(((1.0 + x) / x)) / n elif (1.0 / n) <= 2e+91: tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = t_0 return tmp
function code(x, n) t_0 = Float64(0.3333333333333333 / Float64(n * (x ^ 3.0))) tmp = 0.0 if (Float64(1.0 / n) <= -10000.0) tmp = t_0; elseif (Float64(1.0 / n) <= 4e-5) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (Float64(1.0 / n) <= 2e+91) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, n) t_0 = 0.3333333333333333 / (n * (x ^ 3.0)); tmp = 0.0; if ((1.0 / n) <= -10000.0) tmp = t_0; elseif ((1.0 / n) <= 4e-5) tmp = log(((1.0 + x) / x)) / n; elseif ((1.0 / n) <= 2e+91) tmp = 1.0 - (x ^ (1.0 / n)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(0.3333333333333333 / N[(n * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -10000.0], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-5], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+91], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{0.3333333333333333}{n \cdot {x}^{3}}\\
\mathbf{if}\;\frac{1}{n} \leq -10000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-5}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+91}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -1e4 or 2.00000000000000016e91 < (/.f64 1 n) Initial program 78.9%
Taylor expanded in n around inf 40.1%
log1p-def40.1%
Simplified40.1%
Taylor expanded in x around inf 27.4%
associate--l+27.4%
associate-*r/27.4%
metadata-eval27.4%
associate-*r/27.4%
metadata-eval27.4%
unpow227.4%
Simplified27.4%
Taylor expanded in x around 0 77.3%
*-commutative77.3%
Simplified77.3%
if -1e4 < (/.f64 1 n) < 4.00000000000000033e-5Initial program 30.5%
Taylor expanded in n around inf 76.9%
log1p-def76.9%
Simplified76.9%
log1p-udef76.9%
+-commutative76.9%
diff-log77.1%
Applied egg-rr77.1%
if 4.00000000000000033e-5 < (/.f64 1 n) < 2.00000000000000016e91Initial program 74.0%
Taylor expanded in x around 0 72.2%
*-rgt-identity72.2%
associate-*r/72.2%
unpow-172.2%
exp-to-pow72.2%
unpow-172.2%
Simplified72.2%
Final simplification76.8%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -10000.0)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 4e-5)
(/ (log (/ (+ 1.0 x) x)) n)
(if (<= (/ 1.0 n) 2e+91)
(- 1.0 t_0)
(/ 0.3333333333333333 (* n (pow x 3.0))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -10000.0) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 4e-5) {
tmp = log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 2e+91) {
tmp = 1.0 - t_0;
} else {
tmp = 0.3333333333333333 / (n * pow(x, 3.0));
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-10000.0d0)) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 4d-5) then
tmp = log(((1.0d0 + x) / x)) / n
else if ((1.0d0 / n) <= 2d+91) then
tmp = 1.0d0 - t_0
else
tmp = 0.3333333333333333d0 / (n * (x ** 3.0d0))
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) <= -10000.0) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 4e-5) {
tmp = Math.log(((1.0 + x) / x)) / n;
} else if ((1.0 / n) <= 2e+91) {
tmp = 1.0 - t_0;
} else {
tmp = 0.3333333333333333 / (n * Math.pow(x, 3.0));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -10000.0: tmp = t_0 / (n * x) elif (1.0 / n) <= 4e-5: tmp = math.log(((1.0 + x) / x)) / n elif (1.0 / n) <= 2e+91: tmp = 1.0 - t_0 else: tmp = 0.3333333333333333 / (n * math.pow(x, 3.0)) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -10000.0) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 4e-5) tmp = Float64(log(Float64(Float64(1.0 + x) / x)) / n); elseif (Float64(1.0 / n) <= 2e+91) tmp = Float64(1.0 - t_0); else tmp = Float64(0.3333333333333333 / Float64(n * (x ^ 3.0))); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -10000.0) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 4e-5) tmp = log(((1.0 + x) / x)) / n; elseif ((1.0 / n) <= 2e+91) tmp = 1.0 - t_0; else tmp = 0.3333333333333333 / (n * (x ^ 3.0)); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -10000.0], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-5], N[(N[Log[N[(N[(1.0 + x), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e+91], N[(1.0 - t$95$0), $MachinePrecision], N[(0.3333333333333333 / N[(n * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -10000:\\
\;\;\;\;\frac{t_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-5}:\\
\;\;\;\;\frac{\log \left(\frac{1 + x}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{+91}:\\
\;\;\;\;1 - t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{0.3333333333333333}{n \cdot {x}^{3}}\\
\end{array}
\end{array}
if (/.f64 1 n) < -1e4Initial program 100.0%
Taylor expanded in x around inf 100.0%
log-rec100.0%
mul-1-neg100.0%
mul-1-neg100.0%
distribute-frac-neg100.0%
neg-mul-1100.0%
remove-double-neg100.0%
*-rgt-identity100.0%
associate-*r/100.0%
unpow-1100.0%
exp-to-pow100.0%
unpow-1100.0%
*-commutative100.0%
Simplified100.0%
if -1e4 < (/.f64 1 n) < 4.00000000000000033e-5Initial program 30.5%
Taylor expanded in n around inf 76.9%
log1p-def76.9%
Simplified76.9%
log1p-udef76.9%
+-commutative76.9%
diff-log77.1%
Applied egg-rr77.1%
if 4.00000000000000033e-5 < (/.f64 1 n) < 2.00000000000000016e91Initial program 74.0%
Taylor expanded in x around 0 72.2%
*-rgt-identity72.2%
associate-*r/72.2%
unpow-172.2%
exp-to-pow72.2%
unpow-172.2%
Simplified72.2%
if 2.00000000000000016e91 < (/.f64 1 n) Initial program 27.2%
Taylor expanded in n around inf 10.1%
log1p-def10.1%
Simplified10.1%
Taylor expanded in x around inf 30.0%
associate--l+30.0%
associate-*r/30.0%
metadata-eval30.0%
associate-*r/30.0%
metadata-eval30.0%
unpow230.0%
Simplified30.0%
Taylor expanded in x around 0 67.9%
*-commutative67.9%
Simplified67.9%
Final simplification81.7%
(FPCore (x n)
:precision binary64
(if (<= x 1.8e-87)
(/ (- (log x)) n)
(if (<= x 1.75e-50)
(/ 0.3333333333333333 (* n (pow x 3.0)))
(if (<= x 0.96)
(* (/ 1.0 n) (- x (log x)))
(if (<= x 6.2e+82) (/ (- (/ 1.0 x) (/ 0.5 (* x x))) n) (/ 0.0 n))))))
double code(double x, double n) {
double tmp;
if (x <= 1.8e-87) {
tmp = -log(x) / n;
} else if (x <= 1.75e-50) {
tmp = 0.3333333333333333 / (n * pow(x, 3.0));
} else if (x <= 0.96) {
tmp = (1.0 / n) * (x - log(x));
} else if (x <= 6.2e+82) {
tmp = ((1.0 / x) - (0.5 / (x * 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.8d-87) then
tmp = -log(x) / n
else if (x <= 1.75d-50) then
tmp = 0.3333333333333333d0 / (n * (x ** 3.0d0))
else if (x <= 0.96d0) then
tmp = (1.0d0 / n) * (x - log(x))
else if (x <= 6.2d+82) then
tmp = ((1.0d0 / x) - (0.5d0 / (x * 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.8e-87) {
tmp = -Math.log(x) / n;
} else if (x <= 1.75e-50) {
tmp = 0.3333333333333333 / (n * Math.pow(x, 3.0));
} else if (x <= 0.96) {
tmp = (1.0 / n) * (x - Math.log(x));
} else if (x <= 6.2e+82) {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
} else {
tmp = 0.0 / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.8e-87: tmp = -math.log(x) / n elif x <= 1.75e-50: tmp = 0.3333333333333333 / (n * math.pow(x, 3.0)) elif x <= 0.96: tmp = (1.0 / n) * (x - math.log(x)) elif x <= 6.2e+82: tmp = ((1.0 / x) - (0.5 / (x * x))) / n else: tmp = 0.0 / n return tmp
function code(x, n) tmp = 0.0 if (x <= 1.8e-87) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 1.75e-50) tmp = Float64(0.3333333333333333 / Float64(n * (x ^ 3.0))); elseif (x <= 0.96) tmp = Float64(Float64(1.0 / n) * Float64(x - log(x))); elseif (x <= 6.2e+82) tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / Float64(x * x))) / n); else tmp = Float64(0.0 / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.8e-87) tmp = -log(x) / n; elseif (x <= 1.75e-50) tmp = 0.3333333333333333 / (n * (x ^ 3.0)); elseif (x <= 0.96) tmp = (1.0 / n) * (x - log(x)); elseif (x <= 6.2e+82) tmp = ((1.0 / x) - (0.5 / (x * x))) / n; else tmp = 0.0 / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.8e-87], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 1.75e-50], N[(0.3333333333333333 / N[(n * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.96], N[(N[(1.0 / n), $MachinePrecision] * N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6.2e+82], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(0.0 / n), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.8 \cdot 10^{-87}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{-50}:\\
\;\;\;\;\frac{0.3333333333333333}{n \cdot {x}^{3}}\\
\mathbf{elif}\;x \leq 0.96:\\
\;\;\;\;\frac{1}{n} \cdot \left(x - \log x\right)\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{+82}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{n}\\
\end{array}
\end{array}
if x < 1.79999999999999996e-87Initial program 36.9%
Taylor expanded in x around 0 36.8%
*-rgt-identity36.8%
associate-*r/36.8%
unpow-136.8%
exp-to-pow36.9%
unpow-136.9%
Simplified36.9%
Taylor expanded in n around inf 56.9%
neg-mul-156.9%
distribute-neg-frac56.9%
Simplified56.9%
if 1.79999999999999996e-87 < x < 1.74999999999999998e-50Initial program 67.8%
Taylor expanded in n around inf 14.0%
log1p-def14.0%
Simplified14.0%
Taylor expanded in x around inf 83.9%
associate--l+83.9%
associate-*r/83.9%
metadata-eval83.9%
associate-*r/83.9%
metadata-eval83.9%
unpow283.9%
Simplified83.9%
Taylor expanded in x around 0 83.9%
*-commutative83.9%
Simplified83.9%
if 1.74999999999999998e-50 < x < 0.95999999999999996Initial program 43.2%
Taylor expanded in n around inf 55.7%
log1p-def55.7%
Simplified55.7%
log1p-udef55.7%
+-commutative55.7%
diff-log55.7%
Applied egg-rr55.7%
div-inv55.9%
Applied egg-rr55.9%
Taylor expanded in x around 0 55.5%
mul-1-neg55.5%
unsub-neg55.5%
Simplified55.5%
if 0.95999999999999996 < x < 6.20000000000000065e82Initial program 40.2%
Taylor expanded in n around inf 40.2%
log1p-def40.2%
Simplified40.2%
Taylor expanded in x around inf 67.2%
associate-*r/67.2%
metadata-eval67.2%
unpow267.2%
Simplified67.2%
if 6.20000000000000065e82 < x Initial program 76.4%
Taylor expanded in n around inf 76.5%
log1p-def76.5%
Simplified76.5%
log1p-udef76.5%
+-commutative76.5%
diff-log76.5%
Applied egg-rr76.5%
Taylor expanded in x around inf 76.5%
Final simplification65.2%
(FPCore (x n)
:precision binary64
(if (<= x 1.75e-87)
(/ 1.0 (- 0.5 (/ n (log x))))
(if (<= x 1.55e-50)
(/ 0.3333333333333333 (* n (pow x 3.0)))
(if (<= x 0.96)
(* (/ 1.0 n) (- x (log x)))
(if (<= x 3.1e+88) (/ (- (/ 1.0 x) (/ 0.5 (* x x))) n) (/ 0.0 n))))))
double code(double x, double n) {
double tmp;
if (x <= 1.75e-87) {
tmp = 1.0 / (0.5 - (n / log(x)));
} else if (x <= 1.55e-50) {
tmp = 0.3333333333333333 / (n * pow(x, 3.0));
} else if (x <= 0.96) {
tmp = (1.0 / n) * (x - log(x));
} else if (x <= 3.1e+88) {
tmp = ((1.0 / x) - (0.5 / (x * 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.75d-87) then
tmp = 1.0d0 / (0.5d0 - (n / log(x)))
else if (x <= 1.55d-50) then
tmp = 0.3333333333333333d0 / (n * (x ** 3.0d0))
else if (x <= 0.96d0) then
tmp = (1.0d0 / n) * (x - log(x))
else if (x <= 3.1d+88) then
tmp = ((1.0d0 / x) - (0.5d0 / (x * 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.75e-87) {
tmp = 1.0 / (0.5 - (n / Math.log(x)));
} else if (x <= 1.55e-50) {
tmp = 0.3333333333333333 / (n * Math.pow(x, 3.0));
} else if (x <= 0.96) {
tmp = (1.0 / n) * (x - Math.log(x));
} else if (x <= 3.1e+88) {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
} else {
tmp = 0.0 / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.75e-87: tmp = 1.0 / (0.5 - (n / math.log(x))) elif x <= 1.55e-50: tmp = 0.3333333333333333 / (n * math.pow(x, 3.0)) elif x <= 0.96: tmp = (1.0 / n) * (x - math.log(x)) elif x <= 3.1e+88: tmp = ((1.0 / x) - (0.5 / (x * x))) / n else: tmp = 0.0 / n return tmp
function code(x, n) tmp = 0.0 if (x <= 1.75e-87) tmp = Float64(1.0 / Float64(0.5 - Float64(n / log(x)))); elseif (x <= 1.55e-50) tmp = Float64(0.3333333333333333 / Float64(n * (x ^ 3.0))); elseif (x <= 0.96) tmp = Float64(Float64(1.0 / n) * Float64(x - log(x))); elseif (x <= 3.1e+88) tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / Float64(x * x))) / n); else tmp = Float64(0.0 / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.75e-87) tmp = 1.0 / (0.5 - (n / log(x))); elseif (x <= 1.55e-50) tmp = 0.3333333333333333 / (n * (x ^ 3.0)); elseif (x <= 0.96) tmp = (1.0 / n) * (x - log(x)); elseif (x <= 3.1e+88) tmp = ((1.0 / x) - (0.5 / (x * x))) / n; else tmp = 0.0 / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.75e-87], N[(1.0 / N[(0.5 - N[(n / N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.55e-50], N[(0.3333333333333333 / N[(n * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.96], N[(N[(1.0 / n), $MachinePrecision] * N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.1e+88], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(0.0 / n), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.75 \cdot 10^{-87}:\\
\;\;\;\;\frac{1}{0.5 - \frac{n}{\log x}}\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{-50}:\\
\;\;\;\;\frac{0.3333333333333333}{n \cdot {x}^{3}}\\
\mathbf{elif}\;x \leq 0.96:\\
\;\;\;\;\frac{1}{n} \cdot \left(x - \log x\right)\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{+88}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{n}\\
\end{array}
\end{array}
if x < 1.75000000000000006e-87Initial program 36.9%
Taylor expanded in x around 0 36.8%
*-rgt-identity36.8%
associate-*r/36.8%
unpow-136.8%
exp-to-pow36.9%
unpow-136.9%
Simplified36.9%
flip--19.5%
clear-num19.5%
metadata-eval19.5%
inv-pow19.5%
inv-pow19.5%
pow-prod-down16.5%
pow216.5%
pow-unpow19.5%
inv-pow19.5%
un-div-inv19.5%
Applied egg-rr19.5%
Taylor expanded in n around inf 57.4%
mul-1-neg57.4%
unsub-neg57.4%
Simplified57.4%
if 1.75000000000000006e-87 < x < 1.5500000000000001e-50Initial program 67.8%
Taylor expanded in n around inf 14.0%
log1p-def14.0%
Simplified14.0%
Taylor expanded in x around inf 83.9%
associate--l+83.9%
associate-*r/83.9%
metadata-eval83.9%
associate-*r/83.9%
metadata-eval83.9%
unpow283.9%
Simplified83.9%
Taylor expanded in x around 0 83.9%
*-commutative83.9%
Simplified83.9%
if 1.5500000000000001e-50 < x < 0.95999999999999996Initial program 43.2%
Taylor expanded in n around inf 55.7%
log1p-def55.7%
Simplified55.7%
log1p-udef55.7%
+-commutative55.7%
diff-log55.7%
Applied egg-rr55.7%
div-inv55.9%
Applied egg-rr55.9%
Taylor expanded in x around 0 55.5%
mul-1-neg55.5%
unsub-neg55.5%
Simplified55.5%
if 0.95999999999999996 < x < 3.1000000000000001e88Initial program 40.2%
Taylor expanded in n around inf 40.2%
log1p-def40.2%
Simplified40.2%
Taylor expanded in x around inf 67.2%
associate-*r/67.2%
metadata-eval67.2%
unpow267.2%
Simplified67.2%
if 3.1000000000000001e88 < x Initial program 76.4%
Taylor expanded in n around inf 76.5%
log1p-def76.5%
Simplified76.5%
log1p-udef76.5%
+-commutative76.5%
diff-log76.5%
Applied egg-rr76.5%
Taylor expanded in x around inf 76.5%
Final simplification65.5%
(FPCore (x n)
:precision binary64
(if (<= x 1.1e-80)
(/ (- (log x)) n)
(if (<= x 3e-56)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 0.96)
(/ (- x (log x)) n)
(if (<= x 5.9e+88) (/ (- (/ 1.0 x) (/ 0.5 (* x x))) n) (/ 0.0 n))))))
double code(double x, double n) {
double tmp;
if (x <= 1.1e-80) {
tmp = -log(x) / n;
} else if (x <= 3e-56) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 0.96) {
tmp = (x - log(x)) / n;
} else if (x <= 5.9e+88) {
tmp = ((1.0 / x) - (0.5 / (x * 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.1d-80) then
tmp = -log(x) / n
else if (x <= 3d-56) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 0.96d0) then
tmp = (x - log(x)) / n
else if (x <= 5.9d+88) then
tmp = ((1.0d0 / x) - (0.5d0 / (x * 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.1e-80) {
tmp = -Math.log(x) / n;
} else if (x <= 3e-56) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 0.96) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 5.9e+88) {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
} else {
tmp = 0.0 / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.1e-80: tmp = -math.log(x) / n elif x <= 3e-56: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 0.96: tmp = (x - math.log(x)) / n elif x <= 5.9e+88: tmp = ((1.0 / x) - (0.5 / (x * x))) / n else: tmp = 0.0 / n return tmp
function code(x, n) tmp = 0.0 if (x <= 1.1e-80) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 3e-56) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 0.96) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 5.9e+88) tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / Float64(x * x))) / n); else tmp = Float64(0.0 / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.1e-80) tmp = -log(x) / n; elseif (x <= 3e-56) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 0.96) tmp = (x - log(x)) / n; elseif (x <= 5.9e+88) tmp = ((1.0 / x) - (0.5 / (x * x))) / n; else tmp = 0.0 / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.1e-80], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 3e-56], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.96], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 5.9e+88], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(0.0 / n), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.1 \cdot 10^{-80}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 3 \cdot 10^{-56}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 0.96:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 5.9 \cdot 10^{+88}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{n}\\
\end{array}
\end{array}
if x < 1.10000000000000005e-80Initial program 36.6%
Taylor expanded in x around 0 36.6%
*-rgt-identity36.6%
associate-*r/36.6%
unpow-136.6%
exp-to-pow36.6%
unpow-136.6%
Simplified36.6%
Taylor expanded in n around inf 56.5%
neg-mul-156.5%
distribute-neg-frac56.5%
Simplified56.5%
if 1.10000000000000005e-80 < x < 2.99999999999999989e-56Initial program 80.8%
Taylor expanded in x around 0 80.8%
*-rgt-identity80.8%
associate-*r/80.8%
unpow-180.8%
exp-to-pow80.8%
unpow-180.8%
Simplified80.8%
if 2.99999999999999989e-56 < x < 0.95999999999999996Initial program 40.7%
Taylor expanded in n around inf 52.6%
log1p-def52.6%
Simplified52.6%
Taylor expanded in x around 0 52.2%
neg-mul-152.2%
unsub-neg52.2%
Simplified52.2%
if 0.95999999999999996 < x < 5.89999999999999967e88Initial program 40.2%
Taylor expanded in n around inf 40.2%
log1p-def40.2%
Simplified40.2%
Taylor expanded in x around inf 67.2%
associate-*r/67.2%
metadata-eval67.2%
unpow267.2%
Simplified67.2%
if 5.89999999999999967e88 < x Initial program 76.4%
Taylor expanded in n around inf 76.5%
log1p-def76.5%
Simplified76.5%
log1p-udef76.5%
+-commutative76.5%
diff-log76.5%
Applied egg-rr76.5%
Taylor expanded in x around inf 76.5%
Final simplification64.5%
(FPCore (x n)
:precision binary64
(if (<= x 1.75e-87)
(/ (- (log x)) n)
(if (<= x 1.55e-50)
(/ 0.3333333333333333 (* n (pow x 3.0)))
(if (<= x 0.98)
(/ (- x (log x)) n)
(if (<= x 5.1e+88) (/ (- (/ 1.0 x) (/ 0.5 (* x x))) n) (/ 0.0 n))))))
double code(double x, double n) {
double tmp;
if (x <= 1.75e-87) {
tmp = -log(x) / n;
} else if (x <= 1.55e-50) {
tmp = 0.3333333333333333 / (n * pow(x, 3.0));
} else if (x <= 0.98) {
tmp = (x - log(x)) / n;
} else if (x <= 5.1e+88) {
tmp = ((1.0 / x) - (0.5 / (x * 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.75d-87) then
tmp = -log(x) / n
else if (x <= 1.55d-50) then
tmp = 0.3333333333333333d0 / (n * (x ** 3.0d0))
else if (x <= 0.98d0) then
tmp = (x - log(x)) / n
else if (x <= 5.1d+88) then
tmp = ((1.0d0 / x) - (0.5d0 / (x * 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.75e-87) {
tmp = -Math.log(x) / n;
} else if (x <= 1.55e-50) {
tmp = 0.3333333333333333 / (n * Math.pow(x, 3.0));
} else if (x <= 0.98) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 5.1e+88) {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
} else {
tmp = 0.0 / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.75e-87: tmp = -math.log(x) / n elif x <= 1.55e-50: tmp = 0.3333333333333333 / (n * math.pow(x, 3.0)) elif x <= 0.98: tmp = (x - math.log(x)) / n elif x <= 5.1e+88: tmp = ((1.0 / x) - (0.5 / (x * x))) / n else: tmp = 0.0 / n return tmp
function code(x, n) tmp = 0.0 if (x <= 1.75e-87) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 1.55e-50) tmp = Float64(0.3333333333333333 / Float64(n * (x ^ 3.0))); elseif (x <= 0.98) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 5.1e+88) tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / Float64(x * x))) / n); else tmp = Float64(0.0 / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.75e-87) tmp = -log(x) / n; elseif (x <= 1.55e-50) tmp = 0.3333333333333333 / (n * (x ^ 3.0)); elseif (x <= 0.98) tmp = (x - log(x)) / n; elseif (x <= 5.1e+88) tmp = ((1.0 / x) - (0.5 / (x * x))) / n; else tmp = 0.0 / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.75e-87], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 1.55e-50], N[(0.3333333333333333 / N[(n * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.98], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 5.1e+88], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(0.0 / n), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.75 \cdot 10^{-87}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{-50}:\\
\;\;\;\;\frac{0.3333333333333333}{n \cdot {x}^{3}}\\
\mathbf{elif}\;x \leq 0.98:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 5.1 \cdot 10^{+88}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{n}\\
\end{array}
\end{array}
if x < 1.75000000000000006e-87Initial program 36.9%
Taylor expanded in x around 0 36.8%
*-rgt-identity36.8%
associate-*r/36.8%
unpow-136.8%
exp-to-pow36.9%
unpow-136.9%
Simplified36.9%
Taylor expanded in n around inf 56.9%
neg-mul-156.9%
distribute-neg-frac56.9%
Simplified56.9%
if 1.75000000000000006e-87 < x < 1.5500000000000001e-50Initial program 67.8%
Taylor expanded in n around inf 14.0%
log1p-def14.0%
Simplified14.0%
Taylor expanded in x around inf 83.9%
associate--l+83.9%
associate-*r/83.9%
metadata-eval83.9%
associate-*r/83.9%
metadata-eval83.9%
unpow283.9%
Simplified83.9%
Taylor expanded in x around 0 83.9%
*-commutative83.9%
Simplified83.9%
if 1.5500000000000001e-50 < x < 0.97999999999999998Initial program 43.2%
Taylor expanded in n around inf 55.7%
log1p-def55.7%
Simplified55.7%
Taylor expanded in x around 0 55.2%
neg-mul-155.2%
unsub-neg55.2%
Simplified55.2%
if 0.97999999999999998 < x < 5.0999999999999997e88Initial program 40.2%
Taylor expanded in n around inf 40.2%
log1p-def40.2%
Simplified40.2%
Taylor expanded in x around inf 67.2%
associate-*r/67.2%
metadata-eval67.2%
unpow267.2%
Simplified67.2%
if 5.0999999999999997e88 < x Initial program 76.4%
Taylor expanded in n around inf 76.5%
log1p-def76.5%
Simplified76.5%
log1p-udef76.5%
+-commutative76.5%
diff-log76.5%
Applied egg-rr76.5%
Taylor expanded in x around inf 76.5%
Final simplification65.2%
(FPCore (x n) :precision binary64 (if (<= x 0.96) (/ (- x (log x)) n) (if (<= x 6.4e+88) (/ (- (/ 1.0 x) (/ 0.5 (* x x))) n) (/ 0.0 n))))
double code(double x, double n) {
double tmp;
if (x <= 0.96) {
tmp = (x - log(x)) / n;
} else if (x <= 6.4e+88) {
tmp = ((1.0 / x) - (0.5 / (x * 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.96d0) then
tmp = (x - log(x)) / n
else if (x <= 6.4d+88) then
tmp = ((1.0d0 / x) - (0.5d0 / (x * 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.96) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 6.4e+88) {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
} else {
tmp = 0.0 / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.96: tmp = (x - math.log(x)) / n elif x <= 6.4e+88: tmp = ((1.0 / x) - (0.5 / (x * x))) / n else: tmp = 0.0 / n return tmp
function code(x, n) tmp = 0.0 if (x <= 0.96) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 6.4e+88) tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / Float64(x * x))) / n); else tmp = Float64(0.0 / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.96) tmp = (x - log(x)) / n; elseif (x <= 6.4e+88) tmp = ((1.0 / x) - (0.5 / (x * x))) / n; else tmp = 0.0 / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.96], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 6.4e+88], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(0.0 / n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.96:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 6.4 \cdot 10^{+88}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{n}\\
\end{array}
\end{array}
if x < 0.95999999999999996Initial program 40.0%
Taylor expanded in n around inf 53.3%
log1p-def53.3%
Simplified53.3%
Taylor expanded in x around 0 53.2%
neg-mul-153.2%
unsub-neg53.2%
Simplified53.2%
if 0.95999999999999996 < x < 6.3999999999999997e88Initial program 40.2%
Taylor expanded in n around inf 40.2%
log1p-def40.2%
Simplified40.2%
Taylor expanded in x around inf 67.2%
associate-*r/67.2%
metadata-eval67.2%
unpow267.2%
Simplified67.2%
if 6.3999999999999997e88 < x Initial program 76.4%
Taylor expanded in n around inf 76.5%
log1p-def76.5%
Simplified76.5%
log1p-udef76.5%
+-commutative76.5%
diff-log76.5%
Applied egg-rr76.5%
Taylor expanded in x around inf 76.5%
Final simplification61.9%
(FPCore (x n) :precision binary64 (if (<= x 0.68) (/ (- (log x)) n) (if (<= x 6e+88) (/ (- (/ 1.0 x) (/ 0.5 (* x x))) n) (/ 0.0 n))))
double code(double x, double n) {
double tmp;
if (x <= 0.68) {
tmp = -log(x) / n;
} else if (x <= 6e+88) {
tmp = ((1.0 / x) - (0.5 / (x * 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.68d0) then
tmp = -log(x) / n
else if (x <= 6d+88) then
tmp = ((1.0d0 / x) - (0.5d0 / (x * 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.68) {
tmp = -Math.log(x) / n;
} else if (x <= 6e+88) {
tmp = ((1.0 / x) - (0.5 / (x * x))) / n;
} else {
tmp = 0.0 / n;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.68: tmp = -math.log(x) / n elif x <= 6e+88: tmp = ((1.0 / x) - (0.5 / (x * x))) / n else: tmp = 0.0 / n return tmp
function code(x, n) tmp = 0.0 if (x <= 0.68) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 6e+88) tmp = Float64(Float64(Float64(1.0 / x) - Float64(0.5 / Float64(x * x))) / n); else tmp = Float64(0.0 / n); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.68) tmp = -log(x) / n; elseif (x <= 6e+88) tmp = ((1.0 / x) - (0.5 / (x * x))) / n; else tmp = 0.0 / n; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.68], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 6e+88], N[(N[(N[(1.0 / x), $MachinePrecision] - N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(0.0 / n), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.68:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 6 \cdot 10^{+88}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{0.5}{x \cdot x}}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{n}\\
\end{array}
\end{array}
if x < 0.680000000000000049Initial program 40.0%
Taylor expanded in x around 0 38.7%
*-rgt-identity38.7%
associate-*r/38.7%
unpow-138.7%
exp-to-pow38.7%
unpow-138.7%
Simplified38.7%
Taylor expanded in n around inf 52.9%
neg-mul-152.9%
distribute-neg-frac52.9%
Simplified52.9%
if 0.680000000000000049 < x < 6.00000000000000011e88Initial program 40.2%
Taylor expanded in n around inf 40.2%
log1p-def40.2%
Simplified40.2%
Taylor expanded in x around inf 67.2%
associate-*r/67.2%
metadata-eval67.2%
unpow267.2%
Simplified67.2%
if 6.00000000000000011e88 < x Initial program 76.4%
Taylor expanded in n around inf 76.5%
log1p-def76.5%
Simplified76.5%
log1p-udef76.5%
+-commutative76.5%
diff-log76.5%
Applied egg-rr76.5%
Taylor expanded in x around inf 76.5%
Final simplification61.7%
(FPCore (x n) :precision binary64 (if (<= (/ 1.0 n) -10000000.0) (/ 0.0 n) (/ (/ 1.0 n) x)))
double code(double x, double n) {
double tmp;
if ((1.0 / n) <= -10000000.0) {
tmp = 0.0 / n;
} 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) :: tmp
if ((1.0d0 / n) <= (-10000000.0d0)) then
tmp = 0.0d0 / n
else
tmp = (1.0d0 / n) / x
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 / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if (1.0 / n) <= -10000000.0: tmp = 0.0 / n else: tmp = (1.0 / n) / x 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 / n) / x); 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 / n) / x; 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 / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{1}{n} \leq -10000000:\\
\;\;\;\;\frac{0}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\end{array}
\end{array}
if (/.f64 1 n) < -1e7Initial program 100.0%
Taylor expanded in n around inf 53.2%
log1p-def53.2%
Simplified53.2%
log1p-udef53.2%
+-commutative53.2%
diff-log53.2%
Applied egg-rr53.2%
Taylor expanded in x around inf 54.6%
if -1e7 < (/.f64 1 n) Initial program 34.5%
Taylor expanded in n around inf 60.7%
log1p-def60.7%
Simplified60.7%
log1p-udef60.7%
+-commutative60.7%
diff-log60.9%
Applied egg-rr60.9%
Taylor expanded in x around inf 43.0%
associate-/r*44.7%
Simplified44.7%
Final simplification47.2%
(FPCore (x n) :precision binary64 (/ 1.0 (* n x)))
double code(double x, double n) {
return 1.0 / (n * x);
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = 1.0d0 / (n * x)
end function
public static double code(double x, double n) {
return 1.0 / (n * x);
}
def code(x, n): return 1.0 / (n * x)
function code(x, n) return Float64(1.0 / Float64(n * x)) end
function tmp = code(x, n) tmp = 1.0 / (n * x); end
code[x_, n_] := N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{n \cdot x}
\end{array}
Initial program 51.1%
Taylor expanded in n around inf 58.8%
log1p-def58.8%
Simplified58.8%
Taylor expanded in x around inf 36.9%
*-commutative36.9%
Simplified36.9%
Final simplification36.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(Float64(1.0 / n) / x) end
function tmp = code(x, n) tmp = (1.0 / n) / x; end
code[x_, n_] := N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{n}}{x}
\end{array}
Initial program 51.1%
Taylor expanded in n around inf 58.8%
log1p-def58.8%
Simplified58.8%
log1p-udef58.8%
+-commutative58.8%
diff-log58.9%
Applied egg-rr58.9%
Taylor expanded in x around inf 36.9%
associate-/r*38.2%
Simplified38.2%
Final simplification38.2%
herbie shell --seed 2023199
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))