
(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 (pow x (/ 1.0 n)))
(t_1 (/ (- (log1p x) (log x)) n))
(t_2 (/ t_0 (* n x)))
(t_3 (+ t_2 (/ (/ (/ -0.5 n) x) x)))
(t_4 (/ t_0 x)))
(if (<= (/ 1.0 n) -1e-5)
t_2
(if (<= (/ 1.0 n) 4e-206)
t_1
(if (<= (/ 1.0 n) 5e-134)
(+ (* t_4 (/ (- (/ 0.5 (* n n)) (/ 0.5 n)) x)) (* (/ 1.0 n) t_4))
(if (<= (/ 1.0 n) 2e-114)
t_1
(if (<= (/ 1.0 n) 5e-73)
t_3
(if (<= (/ 1.0 n) 5e-51)
(/ (- (log x)) n)
(if (<= (/ 1.0 n) 1e-11) t_3 (- (exp (/ x n)) t_0))))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = (log1p(x) - log(x)) / n;
double t_2 = t_0 / (n * x);
double t_3 = t_2 + (((-0.5 / n) / x) / x);
double t_4 = t_0 / x;
double tmp;
if ((1.0 / n) <= -1e-5) {
tmp = t_2;
} else if ((1.0 / n) <= 4e-206) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-134) {
tmp = (t_4 * (((0.5 / (n * n)) - (0.5 / n)) / x)) + ((1.0 / n) * t_4);
} else if ((1.0 / n) <= 2e-114) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-73) {
tmp = t_3;
} else if ((1.0 / n) <= 5e-51) {
tmp = -log(x) / n;
} else if ((1.0 / n) <= 1e-11) {
tmp = t_3;
} 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 t_1 = (Math.log1p(x) - Math.log(x)) / n;
double t_2 = t_0 / (n * x);
double t_3 = t_2 + (((-0.5 / n) / x) / x);
double t_4 = t_0 / x;
double tmp;
if ((1.0 / n) <= -1e-5) {
tmp = t_2;
} else if ((1.0 / n) <= 4e-206) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-134) {
tmp = (t_4 * (((0.5 / (n * n)) - (0.5 / n)) / x)) + ((1.0 / n) * t_4);
} else if ((1.0 / n) <= 2e-114) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-73) {
tmp = t_3;
} else if ((1.0 / n) <= 5e-51) {
tmp = -Math.log(x) / n;
} else if ((1.0 / n) <= 1e-11) {
tmp = t_3;
} else {
tmp = Math.exp((x / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = (math.log1p(x) - math.log(x)) / n t_2 = t_0 / (n * x) t_3 = t_2 + (((-0.5 / n) / x) / x) t_4 = t_0 / x tmp = 0 if (1.0 / n) <= -1e-5: tmp = t_2 elif (1.0 / n) <= 4e-206: tmp = t_1 elif (1.0 / n) <= 5e-134: tmp = (t_4 * (((0.5 / (n * n)) - (0.5 / n)) / x)) + ((1.0 / n) * t_4) elif (1.0 / n) <= 2e-114: tmp = t_1 elif (1.0 / n) <= 5e-73: tmp = t_3 elif (1.0 / n) <= 5e-51: tmp = -math.log(x) / n elif (1.0 / n) <= 1e-11: tmp = t_3 else: tmp = math.exp((x / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(Float64(log1p(x) - log(x)) / n) t_2 = Float64(t_0 / Float64(n * x)) t_3 = Float64(t_2 + Float64(Float64(Float64(-0.5 / n) / x) / x)) t_4 = Float64(t_0 / x) tmp = 0.0 if (Float64(1.0 / n) <= -1e-5) tmp = t_2; elseif (Float64(1.0 / n) <= 4e-206) tmp = t_1; elseif (Float64(1.0 / n) <= 5e-134) tmp = Float64(Float64(t_4 * Float64(Float64(Float64(0.5 / Float64(n * n)) - Float64(0.5 / n)) / x)) + Float64(Float64(1.0 / n) * t_4)); elseif (Float64(1.0 / n) <= 2e-114) tmp = t_1; elseif (Float64(1.0 / n) <= 5e-73) tmp = t_3; elseif (Float64(1.0 / n) <= 5e-51) tmp = Float64(Float64(-log(x)) / n); elseif (Float64(1.0 / n) <= 1e-11) tmp = t_3; 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]}, Block[{t$95$1 = N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 + N[(N[(N[(-0.5 / n), $MachinePrecision] / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$0 / x), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-5], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], 4e-206], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-134], N[(N[(t$95$4 * N[(N[(N[(0.5 / N[(n * n), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / n), $MachinePrecision] * t$95$4), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-114], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-73], t$95$3, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-51], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-11], t$95$3, N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
t_2 := \frac{t_0}{n \cdot x}\\
t_3 := t_2 + \frac{\frac{\frac{-0.5}{n}}{x}}{x}\\
t_4 := \frac{t_0}{x}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-5}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{1}{n} \leq 4 \cdot 10^{-206}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-134}:\\
\;\;\;\;t_4 \cdot \frac{\frac{0.5}{n \cdot n} - \frac{0.5}{n}}{x} + \frac{1}{n} \cdot t_4\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-114}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-73}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-51}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-11}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -1.00000000000000008e-5Initial program 97.3%
Taylor expanded in x around inf 100.0%
log-rec100.0%
mul-1-neg100.0%
associate-*r/100.0%
neg-mul-1100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
*-rgt-identity100.0%
associate-*r/100.0%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
if -1.00000000000000008e-5 < (/.f64 1 n) < 4.00000000000000011e-206 or 5.0000000000000003e-134 < (/.f64 1 n) < 2.0000000000000001e-114Initial program 35.6%
Taylor expanded in n around inf 84.6%
+-rgt-identity84.6%
+-rgt-identity84.6%
log1p-def84.6%
Simplified84.6%
if 4.00000000000000011e-206 < (/.f64 1 n) < 5.0000000000000003e-134Initial program 39.9%
Taylor expanded in n around 0 39.9%
log1p-def39.9%
Simplified39.9%
Taylor expanded in x around inf 78.1%
Simplified78.1%
associate-/r*82.6%
div-inv82.4%
Applied egg-rr82.4%
if 2.0000000000000001e-114 < (/.f64 1 n) < 4.9999999999999998e-73 or 5.00000000000000004e-51 < (/.f64 1 n) < 9.99999999999999939e-12Initial program 13.0%
Taylor expanded in n around 0 13.0%
log1p-def13.0%
Simplified13.0%
Taylor expanded in x around inf 87.0%
Simplified87.0%
Taylor expanded in n around inf 87.0%
associate-/r*87.0%
metadata-eval87.0%
distribute-neg-frac87.0%
metadata-eval87.0%
associate-*r/87.0%
unpow287.0%
associate-/r*87.0%
associate-*r/87.0%
metadata-eval87.0%
distribute-neg-frac87.0%
metadata-eval87.0%
Simplified87.0%
if 4.9999999999999998e-73 < (/.f64 1 n) < 5.00000000000000004e-51Initial program 3.6%
Taylor expanded in x around 0 3.6%
Taylor expanded in n around inf 99.1%
mul-1-neg99.1%
Simplified99.1%
if 9.99999999999999939e-12 < (/.f64 1 n) Initial program 48.9%
Taylor expanded in n around 0 48.9%
log1p-def98.7%
Simplified98.7%
Taylor expanded in x around 0 98.7%
Final simplification91.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n)))
(t_1 (log (+ 1.0 x)))
(t_2 (/ 0.5 (* n n)))
(t_3
(+
(* (/ t_0 x) (/ (- t_2 (/ 0.5 n)) x))
(+
(/
(*
t_0
(+
(/ 0.3333333333333333 n)
(- (/ 0.16666666666666666 (pow n 3.0)) t_2)))
(pow x 3.0))
(/ t_0 (* n x))))))
(if (<= n -165000.0)
(-
(+
(* 0.5 (/ (pow t_1 2.0) (pow n 2.0)))
(+
(* 0.041666666666666664 (/ (pow t_1 4.0) (pow n 4.0)))
(-
(/ (- t_1 (log x)) n)
(/
(-
(* -0.16666666666666666 (pow t_1 3.0))
(* -0.16666666666666666 (pow (log x) 3.0)))
(pow n 3.0)))))
(+
(* 0.5 (/ (pow (log x) 2.0) (pow n 2.0)))
(* 0.041666666666666664 (/ (pow (log x) 4.0) (pow n 4.0)))))
(if (<= n 650000000.0)
(- (exp (/ x n)) t_0)
(if (<= n 1.3e+49)
t_3
(if (<= n 1.2e+72)
(/
(/ (- (* 3.0 (log1p x)) (* 3.0 (log x))) n)
(fma t_0 (+ t_0 (exp (/ (log1p x) n))) (pow (+ 1.0 x) (/ 2.0 n))))
(if (<= n 1.25e+107) t_3 (/ (- (log1p x) (log x)) n))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = log((1.0 + x));
double t_2 = 0.5 / (n * n);
double t_3 = ((t_0 / x) * ((t_2 - (0.5 / n)) / x)) + (((t_0 * ((0.3333333333333333 / n) + ((0.16666666666666666 / pow(n, 3.0)) - t_2))) / pow(x, 3.0)) + (t_0 / (n * x)));
double tmp;
if (n <= -165000.0) {
tmp = ((0.5 * (pow(t_1, 2.0) / pow(n, 2.0))) + ((0.041666666666666664 * (pow(t_1, 4.0) / pow(n, 4.0))) + (((t_1 - log(x)) / n) - (((-0.16666666666666666 * pow(t_1, 3.0)) - (-0.16666666666666666 * pow(log(x), 3.0))) / pow(n, 3.0))))) - ((0.5 * (pow(log(x), 2.0) / pow(n, 2.0))) + (0.041666666666666664 * (pow(log(x), 4.0) / pow(n, 4.0))));
} else if (n <= 650000000.0) {
tmp = exp((x / n)) - t_0;
} else if (n <= 1.3e+49) {
tmp = t_3;
} else if (n <= 1.2e+72) {
tmp = (((3.0 * log1p(x)) - (3.0 * log(x))) / n) / fma(t_0, (t_0 + exp((log1p(x) / n))), pow((1.0 + x), (2.0 / n)));
} else if (n <= 1.25e+107) {
tmp = t_3;
} else {
tmp = (log1p(x) - log(x)) / n;
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = log(Float64(1.0 + x)) t_2 = Float64(0.5 / Float64(n * n)) t_3 = Float64(Float64(Float64(t_0 / x) * Float64(Float64(t_2 - Float64(0.5 / n)) / x)) + Float64(Float64(Float64(t_0 * Float64(Float64(0.3333333333333333 / n) + Float64(Float64(0.16666666666666666 / (n ^ 3.0)) - t_2))) / (x ^ 3.0)) + Float64(t_0 / Float64(n * x)))) tmp = 0.0 if (n <= -165000.0) tmp = Float64(Float64(Float64(0.5 * Float64((t_1 ^ 2.0) / (n ^ 2.0))) + Float64(Float64(0.041666666666666664 * Float64((t_1 ^ 4.0) / (n ^ 4.0))) + Float64(Float64(Float64(t_1 - log(x)) / n) - Float64(Float64(Float64(-0.16666666666666666 * (t_1 ^ 3.0)) - Float64(-0.16666666666666666 * (log(x) ^ 3.0))) / (n ^ 3.0))))) - Float64(Float64(0.5 * Float64((log(x) ^ 2.0) / (n ^ 2.0))) + Float64(0.041666666666666664 * Float64((log(x) ^ 4.0) / (n ^ 4.0))))); elseif (n <= 650000000.0) tmp = Float64(exp(Float64(x / n)) - t_0); elseif (n <= 1.3e+49) tmp = t_3; elseif (n <= 1.2e+72) tmp = Float64(Float64(Float64(Float64(3.0 * log1p(x)) - Float64(3.0 * log(x))) / n) / fma(t_0, Float64(t_0 + exp(Float64(log1p(x) / n))), (Float64(1.0 + x) ^ Float64(2.0 / n)))); elseif (n <= 1.25e+107) tmp = t_3; else tmp = Float64(Float64(log1p(x) - log(x)) / n); 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[Log[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(0.5 / N[(n * n), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(t$95$0 / x), $MachinePrecision] * N[(N[(t$95$2 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(t$95$0 * N[(N[(0.3333333333333333 / n), $MachinePrecision] + N[(N[(0.16666666666666666 / N[Power[n, 3.0], $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -165000.0], N[(N[(N[(0.5 * N[(N[Power[t$95$1, 2.0], $MachinePrecision] / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.041666666666666664 * N[(N[Power[t$95$1, 4.0], $MachinePrecision] / N[Power[n, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(t$95$1 - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] - N[(N[(N[(-0.16666666666666666 * N[Power[t$95$1, 3.0], $MachinePrecision]), $MachinePrecision] - N[(-0.16666666666666666 * N[Power[N[Log[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[n, 3.0], $MachinePrecision]), $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], If[LessEqual[n, 650000000.0], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[n, 1.3e+49], t$95$3, If[LessEqual[n, 1.2e+72], N[(N[(N[(N[(3.0 * N[Log[1 + x], $MachinePrecision]), $MachinePrecision] - N[(3.0 * N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] / N[(t$95$0 * N[(t$95$0 + N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Power[N[(1.0 + x), $MachinePrecision], N[(2.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.25e+107], t$95$3, N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \log \left(1 + x\right)\\
t_2 := \frac{0.5}{n \cdot n}\\
t_3 := \frac{t_0}{x} \cdot \frac{t_2 - \frac{0.5}{n}}{x} + \left(\frac{t_0 \cdot \left(\frac{0.3333333333333333}{n} + \left(\frac{0.16666666666666666}{{n}^{3}} - t_2\right)\right)}{{x}^{3}} + \frac{t_0}{n \cdot x}\right)\\
\mathbf{if}\;n \leq -165000:\\
\;\;\;\;\left(0.5 \cdot \frac{{t_1}^{2}}{{n}^{2}} + \left(0.041666666666666664 \cdot \frac{{t_1}^{4}}{{n}^{4}} + \left(\frac{t_1 - \log x}{n} - \frac{-0.16666666666666666 \cdot {t_1}^{3} - -0.16666666666666666 \cdot {\log x}^{3}}{{n}^{3}}\right)\right)\right) - \left(0.5 \cdot \frac{{\log x}^{2}}{{n}^{2}} + 0.041666666666666664 \cdot \frac{{\log x}^{4}}{{n}^{4}}\right)\\
\mathbf{elif}\;n \leq 650000000:\\
\;\;\;\;e^{\frac{x}{n}} - t_0\\
\mathbf{elif}\;n \leq 1.3 \cdot 10^{+49}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;n \leq 1.2 \cdot 10^{+72}:\\
\;\;\;\;\frac{\frac{3 \cdot \mathsf{log1p}\left(x\right) - 3 \cdot \log x}{n}}{\mathsf{fma}\left(t_0, t_0 + e^{\frac{\mathsf{log1p}\left(x\right)}{n}}, {\left(1 + x\right)}^{\left(\frac{2}{n}\right)}\right)}\\
\mathbf{elif}\;n \leq 1.25 \cdot 10^{+107}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\end{array}
\end{array}
if n < -165000Initial program 30.8%
Taylor expanded in n around -inf 83.6%
if -165000 < n < 6.5e8Initial program 81.9%
Taylor expanded in n around 0 81.9%
log1p-def97.7%
Simplified97.7%
Taylor expanded in x around 0 97.8%
if 6.5e8 < n < 1.29999999999999994e49 or 1.20000000000000005e72 < n < 1.25e107Initial program 8.6%
Taylor expanded in n around 0 8.6%
log1p-def8.6%
Simplified8.6%
Taylor expanded in x around inf 86.9%
Simplified86.9%
if 1.29999999999999994e49 < n < 1.20000000000000005e72Initial program 3.6%
flip3--3.6%
div-inv3.6%
pow-to-exp3.6%
pow-exp3.6%
un-div-inv3.6%
+-commutative3.6%
log1p-udef3.6%
inv-pow3.6%
Applied egg-rr3.6%
Simplified3.6%
Taylor expanded in n around inf 99.8%
log1p-def99.8%
distribute-lft1-in99.8%
metadata-eval99.8%
Simplified99.8%
if 1.25e107 < n Initial program 46.1%
Taylor expanded in n around inf 79.9%
+-rgt-identity79.9%
+-rgt-identity79.9%
log1p-def79.9%
Simplified79.9%
Final simplification89.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ 0.5 (* n n)))
(t_1 (pow x (/ 1.0 n)))
(t_2 (/ (log1p x) n))
(t_3
(+
(* (/ t_1 x) (/ (- t_0 (/ 0.5 n)) x))
(+
(/
(*
t_1
(+
(/ 0.3333333333333333 n)
(- (/ 0.16666666666666666 (pow n 3.0)) t_0)))
(pow x 3.0))
(/ t_1 (* n x))))))
(if (<= n -1450000.0)
(+
(-
(-
(* 0.5 (pow t_2 2.0))
(/
(* -0.16666666666666666 (- (pow (log1p x) 3.0) (pow (log x) 3.0)))
(pow n 3.0)))
(/ (fma -1.0 (log1p x) (log x)) n))
(* -0.5 (pow (/ (log x) n) 2.0)))
(if (<= n 460000000.0)
(- (exp (/ x n)) t_1)
(if (<= n 7.8e+47)
t_3
(if (<= n 2.6e+72)
(/
(/ (- (* 3.0 (log1p x)) (* 3.0 (log x))) n)
(fma t_1 (+ t_1 (exp t_2)) (pow (+ 1.0 x) (/ 2.0 n))))
(if (<= n 2.8e+106) t_3 (/ (- (log1p x) (log x)) n))))))))
double code(double x, double n) {
double t_0 = 0.5 / (n * n);
double t_1 = pow(x, (1.0 / n));
double t_2 = log1p(x) / n;
double t_3 = ((t_1 / x) * ((t_0 - (0.5 / n)) / x)) + (((t_1 * ((0.3333333333333333 / n) + ((0.16666666666666666 / pow(n, 3.0)) - t_0))) / pow(x, 3.0)) + (t_1 / (n * x)));
double tmp;
if (n <= -1450000.0) {
tmp = (((0.5 * pow(t_2, 2.0)) - ((-0.16666666666666666 * (pow(log1p(x), 3.0) - pow(log(x), 3.0))) / pow(n, 3.0))) - (fma(-1.0, log1p(x), log(x)) / n)) + (-0.5 * pow((log(x) / n), 2.0));
} else if (n <= 460000000.0) {
tmp = exp((x / n)) - t_1;
} else if (n <= 7.8e+47) {
tmp = t_3;
} else if (n <= 2.6e+72) {
tmp = (((3.0 * log1p(x)) - (3.0 * log(x))) / n) / fma(t_1, (t_1 + exp(t_2)), pow((1.0 + x), (2.0 / n)));
} else if (n <= 2.8e+106) {
tmp = t_3;
} else {
tmp = (log1p(x) - log(x)) / n;
}
return tmp;
}
function code(x, n) t_0 = Float64(0.5 / Float64(n * n)) t_1 = x ^ Float64(1.0 / n) t_2 = Float64(log1p(x) / n) t_3 = Float64(Float64(Float64(t_1 / x) * Float64(Float64(t_0 - Float64(0.5 / n)) / x)) + Float64(Float64(Float64(t_1 * Float64(Float64(0.3333333333333333 / n) + Float64(Float64(0.16666666666666666 / (n ^ 3.0)) - t_0))) / (x ^ 3.0)) + Float64(t_1 / Float64(n * x)))) tmp = 0.0 if (n <= -1450000.0) tmp = Float64(Float64(Float64(Float64(0.5 * (t_2 ^ 2.0)) - Float64(Float64(-0.16666666666666666 * Float64((log1p(x) ^ 3.0) - (log(x) ^ 3.0))) / (n ^ 3.0))) - Float64(fma(-1.0, log1p(x), log(x)) / n)) + Float64(-0.5 * (Float64(log(x) / n) ^ 2.0))); elseif (n <= 460000000.0) tmp = Float64(exp(Float64(x / n)) - t_1); elseif (n <= 7.8e+47) tmp = t_3; elseif (n <= 2.6e+72) tmp = Float64(Float64(Float64(Float64(3.0 * log1p(x)) - Float64(3.0 * log(x))) / n) / fma(t_1, Float64(t_1 + exp(t_2)), (Float64(1.0 + x) ^ Float64(2.0 / n)))); elseif (n <= 2.8e+106) tmp = t_3; else tmp = Float64(Float64(log1p(x) - log(x)) / n); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(0.5 / N[(n * n), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(t$95$1 / x), $MachinePrecision] * N[(N[(t$95$0 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(t$95$1 * N[(N[(0.3333333333333333 / n), $MachinePrecision] + N[(N[(0.16666666666666666 / N[Power[n, 3.0], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1450000.0], N[(N[(N[(N[(0.5 * N[Power[t$95$2, 2.0], $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[(-1.0 * N[Log[1 + x], $MachinePrecision] + N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[Power[N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 460000000.0], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[n, 7.8e+47], t$95$3, If[LessEqual[n, 2.6e+72], N[(N[(N[(N[(3.0 * N[Log[1 + x], $MachinePrecision]), $MachinePrecision] - N[(3.0 * N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] / N[(t$95$1 * N[(t$95$1 + N[Exp[t$95$2], $MachinePrecision]), $MachinePrecision] + N[Power[N[(1.0 + x), $MachinePrecision], N[(2.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.8e+106], t$95$3, N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{0.5}{n \cdot n}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
t_2 := \frac{\mathsf{log1p}\left(x\right)}{n}\\
t_3 := \frac{t_1}{x} \cdot \frac{t_0 - \frac{0.5}{n}}{x} + \left(\frac{t_1 \cdot \left(\frac{0.3333333333333333}{n} + \left(\frac{0.16666666666666666}{{n}^{3}} - t_0\right)\right)}{{x}^{3}} + \frac{t_1}{n \cdot x}\right)\\
\mathbf{if}\;n \leq -1450000:\\
\;\;\;\;\left(\left(0.5 \cdot {t_2}^{2} - \frac{-0.16666666666666666 \cdot \left({\left(\mathsf{log1p}\left(x\right)\right)}^{3} - {\log x}^{3}\right)}{{n}^{3}}\right) - \frac{\mathsf{fma}\left(-1, \mathsf{log1p}\left(x\right), \log x\right)}{n}\right) + -0.5 \cdot {\left(\frac{\log x}{n}\right)}^{2}\\
\mathbf{elif}\;n \leq 460000000:\\
\;\;\;\;e^{\frac{x}{n}} - t_1\\
\mathbf{elif}\;n \leq 7.8 \cdot 10^{+47}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;n \leq 2.6 \cdot 10^{+72}:\\
\;\;\;\;\frac{\frac{3 \cdot \mathsf{log1p}\left(x\right) - 3 \cdot \log x}{n}}{\mathsf{fma}\left(t_1, t_1 + e^{t_2}, {\left(1 + x\right)}^{\left(\frac{2}{n}\right)}\right)}\\
\mathbf{elif}\;n \leq 2.8 \cdot 10^{+106}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\end{array}
\end{array}
if n < -1.45e6Initial program 30.1%
Taylor expanded in n around 0 30.1%
log1p-def30.1%
Simplified30.1%
Taylor expanded in n around -inf 83.3%
cancel-sign-sub-inv83.3%
Simplified83.3%
if -1.45e6 < n < 4.6e8Initial program 82.0%
Taylor expanded in n around 0 82.0%
log1p-def97.6%
Simplified97.6%
Taylor expanded in x around 0 97.7%
if 4.6e8 < n < 7.8000000000000005e47 or 2.59999999999999981e72 < n < 2.79999999999999993e106Initial program 8.6%
Taylor expanded in n around 0 8.6%
log1p-def8.6%
Simplified8.6%
Taylor expanded in x around inf 86.9%
Simplified86.9%
if 7.8000000000000005e47 < n < 2.59999999999999981e72Initial program 3.6%
flip3--3.6%
div-inv3.6%
pow-to-exp3.6%
pow-exp3.6%
un-div-inv3.6%
+-commutative3.6%
log1p-udef3.6%
inv-pow3.6%
Applied egg-rr3.6%
Simplified3.6%
Taylor expanded in n around inf 99.8%
log1p-def99.8%
distribute-lft1-in99.8%
metadata-eval99.8%
Simplified99.8%
if 2.79999999999999993e106 < n Initial program 46.1%
Taylor expanded in n around inf 79.9%
+-rgt-identity79.9%
+-rgt-identity79.9%
log1p-def79.9%
Simplified79.9%
Final simplification89.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ 0.5 (* n n)))
(t_1 (pow x (/ 1.0 n)))
(t_2
(+
(* (/ t_1 x) (/ (- t_0 (/ 0.5 n)) x))
(+
(/
(*
t_1
(+
(/ 0.3333333333333333 n)
(- (/ 0.16666666666666666 (pow n 3.0)) t_0)))
(pow x 3.0))
(/ t_1 (* n x)))))
(t_3 (/ (- (log1p x) (log x)) n)))
(if (<= n -31000000.0)
(fma
0.5
(/ (pow (log1p x) 2.0) (* n n))
(- t_3 (* 0.5 (/ (pow (log x) 2.0) (* n n)))))
(if (<= n 1400000000.0)
(- (exp (/ x n)) t_1)
(if (<= n 1.45e+49)
t_2
(if (<= n 3.3e+72)
(/
(/ (- (* 3.0 (log1p x)) (* 3.0 (log x))) n)
(fma t_1 (+ t_1 (exp (/ (log1p x) n))) (pow (+ 1.0 x) (/ 2.0 n))))
(if (<= n 5.9e+106) t_2 t_3)))))))
double code(double x, double n) {
double t_0 = 0.5 / (n * n);
double t_1 = pow(x, (1.0 / n));
double t_2 = ((t_1 / x) * ((t_0 - (0.5 / n)) / x)) + (((t_1 * ((0.3333333333333333 / n) + ((0.16666666666666666 / pow(n, 3.0)) - t_0))) / pow(x, 3.0)) + (t_1 / (n * x)));
double t_3 = (log1p(x) - log(x)) / n;
double tmp;
if (n <= -31000000.0) {
tmp = fma(0.5, (pow(log1p(x), 2.0) / (n * n)), (t_3 - (0.5 * (pow(log(x), 2.0) / (n * n)))));
} else if (n <= 1400000000.0) {
tmp = exp((x / n)) - t_1;
} else if (n <= 1.45e+49) {
tmp = t_2;
} else if (n <= 3.3e+72) {
tmp = (((3.0 * log1p(x)) - (3.0 * log(x))) / n) / fma(t_1, (t_1 + exp((log1p(x) / n))), pow((1.0 + x), (2.0 / n)));
} else if (n <= 5.9e+106) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
function code(x, n) t_0 = Float64(0.5 / Float64(n * n)) t_1 = x ^ Float64(1.0 / n) t_2 = Float64(Float64(Float64(t_1 / x) * Float64(Float64(t_0 - Float64(0.5 / n)) / x)) + Float64(Float64(Float64(t_1 * Float64(Float64(0.3333333333333333 / n) + Float64(Float64(0.16666666666666666 / (n ^ 3.0)) - t_0))) / (x ^ 3.0)) + Float64(t_1 / Float64(n * x)))) t_3 = Float64(Float64(log1p(x) - log(x)) / n) tmp = 0.0 if (n <= -31000000.0) tmp = fma(0.5, Float64((log1p(x) ^ 2.0) / Float64(n * n)), Float64(t_3 - Float64(0.5 * Float64((log(x) ^ 2.0) / Float64(n * n))))); elseif (n <= 1400000000.0) tmp = Float64(exp(Float64(x / n)) - t_1); elseif (n <= 1.45e+49) tmp = t_2; elseif (n <= 3.3e+72) tmp = Float64(Float64(Float64(Float64(3.0 * log1p(x)) - Float64(3.0 * log(x))) / n) / fma(t_1, Float64(t_1 + exp(Float64(log1p(x) / n))), (Float64(1.0 + x) ^ Float64(2.0 / n)))); elseif (n <= 5.9e+106) tmp = t_2; else tmp = t_3; end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(0.5 / N[(n * n), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(t$95$1 / x), $MachinePrecision] * N[(N[(t$95$0 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(t$95$1 * N[(N[(0.3333333333333333 / n), $MachinePrecision] + N[(N[(0.16666666666666666 / N[Power[n, 3.0], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[n, -31000000.0], N[(0.5 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 - N[(0.5 * N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1400000000.0], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[n, 1.45e+49], t$95$2, If[LessEqual[n, 3.3e+72], N[(N[(N[(N[(3.0 * N[Log[1 + x], $MachinePrecision]), $MachinePrecision] - N[(3.0 * N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] / N[(t$95$1 * N[(t$95$1 + N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Power[N[(1.0 + x), $MachinePrecision], N[(2.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 5.9e+106], t$95$2, t$95$3]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{0.5}{n \cdot n}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
t_2 := \frac{t_1}{x} \cdot \frac{t_0 - \frac{0.5}{n}}{x} + \left(\frac{t_1 \cdot \left(\frac{0.3333333333333333}{n} + \left(\frac{0.16666666666666666}{{n}^{3}} - t_0\right)\right)}{{x}^{3}} + \frac{t_1}{n \cdot x}\right)\\
t_3 := \frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{if}\;n \leq -31000000:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, t_3 - 0.5 \cdot \frac{{\log x}^{2}}{n \cdot n}\right)\\
\mathbf{elif}\;n \leq 1400000000:\\
\;\;\;\;e^{\frac{x}{n}} - t_1\\
\mathbf{elif}\;n \leq 1.45 \cdot 10^{+49}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;n \leq 3.3 \cdot 10^{+72}:\\
\;\;\;\;\frac{\frac{3 \cdot \mathsf{log1p}\left(x\right) - 3 \cdot \log x}{n}}{\mathsf{fma}\left(t_1, t_1 + e^{\frac{\mathsf{log1p}\left(x\right)}{n}}, {\left(1 + x\right)}^{\left(\frac{2}{n}\right)}\right)}\\
\mathbf{elif}\;n \leq 5.9 \cdot 10^{+106}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\end{array}
if n < -3.1e7Initial program 29.4%
Taylor expanded in n around inf 83.1%
associate--l+74.9%
fma-def74.9%
log1p-def74.9%
unpow274.9%
associate--r+83.1%
+-rgt-identity83.1%
div-sub83.2%
+-rgt-identity83.2%
log1p-def83.2%
unpow283.2%
Simplified83.2%
if -3.1e7 < n < 1.4e9Initial program 82.0%
Taylor expanded in n around 0 82.0%
log1p-def97.4%
Simplified97.4%
Taylor expanded in x around 0 97.5%
if 1.4e9 < n < 1.45e49 or 3.3e72 < n < 5.90000000000000027e106Initial program 8.6%
Taylor expanded in n around 0 8.6%
log1p-def8.6%
Simplified8.6%
Taylor expanded in x around inf 86.9%
Simplified86.9%
if 1.45e49 < n < 3.3e72Initial program 3.6%
flip3--3.6%
div-inv3.6%
pow-to-exp3.6%
pow-exp3.6%
un-div-inv3.6%
+-commutative3.6%
log1p-udef3.6%
inv-pow3.6%
Applied egg-rr3.6%
Simplified3.6%
Taylor expanded in n around inf 99.8%
log1p-def99.8%
distribute-lft1-in99.8%
metadata-eval99.8%
Simplified99.8%
if 5.90000000000000027e106 < n Initial program 46.1%
Taylor expanded in n around inf 79.9%
+-rgt-identity79.9%
+-rgt-identity79.9%
log1p-def79.9%
Simplified79.9%
Final simplification89.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ 0.5 (* n n)))
(t_1 (pow x (/ 1.0 n)))
(t_2
(+
(* (/ t_1 x) (/ (- t_0 (/ 0.5 n)) x))
(+
(/
(*
t_1
(+
(/ 0.3333333333333333 n)
(- (/ 0.16666666666666666 (pow n 3.0)) t_0)))
(pow x 3.0))
(/ t_1 (* n x)))))
(t_3 (/ (log x) n))
(t_4 (/ (- (log1p x) (log x)) n)))
(if (<= n -13200000.0)
(fma
0.5
(/ (pow (log1p x) 2.0) (* n n))
(- t_4 (* 0.5 (/ (pow (log x) 2.0) (* n n)))))
(if (<= n 2500000000.0)
(- (exp (/ x n)) t_1)
(if (<= n 8.6e+47)
t_2
(if (<= n 3.2e+72)
(+
(fma -0.5 (pow t_3 2.0) (* -0.16666666666666666 (pow t_3 3.0)))
(/ -1.0 (/ n (log x))))
(if (<= n 2.8e+106) t_2 t_4)))))))
double code(double x, double n) {
double t_0 = 0.5 / (n * n);
double t_1 = pow(x, (1.0 / n));
double t_2 = ((t_1 / x) * ((t_0 - (0.5 / n)) / x)) + (((t_1 * ((0.3333333333333333 / n) + ((0.16666666666666666 / pow(n, 3.0)) - t_0))) / pow(x, 3.0)) + (t_1 / (n * x)));
double t_3 = log(x) / n;
double t_4 = (log1p(x) - log(x)) / n;
double tmp;
if (n <= -13200000.0) {
tmp = fma(0.5, (pow(log1p(x), 2.0) / (n * n)), (t_4 - (0.5 * (pow(log(x), 2.0) / (n * n)))));
} else if (n <= 2500000000.0) {
tmp = exp((x / n)) - t_1;
} else if (n <= 8.6e+47) {
tmp = t_2;
} else if (n <= 3.2e+72) {
tmp = fma(-0.5, pow(t_3, 2.0), (-0.16666666666666666 * pow(t_3, 3.0))) + (-1.0 / (n / log(x)));
} else if (n <= 2.8e+106) {
tmp = t_2;
} else {
tmp = t_4;
}
return tmp;
}
function code(x, n) t_0 = Float64(0.5 / Float64(n * n)) t_1 = x ^ Float64(1.0 / n) t_2 = Float64(Float64(Float64(t_1 / x) * Float64(Float64(t_0 - Float64(0.5 / n)) / x)) + Float64(Float64(Float64(t_1 * Float64(Float64(0.3333333333333333 / n) + Float64(Float64(0.16666666666666666 / (n ^ 3.0)) - t_0))) / (x ^ 3.0)) + Float64(t_1 / Float64(n * x)))) t_3 = Float64(log(x) / n) t_4 = Float64(Float64(log1p(x) - log(x)) / n) tmp = 0.0 if (n <= -13200000.0) tmp = fma(0.5, Float64((log1p(x) ^ 2.0) / Float64(n * n)), Float64(t_4 - Float64(0.5 * Float64((log(x) ^ 2.0) / Float64(n * n))))); elseif (n <= 2500000000.0) tmp = Float64(exp(Float64(x / n)) - t_1); elseif (n <= 8.6e+47) tmp = t_2; elseif (n <= 3.2e+72) tmp = Float64(fma(-0.5, (t_3 ^ 2.0), Float64(-0.16666666666666666 * (t_3 ^ 3.0))) + Float64(-1.0 / Float64(n / log(x)))); elseif (n <= 2.8e+106) tmp = t_2; else tmp = t_4; end return tmp end
code[x_, n_] := Block[{t$95$0 = N[(0.5 / N[(n * n), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(t$95$1 / x), $MachinePrecision] * N[(N[(t$95$0 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(t$95$1 * N[(N[(0.3333333333333333 / n), $MachinePrecision] + N[(N[(0.16666666666666666 / N[Power[n, 3.0], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[n, -13200000.0], N[(0.5 * N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision] + N[(t$95$4 - N[(0.5 * N[(N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2500000000.0], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[n, 8.6e+47], t$95$2, If[LessEqual[n, 3.2e+72], N[(N[(-0.5 * N[Power[t$95$3, 2.0], $MachinePrecision] + N[(-0.16666666666666666 * N[Power[t$95$3, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[(n / N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.8e+106], t$95$2, t$95$4]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{0.5}{n \cdot n}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
t_2 := \frac{t_1}{x} \cdot \frac{t_0 - \frac{0.5}{n}}{x} + \left(\frac{t_1 \cdot \left(\frac{0.3333333333333333}{n} + \left(\frac{0.16666666666666666}{{n}^{3}} - t_0\right)\right)}{{x}^{3}} + \frac{t_1}{n \cdot x}\right)\\
t_3 := \frac{\log x}{n}\\
t_4 := \frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{if}\;n \leq -13200000:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2}}{n \cdot n}, t_4 - 0.5 \cdot \frac{{\log x}^{2}}{n \cdot n}\right)\\
\mathbf{elif}\;n \leq 2500000000:\\
\;\;\;\;e^{\frac{x}{n}} - t_1\\
\mathbf{elif}\;n \leq 8.6 \cdot 10^{+47}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;n \leq 3.2 \cdot 10^{+72}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, {t_3}^{2}, -0.16666666666666666 \cdot {t_3}^{3}\right) + \frac{-1}{\frac{n}{\log x}}\\
\mathbf{elif}\;n \leq 2.8 \cdot 10^{+106}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_4\\
\end{array}
\end{array}
if n < -1.32e7Initial program 29.4%
Taylor expanded in n around inf 83.1%
associate--l+74.9%
fma-def74.9%
log1p-def74.9%
unpow274.9%
associate--r+83.1%
+-rgt-identity83.1%
div-sub83.2%
+-rgt-identity83.2%
log1p-def83.2%
unpow283.2%
Simplified83.2%
if -1.32e7 < n < 2.5e9Initial program 82.0%
Taylor expanded in n around 0 82.0%
log1p-def97.4%
Simplified97.4%
Taylor expanded in x around 0 97.5%
if 2.5e9 < n < 8.59999999999999989e47 or 3.2000000000000001e72 < n < 2.79999999999999993e106Initial program 8.6%
Taylor expanded in n around 0 8.6%
log1p-def8.6%
Simplified8.6%
Taylor expanded in x around inf 86.9%
Simplified86.9%
if 8.59999999999999989e47 < n < 3.2000000000000001e72Initial program 3.6%
Taylor expanded in x around 0 3.6%
Taylor expanded in n around inf 99.1%
+-commutative99.1%
mul-1-neg99.1%
unsub-neg99.1%
fma-def99.1%
unpow299.1%
unpow299.1%
times-frac99.1%
unpow299.1%
cube-div99.1%
Simplified99.1%
clear-num99.3%
inv-pow99.3%
Applied egg-rr99.3%
unpow-199.3%
Simplified99.3%
if 2.79999999999999993e106 < n Initial program 46.1%
Taylor expanded in n around inf 79.9%
+-rgt-identity79.9%
+-rgt-identity79.9%
log1p-def79.9%
Simplified79.9%
Final simplification89.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n)))
(t_1 (/ (log x) n))
(t_2 (/ (- (log1p x) (log x)) n))
(t_3 (/ 0.5 (* n n)))
(t_4
(+
(* (/ t_0 x) (/ (- t_3 (/ 0.5 n)) x))
(+
(/
(*
t_0
(+
(/ 0.3333333333333333 n)
(- (/ 0.16666666666666666 (pow n 3.0)) t_3)))
(pow x 3.0))
(/ t_0 (* n x))))))
(if (<= n -24500000000.0)
t_2
(if (<= n 4400000000.0)
(- (exp (/ x n)) t_0)
(if (<= n 1.45e+50)
t_4
(if (<= n 2.6e+72)
(+
(fma -0.5 (pow t_1 2.0) (* -0.16666666666666666 (pow t_1 3.0)))
(/ -1.0 (/ n (log x))))
(if (<= n 2.7e+109) t_4 t_2)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = log(x) / n;
double t_2 = (log1p(x) - log(x)) / n;
double t_3 = 0.5 / (n * n);
double t_4 = ((t_0 / x) * ((t_3 - (0.5 / n)) / x)) + (((t_0 * ((0.3333333333333333 / n) + ((0.16666666666666666 / pow(n, 3.0)) - t_3))) / pow(x, 3.0)) + (t_0 / (n * x)));
double tmp;
if (n <= -24500000000.0) {
tmp = t_2;
} else if (n <= 4400000000.0) {
tmp = exp((x / n)) - t_0;
} else if (n <= 1.45e+50) {
tmp = t_4;
} else if (n <= 2.6e+72) {
tmp = fma(-0.5, pow(t_1, 2.0), (-0.16666666666666666 * pow(t_1, 3.0))) + (-1.0 / (n / log(x)));
} else if (n <= 2.7e+109) {
tmp = t_4;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(log(x) / n) t_2 = Float64(Float64(log1p(x) - log(x)) / n) t_3 = Float64(0.5 / Float64(n * n)) t_4 = Float64(Float64(Float64(t_0 / x) * Float64(Float64(t_3 - Float64(0.5 / n)) / x)) + Float64(Float64(Float64(t_0 * Float64(Float64(0.3333333333333333 / n) + Float64(Float64(0.16666666666666666 / (n ^ 3.0)) - t_3))) / (x ^ 3.0)) + Float64(t_0 / Float64(n * x)))) tmp = 0.0 if (n <= -24500000000.0) tmp = t_2; elseif (n <= 4400000000.0) tmp = Float64(exp(Float64(x / n)) - t_0); elseif (n <= 1.45e+50) tmp = t_4; elseif (n <= 2.6e+72) tmp = Float64(fma(-0.5, (t_1 ^ 2.0), Float64(-0.16666666666666666 * (t_1 ^ 3.0))) + Float64(-1.0 / Float64(n / log(x)))); elseif (n <= 2.7e+109) tmp = t_4; else tmp = t_2; end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Log[x], $MachinePrecision] / n), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]}, Block[{t$95$3 = N[(0.5 / N[(n * n), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[(t$95$0 / x), $MachinePrecision] * N[(N[(t$95$3 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(t$95$0 * N[(N[(0.3333333333333333 / n), $MachinePrecision] + N[(N[(0.16666666666666666 / N[Power[n, 3.0], $MachinePrecision]), $MachinePrecision] - t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -24500000000.0], t$95$2, If[LessEqual[n, 4400000000.0], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[n, 1.45e+50], t$95$4, If[LessEqual[n, 2.6e+72], N[(N[(-0.5 * N[Power[t$95$1, 2.0], $MachinePrecision] + N[(-0.16666666666666666 * N[Power[t$95$1, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[(n / N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.7e+109], t$95$4, t$95$2]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\log x}{n}\\
t_2 := \frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
t_3 := \frac{0.5}{n \cdot n}\\
t_4 := \frac{t_0}{x} \cdot \frac{t_3 - \frac{0.5}{n}}{x} + \left(\frac{t_0 \cdot \left(\frac{0.3333333333333333}{n} + \left(\frac{0.16666666666666666}{{n}^{3}} - t_3\right)\right)}{{x}^{3}} + \frac{t_0}{n \cdot x}\right)\\
\mathbf{if}\;n \leq -24500000000:\\
\;\;\;\;t_2\\
\mathbf{elif}\;n \leq 4400000000:\\
\;\;\;\;e^{\frac{x}{n}} - t_0\\
\mathbf{elif}\;n \leq 1.45 \cdot 10^{+50}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;n \leq 2.6 \cdot 10^{+72}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, {t_1}^{2}, -0.16666666666666666 \cdot {t_1}^{3}\right) + \frac{-1}{\frac{n}{\log x}}\\
\mathbf{elif}\;n \leq 2.7 \cdot 10^{+109}:\\
\;\;\;\;t_4\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if n < -2.45e10 or 2.70000000000000001e109 < n Initial program 35.9%
Taylor expanded in n around inf 81.9%
+-rgt-identity81.9%
+-rgt-identity81.9%
log1p-def81.9%
Simplified81.9%
if -2.45e10 < n < 4.4e9Initial program 82.0%
Taylor expanded in n around 0 82.0%
log1p-def97.4%
Simplified97.4%
Taylor expanded in x around 0 97.5%
if 4.4e9 < n < 1.45e50 or 2.59999999999999981e72 < n < 2.70000000000000001e109Initial program 8.6%
Taylor expanded in n around 0 8.6%
log1p-def8.6%
Simplified8.6%
Taylor expanded in x around inf 86.9%
Simplified86.9%
if 1.45e50 < n < 2.59999999999999981e72Initial program 3.6%
Taylor expanded in x around 0 3.6%
Taylor expanded in n around inf 99.1%
+-commutative99.1%
mul-1-neg99.1%
unsub-neg99.1%
fma-def99.1%
unpow299.1%
unpow299.1%
times-frac99.1%
unpow299.1%
cube-div99.1%
Simplified99.1%
clear-num99.3%
inv-pow99.3%
Applied egg-rr99.3%
unpow-199.3%
Simplified99.3%
Final simplification89.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n)))
(t_1 (/ (- (log1p x) (log x)) n))
(t_2 (/ 0.5 (* n n)))
(t_3
(+
(* (/ t_0 x) (/ (- t_2 (/ 0.5 n)) x))
(+
(/
(*
t_0
(+
(/ 0.3333333333333333 n)
(- (/ 0.16666666666666666 (pow n 3.0)) t_2)))
(pow x 3.0))
(/ t_0 (* n x))))))
(if (<= n -1950000000.0)
t_1
(if (<= n 4600000000.0)
(- (exp (/ x n)) t_0)
(if (<= n 8.2e+47)
t_3
(if (<= n 2.5e+72)
(/ (- (log x)) n)
(if (<= n 2.8e+106) t_3 t_1)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = (log1p(x) - log(x)) / n;
double t_2 = 0.5 / (n * n);
double t_3 = ((t_0 / x) * ((t_2 - (0.5 / n)) / x)) + (((t_0 * ((0.3333333333333333 / n) + ((0.16666666666666666 / pow(n, 3.0)) - t_2))) / pow(x, 3.0)) + (t_0 / (n * x)));
double tmp;
if (n <= -1950000000.0) {
tmp = t_1;
} else if (n <= 4600000000.0) {
tmp = exp((x / n)) - t_0;
} else if (n <= 8.2e+47) {
tmp = t_3;
} else if (n <= 2.5e+72) {
tmp = -log(x) / n;
} else if (n <= 2.8e+106) {
tmp = t_3;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = (Math.log1p(x) - Math.log(x)) / n;
double t_2 = 0.5 / (n * n);
double t_3 = ((t_0 / x) * ((t_2 - (0.5 / n)) / x)) + (((t_0 * ((0.3333333333333333 / n) + ((0.16666666666666666 / Math.pow(n, 3.0)) - t_2))) / Math.pow(x, 3.0)) + (t_0 / (n * x)));
double tmp;
if (n <= -1950000000.0) {
tmp = t_1;
} else if (n <= 4600000000.0) {
tmp = Math.exp((x / n)) - t_0;
} else if (n <= 8.2e+47) {
tmp = t_3;
} else if (n <= 2.5e+72) {
tmp = -Math.log(x) / n;
} else if (n <= 2.8e+106) {
tmp = t_3;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = (math.log1p(x) - math.log(x)) / n t_2 = 0.5 / (n * n) t_3 = ((t_0 / x) * ((t_2 - (0.5 / n)) / x)) + (((t_0 * ((0.3333333333333333 / n) + ((0.16666666666666666 / math.pow(n, 3.0)) - t_2))) / math.pow(x, 3.0)) + (t_0 / (n * x))) tmp = 0 if n <= -1950000000.0: tmp = t_1 elif n <= 4600000000.0: tmp = math.exp((x / n)) - t_0 elif n <= 8.2e+47: tmp = t_3 elif n <= 2.5e+72: tmp = -math.log(x) / n elif n <= 2.8e+106: tmp = t_3 else: tmp = t_1 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(Float64(log1p(x) - log(x)) / n) t_2 = Float64(0.5 / Float64(n * n)) t_3 = Float64(Float64(Float64(t_0 / x) * Float64(Float64(t_2 - Float64(0.5 / n)) / x)) + Float64(Float64(Float64(t_0 * Float64(Float64(0.3333333333333333 / n) + Float64(Float64(0.16666666666666666 / (n ^ 3.0)) - t_2))) / (x ^ 3.0)) + Float64(t_0 / Float64(n * x)))) tmp = 0.0 if (n <= -1950000000.0) tmp = t_1; elseif (n <= 4600000000.0) tmp = Float64(exp(Float64(x / n)) - t_0); elseif (n <= 8.2e+47) tmp = t_3; elseif (n <= 2.5e+72) tmp = Float64(Float64(-log(x)) / n); elseif (n <= 2.8e+106) tmp = t_3; else tmp = t_1; end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]}, Block[{t$95$2 = N[(0.5 / N[(n * n), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(t$95$0 / x), $MachinePrecision] * N[(N[(t$95$2 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(t$95$0 * N[(N[(0.3333333333333333 / n), $MachinePrecision] + N[(N[(0.16666666666666666 / N[Power[n, 3.0], $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1950000000.0], t$95$1, If[LessEqual[n, 4600000000.0], N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[n, 8.2e+47], t$95$3, If[LessEqual[n, 2.5e+72], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[n, 2.8e+106], t$95$3, t$95$1]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
t_2 := \frac{0.5}{n \cdot n}\\
t_3 := \frac{t_0}{x} \cdot \frac{t_2 - \frac{0.5}{n}}{x} + \left(\frac{t_0 \cdot \left(\frac{0.3333333333333333}{n} + \left(\frac{0.16666666666666666}{{n}^{3}} - t_2\right)\right)}{{x}^{3}} + \frac{t_0}{n \cdot x}\right)\\
\mathbf{if}\;n \leq -1950000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;n \leq 4600000000:\\
\;\;\;\;e^{\frac{x}{n}} - t_0\\
\mathbf{elif}\;n \leq 8.2 \cdot 10^{+47}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;n \leq 2.5 \cdot 10^{+72}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;n \leq 2.8 \cdot 10^{+106}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if n < -1.95e9 or 2.79999999999999993e106 < n Initial program 35.9%
Taylor expanded in n around inf 81.9%
+-rgt-identity81.9%
+-rgt-identity81.9%
log1p-def81.9%
Simplified81.9%
if -1.95e9 < n < 4.6e9Initial program 82.0%
Taylor expanded in n around 0 82.0%
log1p-def97.4%
Simplified97.4%
Taylor expanded in x around 0 97.5%
if 4.6e9 < n < 8.2000000000000002e47 or 2.49999999999999996e72 < n < 2.79999999999999993e106Initial program 8.6%
Taylor expanded in n around 0 8.6%
log1p-def8.6%
Simplified8.6%
Taylor expanded in x around inf 86.9%
Simplified86.9%
if 8.2000000000000002e47 < n < 2.49999999999999996e72Initial program 3.6%
Taylor expanded in x around 0 3.6%
Taylor expanded in n around inf 99.1%
mul-1-neg99.1%
Simplified99.1%
Final simplification89.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n)))
(t_1 (/ t_0 (* n x)))
(t_2 (+ t_1 (/ (/ (/ -0.5 n) x) x))))
(if (<= (/ 1.0 n) -1e-5)
t_1
(if (<= (/ 1.0 n) 2e-114)
(/ (- (log1p x) (log x)) n)
(if (<= (/ 1.0 n) 5e-73)
t_2
(if (<= (/ 1.0 n) 5e-51)
(/ (- (log x)) n)
(if (<= (/ 1.0 n) 1e-11)
t_2
(if (<= (/ 1.0 n) 1e+131)
(-
(+ (* (- (/ 0.5 (* n n)) (/ 0.5 n)) (* x x)) (+ 1.0 (/ x n)))
t_0)
(sqrt (pow (* n x) -2.0))))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = t_0 / (n * x);
double t_2 = t_1 + (((-0.5 / n) / x) / x);
double tmp;
if ((1.0 / n) <= -1e-5) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-114) {
tmp = (log1p(x) - log(x)) / n;
} else if ((1.0 / n) <= 5e-73) {
tmp = t_2;
} else if ((1.0 / n) <= 5e-51) {
tmp = -log(x) / n;
} else if ((1.0 / n) <= 1e-11) {
tmp = t_2;
} else if ((1.0 / n) <= 1e+131) {
tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + (1.0 + (x / n))) - t_0;
} else {
tmp = sqrt(pow((n * x), -2.0));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = t_0 / (n * x);
double t_2 = t_1 + (((-0.5 / n) / x) / x);
double tmp;
if ((1.0 / n) <= -1e-5) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-114) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else if ((1.0 / n) <= 5e-73) {
tmp = t_2;
} else if ((1.0 / n) <= 5e-51) {
tmp = -Math.log(x) / n;
} else if ((1.0 / n) <= 1e-11) {
tmp = t_2;
} else if ((1.0 / n) <= 1e+131) {
tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + (1.0 + (x / n))) - t_0;
} else {
tmp = Math.sqrt(Math.pow((n * x), -2.0));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = t_0 / (n * x) t_2 = t_1 + (((-0.5 / n) / x) / x) tmp = 0 if (1.0 / n) <= -1e-5: tmp = t_1 elif (1.0 / n) <= 2e-114: tmp = (math.log1p(x) - math.log(x)) / n elif (1.0 / n) <= 5e-73: tmp = t_2 elif (1.0 / n) <= 5e-51: tmp = -math.log(x) / n elif (1.0 / n) <= 1e-11: tmp = t_2 elif (1.0 / n) <= 1e+131: tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + (1.0 + (x / n))) - t_0 else: tmp = math.sqrt(math.pow((n * x), -2.0)) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(t_0 / Float64(n * x)) t_2 = Float64(t_1 + Float64(Float64(Float64(-0.5 / n) / x) / x)) tmp = 0.0 if (Float64(1.0 / n) <= -1e-5) tmp = t_1; elseif (Float64(1.0 / n) <= 2e-114) tmp = Float64(Float64(log1p(x) - log(x)) / n); elseif (Float64(1.0 / n) <= 5e-73) tmp = t_2; elseif (Float64(1.0 / n) <= 5e-51) tmp = Float64(Float64(-log(x)) / n); elseif (Float64(1.0 / n) <= 1e-11) tmp = t_2; elseif (Float64(1.0 / n) <= 1e+131) tmp = Float64(Float64(Float64(Float64(Float64(0.5 / Float64(n * n)) - Float64(0.5 / n)) * Float64(x * x)) + Float64(1.0 + Float64(x / n))) - t_0); else tmp = sqrt((Float64(n * x) ^ -2.0)); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 + N[(N[(N[(-0.5 / n), $MachinePrecision] / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-5], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-114], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-73], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-51], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-11], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+131], N[(N[(N[(N[(N[(0.5 / N[(n * n), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[Sqrt[N[Power[N[(n * x), $MachinePrecision], -2.0], $MachinePrecision]], $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{t_0}{n \cdot x}\\
t_2 := t_1 + \frac{\frac{\frac{-0.5}{n}}{x}}{x}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-5}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-114}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-73}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-51}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-11}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+131}:\\
\;\;\;\;\left(\left(\frac{0.5}{n \cdot n} - \frac{0.5}{n}\right) \cdot \left(x \cdot x\right) + \left(1 + \frac{x}{n}\right)\right) - t_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{{\left(n \cdot x\right)}^{-2}}\\
\end{array}
\end{array}
if (/.f64 1 n) < -1.00000000000000008e-5Initial program 97.3%
Taylor expanded in x around inf 100.0%
log-rec100.0%
mul-1-neg100.0%
associate-*r/100.0%
neg-mul-1100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
*-rgt-identity100.0%
associate-*r/100.0%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
if -1.00000000000000008e-5 < (/.f64 1 n) < 2.0000000000000001e-114Initial program 36.2%
Taylor expanded in n around inf 81.1%
+-rgt-identity81.1%
+-rgt-identity81.1%
log1p-def81.1%
Simplified81.1%
if 2.0000000000000001e-114 < (/.f64 1 n) < 4.9999999999999998e-73 or 5.00000000000000004e-51 < (/.f64 1 n) < 9.99999999999999939e-12Initial program 13.0%
Taylor expanded in n around 0 13.0%
log1p-def13.0%
Simplified13.0%
Taylor expanded in x around inf 87.0%
Simplified87.0%
Taylor expanded in n around inf 87.0%
associate-/r*87.0%
metadata-eval87.0%
distribute-neg-frac87.0%
metadata-eval87.0%
associate-*r/87.0%
unpow287.0%
associate-/r*87.0%
associate-*r/87.0%
metadata-eval87.0%
distribute-neg-frac87.0%
metadata-eval87.0%
Simplified87.0%
if 4.9999999999999998e-73 < (/.f64 1 n) < 5.00000000000000004e-51Initial program 3.6%
Taylor expanded in x around 0 3.6%
Taylor expanded in n around inf 99.1%
mul-1-neg99.1%
Simplified99.1%
if 9.99999999999999939e-12 < (/.f64 1 n) < 9.9999999999999991e130Initial program 80.6%
Taylor expanded in x around 0 75.5%
associate-+r+75.5%
+-commutative75.5%
associate-*r/75.5%
metadata-eval75.5%
unpow275.5%
associate-*r/75.5%
metadata-eval75.5%
unpow275.5%
Simplified75.5%
if 9.9999999999999991e130 < (/.f64 1 n) Initial program 15.3%
Taylor expanded in x around inf 0.6%
log-rec0.6%
mul-1-neg0.6%
associate-*r/0.6%
neg-mul-10.6%
mul-1-neg0.6%
remove-double-neg0.6%
*-commutative0.6%
Simplified0.6%
Taylor expanded in n around inf 52.9%
*-commutative52.9%
Simplified52.9%
add-sqr-sqrt52.9%
sqrt-unprod82.1%
inv-pow82.1%
inv-pow82.1%
pow-prod-up82.1%
*-commutative82.1%
metadata-eval82.1%
Applied egg-rr82.1%
*-commutative82.1%
Simplified82.1%
Final simplification87.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n)))
(t_1 (/ t_0 (* n x)))
(t_2 (+ t_1 (/ (/ (/ -0.5 n) x) x))))
(if (<= (/ 1.0 n) -1e-5)
t_1
(if (<= (/ 1.0 n) 2e-114)
(/ (- (log1p x) (log x)) n)
(if (<= (/ 1.0 n) 5e-73)
t_2
(if (<= (/ 1.0 n) 5e-51)
(/ (- (log x)) n)
(if (<= (/ 1.0 n) 1e-11) t_2 (- (exp (/ x n)) t_0))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = t_0 / (n * x);
double t_2 = t_1 + (((-0.5 / n) / x) / x);
double tmp;
if ((1.0 / n) <= -1e-5) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-114) {
tmp = (log1p(x) - log(x)) / n;
} else if ((1.0 / n) <= 5e-73) {
tmp = t_2;
} else if ((1.0 / n) <= 5e-51) {
tmp = -log(x) / n;
} else if ((1.0 / n) <= 1e-11) {
tmp = t_2;
} 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 t_1 = t_0 / (n * x);
double t_2 = t_1 + (((-0.5 / n) / x) / x);
double tmp;
if ((1.0 / n) <= -1e-5) {
tmp = t_1;
} else if ((1.0 / n) <= 2e-114) {
tmp = (Math.log1p(x) - Math.log(x)) / n;
} else if ((1.0 / n) <= 5e-73) {
tmp = t_2;
} else if ((1.0 / n) <= 5e-51) {
tmp = -Math.log(x) / n;
} else if ((1.0 / n) <= 1e-11) {
tmp = t_2;
} else {
tmp = Math.exp((x / n)) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = t_0 / (n * x) t_2 = t_1 + (((-0.5 / n) / x) / x) tmp = 0 if (1.0 / n) <= -1e-5: tmp = t_1 elif (1.0 / n) <= 2e-114: tmp = (math.log1p(x) - math.log(x)) / n elif (1.0 / n) <= 5e-73: tmp = t_2 elif (1.0 / n) <= 5e-51: tmp = -math.log(x) / n elif (1.0 / n) <= 1e-11: tmp = t_2 else: tmp = math.exp((x / n)) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(t_0 / Float64(n * x)) t_2 = Float64(t_1 + Float64(Float64(Float64(-0.5 / n) / x) / x)) tmp = 0.0 if (Float64(1.0 / n) <= -1e-5) tmp = t_1; elseif (Float64(1.0 / n) <= 2e-114) tmp = Float64(Float64(log1p(x) - log(x)) / n); elseif (Float64(1.0 / n) <= 5e-73) tmp = t_2; elseif (Float64(1.0 / n) <= 5e-51) tmp = Float64(Float64(-log(x)) / n); elseif (Float64(1.0 / n) <= 1e-11) tmp = t_2; 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]}, Block[{t$95$1 = N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 + N[(N[(N[(-0.5 / n), $MachinePrecision] / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-5], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-114], N[(N[(N[Log[1 + x], $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-73], t$95$2, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-51], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e-11], t$95$2, N[(N[Exp[N[(x / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{t_0}{n \cdot x}\\
t_2 := t_1 + \frac{\frac{\frac{-0.5}{n}}{x}}{x}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-5}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-114}:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-73}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-51}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{-11}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{x}{n}} - t_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -1.00000000000000008e-5Initial program 97.3%
Taylor expanded in x around inf 100.0%
log-rec100.0%
mul-1-neg100.0%
associate-*r/100.0%
neg-mul-1100.0%
mul-1-neg100.0%
remove-double-neg100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
*-rgt-identity100.0%
associate-*r/100.0%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
if -1.00000000000000008e-5 < (/.f64 1 n) < 2.0000000000000001e-114Initial program 36.2%
Taylor expanded in n around inf 81.1%
+-rgt-identity81.1%
+-rgt-identity81.1%
log1p-def81.1%
Simplified81.1%
if 2.0000000000000001e-114 < (/.f64 1 n) < 4.9999999999999998e-73 or 5.00000000000000004e-51 < (/.f64 1 n) < 9.99999999999999939e-12Initial program 13.0%
Taylor expanded in n around 0 13.0%
log1p-def13.0%
Simplified13.0%
Taylor expanded in x around inf 87.0%
Simplified87.0%
Taylor expanded in n around inf 87.0%
associate-/r*87.0%
metadata-eval87.0%
distribute-neg-frac87.0%
metadata-eval87.0%
associate-*r/87.0%
unpow287.0%
associate-/r*87.0%
associate-*r/87.0%
metadata-eval87.0%
distribute-neg-frac87.0%
metadata-eval87.0%
Simplified87.0%
if 4.9999999999999998e-73 < (/.f64 1 n) < 5.00000000000000004e-51Initial program 3.6%
Taylor expanded in x around 0 3.6%
Taylor expanded in n around inf 99.1%
mul-1-neg99.1%
Simplified99.1%
if 9.99999999999999939e-12 < (/.f64 1 n) Initial program 48.9%
Taylor expanded in n around 0 48.9%
log1p-def98.7%
Simplified98.7%
Taylor expanded in x around 0 98.7%
Final simplification89.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (- (log x)) n)) (t_1 (+ 1.0 (/ x n))) (t_2 (pow x (/ 1.0 n))))
(if (<= x 6.5e-255)
(- t_1 t_2)
(if (<= x 6.6e-156)
t_0
(if (<= x 9.5e-137)
(- (+ (* (- (/ 0.5 (* n n)) (/ 0.5 n)) (* x x)) t_1) t_2)
(if (<= x 3.2e-38)
t_0
(if (<= x 6.2e-22)
(log1p (expm1 (/ 1.0 (* n x))))
(if (<= x 0.0076) (/ (- x (log x)) n) (/ (/ t_2 x) n)))))))))
double code(double x, double n) {
double t_0 = -log(x) / n;
double t_1 = 1.0 + (x / n);
double t_2 = pow(x, (1.0 / n));
double tmp;
if (x <= 6.5e-255) {
tmp = t_1 - t_2;
} else if (x <= 6.6e-156) {
tmp = t_0;
} else if (x <= 9.5e-137) {
tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + t_1) - t_2;
} else if (x <= 3.2e-38) {
tmp = t_0;
} else if (x <= 6.2e-22) {
tmp = log1p(expm1((1.0 / (n * x))));
} else if (x <= 0.0076) {
tmp = (x - log(x)) / n;
} else {
tmp = (t_2 / x) / n;
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = -Math.log(x) / n;
double t_1 = 1.0 + (x / n);
double t_2 = Math.pow(x, (1.0 / n));
double tmp;
if (x <= 6.5e-255) {
tmp = t_1 - t_2;
} else if (x <= 6.6e-156) {
tmp = t_0;
} else if (x <= 9.5e-137) {
tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + t_1) - t_2;
} else if (x <= 3.2e-38) {
tmp = t_0;
} else if (x <= 6.2e-22) {
tmp = Math.log1p(Math.expm1((1.0 / (n * x))));
} else if (x <= 0.0076) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = (t_2 / x) / n;
}
return tmp;
}
def code(x, n): t_0 = -math.log(x) / n t_1 = 1.0 + (x / n) t_2 = math.pow(x, (1.0 / n)) tmp = 0 if x <= 6.5e-255: tmp = t_1 - t_2 elif x <= 6.6e-156: tmp = t_0 elif x <= 9.5e-137: tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + t_1) - t_2 elif x <= 3.2e-38: tmp = t_0 elif x <= 6.2e-22: tmp = math.log1p(math.expm1((1.0 / (n * x)))) elif x <= 0.0076: tmp = (x - math.log(x)) / n else: tmp = (t_2 / x) / n return tmp
function code(x, n) t_0 = Float64(Float64(-log(x)) / n) t_1 = Float64(1.0 + Float64(x / n)) t_2 = x ^ Float64(1.0 / n) tmp = 0.0 if (x <= 6.5e-255) tmp = Float64(t_1 - t_2); elseif (x <= 6.6e-156) tmp = t_0; elseif (x <= 9.5e-137) tmp = Float64(Float64(Float64(Float64(Float64(0.5 / Float64(n * n)) - Float64(0.5 / n)) * Float64(x * x)) + t_1) - t_2); elseif (x <= 3.2e-38) tmp = t_0; elseif (x <= 6.2e-22) tmp = log1p(expm1(Float64(1.0 / Float64(n * x)))); elseif (x <= 0.0076) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(t_2 / x) / n); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 6.5e-255], N[(t$95$1 - t$95$2), $MachinePrecision], If[LessEqual[x, 6.6e-156], t$95$0, If[LessEqual[x, 9.5e-137], N[(N[(N[(N[(N[(0.5 / N[(n * n), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] - t$95$2), $MachinePrecision], If[LessEqual[x, 3.2e-38], t$95$0, If[LessEqual[x, 6.2e-22], N[Log[1 + N[(Exp[N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 0.0076], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(t$95$2 / x), $MachinePrecision] / n), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-\log x}{n}\\
t_1 := 1 + \frac{x}{n}\\
t_2 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 6.5 \cdot 10^{-255}:\\
\;\;\;\;t_1 - t_2\\
\mathbf{elif}\;x \leq 6.6 \cdot 10^{-156}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-137}:\\
\;\;\;\;\left(\left(\frac{0.5}{n \cdot n} - \frac{0.5}{n}\right) \cdot \left(x \cdot x\right) + t_1\right) - t_2\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{-38}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{-22}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1}{n \cdot x}\right)\right)\\
\mathbf{elif}\;x \leq 0.0076:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t_2}{x}}{n}\\
\end{array}
\end{array}
if x < 6.5e-255Initial program 63.7%
Taylor expanded in x around 0 63.7%
if 6.5e-255 < x < 6.5999999999999997e-156 or 9.5000000000000007e-137 < x < 3.19999999999999977e-38Initial program 36.6%
Taylor expanded in x around 0 36.6%
Taylor expanded in n around inf 59.8%
mul-1-neg59.8%
Simplified59.8%
if 6.5999999999999997e-156 < x < 9.5000000000000007e-137Initial program 69.5%
Taylor expanded in x around 0 84.4%
associate-+r+84.4%
+-commutative84.4%
associate-*r/84.4%
metadata-eval84.4%
unpow284.4%
associate-*r/84.4%
metadata-eval84.4%
unpow284.4%
Simplified84.4%
if 3.19999999999999977e-38 < x < 6.20000000000000025e-22Initial program 41.1%
Taylor expanded in x around inf 41.0%
log-rec41.0%
mul-1-neg41.0%
associate-*r/41.0%
neg-mul-141.0%
mul-1-neg41.0%
remove-double-neg41.0%
*-commutative41.0%
Simplified41.0%
Taylor expanded in n around inf 6.0%
*-commutative6.0%
Simplified6.0%
log1p-expm1-u78.9%
*-commutative78.9%
Applied egg-rr78.9%
if 6.20000000000000025e-22 < x < 0.00759999999999999998Initial program 24.0%
Taylor expanded in n around 0 24.0%
log1p-def24.0%
Simplified24.0%
Taylor expanded in x around 0 24.0%
Taylor expanded in n around inf 73.8%
if 0.00759999999999999998 < x Initial program 63.0%
Taylor expanded in x around inf 95.6%
log-rec95.6%
mul-1-neg95.6%
associate-*r/95.6%
neg-mul-195.6%
mul-1-neg95.6%
remove-double-neg95.6%
*-commutative95.6%
Simplified95.6%
div-inv95.6%
pow-to-exp95.6%
*-un-lft-identity95.6%
*-commutative95.6%
times-frac98.0%
Applied egg-rr98.0%
associate-*l/98.0%
*-un-lft-identity98.0%
Applied egg-rr98.0%
Final simplification79.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (+ 1.0 (/ x n))) (t_1 (pow x (/ 1.0 n))))
(if (<= x 1.8e-255)
(- t_0 t_1)
(if (<= x 6.6e-156)
(/ (- (log x)) n)
(if (<= x 9.5e-137)
(- (+ (* (- (/ 0.5 (* n n)) (/ 0.5 n)) (* x x)) t_0) t_1)
(if (<= x 0.044) (/ (- x (log x)) n) (/ (/ t_1 x) n)))))))
double code(double x, double n) {
double t_0 = 1.0 + (x / n);
double t_1 = pow(x, (1.0 / n));
double tmp;
if (x <= 1.8e-255) {
tmp = t_0 - t_1;
} else if (x <= 6.6e-156) {
tmp = -log(x) / n;
} else if (x <= 9.5e-137) {
tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + t_0) - t_1;
} else if (x <= 0.044) {
tmp = (x - log(x)) / n;
} else {
tmp = (t_1 / 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) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + (x / n)
t_1 = x ** (1.0d0 / n)
if (x <= 1.8d-255) then
tmp = t_0 - t_1
else if (x <= 6.6d-156) then
tmp = -log(x) / n
else if (x <= 9.5d-137) then
tmp = ((((0.5d0 / (n * n)) - (0.5d0 / n)) * (x * x)) + t_0) - t_1
else if (x <= 0.044d0) then
tmp = (x - log(x)) / n
else
tmp = (t_1 / x) / n
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 + (x / n);
double t_1 = Math.pow(x, (1.0 / n));
double tmp;
if (x <= 1.8e-255) {
tmp = t_0 - t_1;
} else if (x <= 6.6e-156) {
tmp = -Math.log(x) / n;
} else if (x <= 9.5e-137) {
tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + t_0) - t_1;
} else if (x <= 0.044) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = (t_1 / x) / n;
}
return tmp;
}
def code(x, n): t_0 = 1.0 + (x / n) t_1 = math.pow(x, (1.0 / n)) tmp = 0 if x <= 1.8e-255: tmp = t_0 - t_1 elif x <= 6.6e-156: tmp = -math.log(x) / n elif x <= 9.5e-137: tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + t_0) - t_1 elif x <= 0.044: tmp = (x - math.log(x)) / n else: tmp = (t_1 / x) / n return tmp
function code(x, n) t_0 = Float64(1.0 + Float64(x / n)) t_1 = x ^ Float64(1.0 / n) tmp = 0.0 if (x <= 1.8e-255) tmp = Float64(t_0 - t_1); elseif (x <= 6.6e-156) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 9.5e-137) tmp = Float64(Float64(Float64(Float64(Float64(0.5 / Float64(n * n)) - Float64(0.5 / n)) * Float64(x * x)) + t_0) - t_1); elseif (x <= 0.044) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(t_1 / x) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 + (x / n); t_1 = x ^ (1.0 / n); tmp = 0.0; if (x <= 1.8e-255) tmp = t_0 - t_1; elseif (x <= 6.6e-156) tmp = -log(x) / n; elseif (x <= 9.5e-137) tmp = ((((0.5 / (n * n)) - (0.5 / n)) * (x * x)) + t_0) - t_1; elseif (x <= 0.044) tmp = (x - log(x)) / n; else tmp = (t_1 / x) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 1.8e-255], N[(t$95$0 - t$95$1), $MachinePrecision], If[LessEqual[x, 6.6e-156], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 9.5e-137], N[(N[(N[(N[(N[(0.5 / N[(n * n), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[x, 0.044], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(t$95$1 / x), $MachinePrecision] / n), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x}{n}\\
t_1 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 1.8 \cdot 10^{-255}:\\
\;\;\;\;t_0 - t_1\\
\mathbf{elif}\;x \leq 6.6 \cdot 10^{-156}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-137}:\\
\;\;\;\;\left(\left(\frac{0.5}{n \cdot n} - \frac{0.5}{n}\right) \cdot \left(x \cdot x\right) + t_0\right) - t_1\\
\mathbf{elif}\;x \leq 0.044:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t_1}{x}}{n}\\
\end{array}
\end{array}
if x < 1.8000000000000001e-255Initial program 63.7%
Taylor expanded in x around 0 63.7%
if 1.8000000000000001e-255 < x < 6.5999999999999997e-156Initial program 43.3%
Taylor expanded in x around 0 43.3%
Taylor expanded in n around inf 59.0%
mul-1-neg59.0%
Simplified59.0%
if 6.5999999999999997e-156 < x < 9.5000000000000007e-137Initial program 69.5%
Taylor expanded in x around 0 84.4%
associate-+r+84.4%
+-commutative84.4%
associate-*r/84.4%
metadata-eval84.4%
unpow284.4%
associate-*r/84.4%
metadata-eval84.4%
unpow284.4%
Simplified84.4%
if 9.5000000000000007e-137 < x < 0.043999999999999997Initial program 29.8%
Taylor expanded in n around 0 29.8%
log1p-def50.7%
Simplified50.7%
Taylor expanded in x around 0 50.7%
Taylor expanded in n around inf 54.4%
if 0.043999999999999997 < x Initial program 63.0%
Taylor expanded in x around inf 95.6%
log-rec95.6%
mul-1-neg95.6%
associate-*r/95.6%
neg-mul-195.6%
mul-1-neg95.6%
remove-double-neg95.6%
*-commutative95.6%
Simplified95.6%
div-inv95.6%
pow-to-exp95.6%
*-un-lft-identity95.6%
*-commutative95.6%
times-frac98.0%
Applied egg-rr98.0%
associate-*l/98.0%
*-un-lft-identity98.0%
Applied egg-rr98.0%
Final simplification77.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (- 1.0 t_0)))
(if (<= x 3.4e-254)
t_1
(if (<= x 8e-180)
(/ (- (log x)) n)
(if (<= x 2.3e-136)
t_1
(if (<= x 0.25) (/ (- x (log x)) n) (/ (/ t_0 x) n)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = 1.0 - t_0;
double tmp;
if (x <= 3.4e-254) {
tmp = t_1;
} else if (x <= 8e-180) {
tmp = -log(x) / n;
} else if (x <= 2.3e-136) {
tmp = t_1;
} else if (x <= 0.25) {
tmp = (x - log(x)) / n;
} else {
tmp = (t_0 / x) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
t_1 = 1.0d0 - t_0
if (x <= 3.4d-254) then
tmp = t_1
else if (x <= 8d-180) then
tmp = -log(x) / n
else if (x <= 2.3d-136) then
tmp = t_1
else if (x <= 0.25d0) then
tmp = (x - log(x)) / n
else
tmp = (t_0 / x) / n
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 (x <= 3.4e-254) {
tmp = t_1;
} else if (x <= 8e-180) {
tmp = -Math.log(x) / n;
} else if (x <= 2.3e-136) {
tmp = t_1;
} else if (x <= 0.25) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = (t_0 / x) / n;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = 1.0 - t_0 tmp = 0 if x <= 3.4e-254: tmp = t_1 elif x <= 8e-180: tmp = -math.log(x) / n elif x <= 2.3e-136: tmp = t_1 elif x <= 0.25: tmp = (x - math.log(x)) / n else: tmp = (t_0 / x) / n return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(1.0 - t_0) tmp = 0.0 if (x <= 3.4e-254) tmp = t_1; elseif (x <= 8e-180) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 2.3e-136) tmp = t_1; elseif (x <= 0.25) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(t_0 / x) / n); 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 (x <= 3.4e-254) tmp = t_1; elseif (x <= 8e-180) tmp = -log(x) / n; elseif (x <= 2.3e-136) tmp = t_1; elseif (x <= 0.25) tmp = (x - log(x)) / n; else tmp = (t_0 / x) / n; 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[x, 3.4e-254], t$95$1, If[LessEqual[x, 8e-180], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 2.3e-136], t$95$1, If[LessEqual[x, 0.25], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(t$95$0 / x), $MachinePrecision] / n), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := 1 - t_0\\
\mathbf{if}\;x \leq 3.4 \cdot 10^{-254}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 8 \cdot 10^{-180}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-136}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 0.25:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t_0}{x}}{n}\\
\end{array}
\end{array}
if x < 3.39999999999999993e-254 or 8.0000000000000002e-180 < x < 2.29999999999999998e-136Initial program 61.2%
Taylor expanded in x around 0 61.2%
if 3.39999999999999993e-254 < x < 8.0000000000000002e-180Initial program 36.6%
Taylor expanded in x around 0 36.6%
Taylor expanded in n around inf 62.5%
mul-1-neg62.5%
Simplified62.5%
if 2.29999999999999998e-136 < x < 0.25Initial program 29.8%
Taylor expanded in n around 0 29.8%
log1p-def50.7%
Simplified50.7%
Taylor expanded in x around 0 50.7%
Taylor expanded in n around inf 54.4%
if 0.25 < x Initial program 63.0%
Taylor expanded in x around inf 95.6%
log-rec95.6%
mul-1-neg95.6%
associate-*r/95.6%
neg-mul-195.6%
mul-1-neg95.6%
remove-double-neg95.6%
*-commutative95.6%
Simplified95.6%
div-inv95.6%
pow-to-exp95.6%
*-un-lft-identity95.6%
*-commutative95.6%
times-frac98.0%
Applied egg-rr98.0%
associate-*l/98.0%
*-un-lft-identity98.0%
Applied egg-rr98.0%
Final simplification76.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (- (+ 1.0 (/ x n)) t_0)))
(if (<= x 5.8e-253)
t_1
(if (<= x 6.5e-180)
(/ (- (log x)) n)
(if (<= x 1.1e-136)
t_1
(if (<= x 0.049) (/ (- x (log x)) n) (/ (/ t_0 x) n)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = (1.0 + (x / n)) - t_0;
double tmp;
if (x <= 5.8e-253) {
tmp = t_1;
} else if (x <= 6.5e-180) {
tmp = -log(x) / n;
} else if (x <= 1.1e-136) {
tmp = t_1;
} else if (x <= 0.049) {
tmp = (x - log(x)) / n;
} else {
tmp = (t_0 / x) / n;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
t_1 = (1.0d0 + (x / n)) - t_0
if (x <= 5.8d-253) then
tmp = t_1
else if (x <= 6.5d-180) then
tmp = -log(x) / n
else if (x <= 1.1d-136) then
tmp = t_1
else if (x <= 0.049d0) then
tmp = (x - log(x)) / n
else
tmp = (t_0 / x) / n
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 + (x / n)) - t_0;
double tmp;
if (x <= 5.8e-253) {
tmp = t_1;
} else if (x <= 6.5e-180) {
tmp = -Math.log(x) / n;
} else if (x <= 1.1e-136) {
tmp = t_1;
} else if (x <= 0.049) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = (t_0 / x) / n;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = (1.0 + (x / n)) - t_0 tmp = 0 if x <= 5.8e-253: tmp = t_1 elif x <= 6.5e-180: tmp = -math.log(x) / n elif x <= 1.1e-136: tmp = t_1 elif x <= 0.049: tmp = (x - math.log(x)) / n else: tmp = (t_0 / x) / n return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(Float64(1.0 + Float64(x / n)) - t_0) tmp = 0.0 if (x <= 5.8e-253) tmp = t_1; elseif (x <= 6.5e-180) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 1.1e-136) tmp = t_1; elseif (x <= 0.049) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(t_0 / x) / n); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = (1.0 + (x / n)) - t_0; tmp = 0.0; if (x <= 5.8e-253) tmp = t_1; elseif (x <= 6.5e-180) tmp = -log(x) / n; elseif (x <= 1.1e-136) tmp = t_1; elseif (x <= 0.049) tmp = (x - log(x)) / n; else tmp = (t_0 / x) / n; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[x, 5.8e-253], t$95$1, If[LessEqual[x, 6.5e-180], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 1.1e-136], t$95$1, If[LessEqual[x, 0.049], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(t$95$0 / x), $MachinePrecision] / n), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \left(1 + \frac{x}{n}\right) - t_0\\
\mathbf{if}\;x \leq 5.8 \cdot 10^{-253}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{-180}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-136}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 0.049:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t_0}{x}}{n}\\
\end{array}
\end{array}
if x < 5.7999999999999996e-253 or 6.50000000000000013e-180 < x < 1.1000000000000001e-136Initial program 61.2%
Taylor expanded in x around 0 61.2%
if 5.7999999999999996e-253 < x < 6.50000000000000013e-180Initial program 36.6%
Taylor expanded in x around 0 36.6%
Taylor expanded in n around inf 62.5%
mul-1-neg62.5%
Simplified62.5%
if 1.1000000000000001e-136 < x < 0.049000000000000002Initial program 29.8%
Taylor expanded in n around 0 29.8%
log1p-def50.7%
Simplified50.7%
Taylor expanded in x around 0 50.7%
Taylor expanded in n around inf 54.4%
if 0.049000000000000002 < x Initial program 63.0%
Taylor expanded in x around inf 95.6%
log-rec95.6%
mul-1-neg95.6%
associate-*r/95.6%
neg-mul-195.6%
mul-1-neg95.6%
remove-double-neg95.6%
*-commutative95.6%
Simplified95.6%
div-inv95.6%
pow-to-exp95.6%
*-un-lft-identity95.6%
*-commutative95.6%
times-frac98.0%
Applied egg-rr98.0%
associate-*l/98.0%
*-un-lft-identity98.0%
Applied egg-rr98.0%
Final simplification76.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= x 4.5e-255)
t_0
(if (<= x 7.4e-180)
(/ (- (log x)) n)
(if (<= x 9.5e-137)
t_0
(if (<= x 1.0) (/ (- x (log x)) n) (/ (/ 1.0 n) x)))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double tmp;
if (x <= 4.5e-255) {
tmp = t_0;
} else if (x <= 7.4e-180) {
tmp = -log(x) / n;
} else if (x <= 9.5e-137) {
tmp = t_0;
} else if (x <= 1.0) {
tmp = (x - log(x)) / 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) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (x ** (1.0d0 / n))
if (x <= 4.5d-255) then
tmp = t_0
else if (x <= 7.4d-180) then
tmp = -log(x) / n
else if (x <= 9.5d-137) then
tmp = t_0
else if (x <= 1.0d0) then
tmp = (x - log(x)) / n
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 (x <= 4.5e-255) {
tmp = t_0;
} else if (x <= 7.4e-180) {
tmp = -Math.log(x) / n;
} else if (x <= 9.5e-137) {
tmp = t_0;
} else if (x <= 1.0) {
tmp = (x - Math.log(x)) / n;
} 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 x <= 4.5e-255: tmp = t_0 elif x <= 7.4e-180: tmp = -math.log(x) / n elif x <= 9.5e-137: tmp = t_0 elif x <= 1.0: tmp = (x - math.log(x)) / n 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 (x <= 4.5e-255) tmp = t_0; elseif (x <= 7.4e-180) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 9.5e-137) tmp = t_0; elseif (x <= 1.0) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(1.0 / n) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); tmp = 0.0; if (x <= 4.5e-255) tmp = t_0; elseif (x <= 7.4e-180) tmp = -log(x) / n; elseif (x <= 9.5e-137) tmp = t_0; elseif (x <= 1.0) tmp = (x - log(x)) / n; 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[x, 4.5e-255], t$95$0, If[LessEqual[x, 7.4e-180], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 9.5e-137], t$95$0, If[LessEqual[x, 1.0], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;x \leq 4.5 \cdot 10^{-255}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 7.4 \cdot 10^{-180}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-137}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\end{array}
\end{array}
if x < 4.49999999999999979e-255 or 7.40000000000000032e-180 < x < 9.5000000000000007e-137Initial program 61.2%
Taylor expanded in x around 0 61.2%
if 4.49999999999999979e-255 < x < 7.40000000000000032e-180Initial program 36.6%
Taylor expanded in x around 0 36.6%
Taylor expanded in n around inf 62.5%
mul-1-neg62.5%
Simplified62.5%
if 9.5000000000000007e-137 < x < 1Initial program 29.8%
Taylor expanded in n around 0 29.8%
log1p-def50.7%
Simplified50.7%
Taylor expanded in x around 0 50.7%
Taylor expanded in n around inf 54.4%
if 1 < x Initial program 63.0%
Taylor expanded in x around inf 95.6%
log-rec95.6%
mul-1-neg95.6%
associate-*r/95.6%
neg-mul-195.6%
mul-1-neg95.6%
remove-double-neg95.6%
*-commutative95.6%
Simplified95.6%
div-inv95.6%
pow-to-exp95.6%
*-un-lft-identity95.6%
*-commutative95.6%
times-frac98.0%
Applied egg-rr98.0%
Taylor expanded in n around inf 68.6%
associate-/r*70.9%
Simplified70.9%
Final simplification64.2%
(FPCore (x n) :precision binary64 (if (<= x 1.0) (/ (- x (log x)) n) (/ (/ 1.0 n) x)))
double code(double x, double n) {
double tmp;
if (x <= 1.0) {
tmp = (x - log(x)) / 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 (x <= 1.0d0) then
tmp = (x - log(x)) / n
else
tmp = (1.0d0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 1.0) {
tmp = (x - Math.log(x)) / n;
} else {
tmp = (1.0 / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.0: tmp = (x - math.log(x)) / n else: tmp = (1.0 / n) / x return tmp
function code(x, n) tmp = 0.0 if (x <= 1.0) tmp = Float64(Float64(x - log(x)) / n); else tmp = Float64(Float64(1.0 / n) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.0) tmp = (x - log(x)) / n; else tmp = (1.0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.0], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\end{array}
\end{array}
if x < 1Initial program 43.1%
Taylor expanded in n around 0 43.1%
log1p-def54.7%
Simplified54.7%
Taylor expanded in x around 0 54.7%
Taylor expanded in n around inf 50.9%
if 1 < x Initial program 63.0%
Taylor expanded in x around inf 95.6%
log-rec95.6%
mul-1-neg95.6%
associate-*r/95.6%
neg-mul-195.6%
mul-1-neg95.6%
remove-double-neg95.6%
*-commutative95.6%
Simplified95.6%
div-inv95.6%
pow-to-exp95.6%
*-un-lft-identity95.6%
*-commutative95.6%
times-frac98.0%
Applied egg-rr98.0%
Taylor expanded in n around inf 68.6%
associate-/r*70.9%
Simplified70.9%
Final simplification59.8%
(FPCore (x n) :precision binary64 (if (<= x 0.55) (/ (- (log x)) n) (/ (/ 1.0 n) x)))
double code(double x, double n) {
double tmp;
if (x <= 0.55) {
tmp = -log(x) / 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 (x <= 0.55d0) then
tmp = -log(x) / n
else
tmp = (1.0d0 / n) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.55) {
tmp = -Math.log(x) / n;
} else {
tmp = (1.0 / n) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.55: tmp = -math.log(x) / n else: tmp = (1.0 / n) / x return tmp
function code(x, n) tmp = 0.0 if (x <= 0.55) tmp = Float64(Float64(-log(x)) / n); else tmp = Float64(Float64(1.0 / n) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.55) tmp = -log(x) / n; else tmp = (1.0 / n) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.55], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.55:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n}}{x}\\
\end{array}
\end{array}
if x < 0.55000000000000004Initial program 43.1%
Taylor expanded in x around 0 42.4%
Taylor expanded in n around inf 50.8%
mul-1-neg50.8%
Simplified50.8%
if 0.55000000000000004 < x Initial program 63.0%
Taylor expanded in x around inf 95.6%
log-rec95.6%
mul-1-neg95.6%
associate-*r/95.6%
neg-mul-195.6%
mul-1-neg95.6%
remove-double-neg95.6%
*-commutative95.6%
Simplified95.6%
div-inv95.6%
pow-to-exp95.6%
*-un-lft-identity95.6%
*-commutative95.6%
times-frac98.0%
Applied egg-rr98.0%
Taylor expanded in n around inf 68.6%
associate-/r*70.9%
Simplified70.9%
Final simplification59.8%
(FPCore (x n) :precision binary64 (/ 1.0 (* n x)))
double code(double x, double n) {
return 1.0 / (n * x);
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = 1.0d0 / (n * x)
end function
public static double code(double x, double n) {
return 1.0 / (n * x);
}
def code(x, n): return 1.0 / (n * x)
function code(x, n) return Float64(1.0 / Float64(n * x)) end
function tmp = code(x, n) tmp = 1.0 / (n * x); end
code[x_, n_] := N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{n \cdot x}
\end{array}
Initial program 52.0%
Taylor expanded in x around inf 59.5%
log-rec59.5%
mul-1-neg59.5%
associate-*r/59.5%
neg-mul-159.5%
mul-1-neg59.5%
remove-double-neg59.5%
*-commutative59.5%
Simplified59.5%
Taylor expanded in n around inf 42.7%
*-commutative42.7%
Simplified42.7%
Final simplification42.7%
(FPCore (x n) :precision binary64 (/ (/ 1.0 n) x))
double code(double x, double n) {
return (1.0 / n) / x;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = (1.0d0 / n) / x
end function
public static double code(double x, double n) {
return (1.0 / n) / x;
}
def code(x, n): return (1.0 / n) / x
function code(x, n) return Float64(Float64(1.0 / n) / x) end
function tmp = code(x, n) tmp = (1.0 / n) / x; end
code[x_, n_] := N[(N[(1.0 / n), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{n}}{x}
\end{array}
Initial program 52.0%
Taylor expanded in x around inf 59.5%
log-rec59.5%
mul-1-neg59.5%
associate-*r/59.5%
neg-mul-159.5%
mul-1-neg59.5%
remove-double-neg59.5%
*-commutative59.5%
Simplified59.5%
div-inv59.5%
pow-to-exp59.5%
*-un-lft-identity59.5%
*-commutative59.5%
times-frac60.7%
Applied egg-rr60.7%
Taylor expanded in n around inf 42.7%
associate-/r*43.8%
Simplified43.8%
Final simplification43.8%
(FPCore (x n) :precision binary64 (* n x))
double code(double x, double n) {
return n * x;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = n * x
end function
public static double code(double x, double n) {
return n * x;
}
def code(x, n): return n * x
function code(x, n) return Float64(n * x) end
function tmp = code(x, n) tmp = n * x; end
code[x_, n_] := N[(n * x), $MachinePrecision]
\begin{array}{l}
\\
n \cdot x
\end{array}
Initial program 52.0%
Taylor expanded in x around inf 59.5%
log-rec59.5%
mul-1-neg59.5%
associate-*r/59.5%
neg-mul-159.5%
mul-1-neg59.5%
remove-double-neg59.5%
*-commutative59.5%
Simplified59.5%
div-inv59.5%
pow-to-exp59.5%
*-un-lft-identity59.5%
*-commutative59.5%
times-frac60.7%
Applied egg-rr60.7%
Taylor expanded in n around inf 42.7%
associate-/r*43.8%
Simplified43.8%
associate-/l/42.7%
*-commutative42.7%
add-exp-log21.1%
exp-neg21.1%
expm1-log1p-u21.1%
expm1-udef12.8%
add-sqr-sqrt3.7%
sqrt-unprod4.4%
sqr-neg4.4%
sqrt-unprod0.6%
add-sqr-sqrt1.2%
add-exp-log7.9%
*-commutative7.9%
Applied egg-rr7.9%
expm1-def2.4%
expm1-log1p3.1%
Simplified3.1%
Final simplification3.1%
herbie shell --seed 2023257
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))