
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
(FPCore (x n) :precision binary64 (if (or (<= n -21000000000.0) (not (<= n 1e+24))) (/ (log (/ (+ x 1.0) x)) n) (- (exp (/ (log1p x) n)) (pow x (/ 1.0 n)))))
double code(double x, double n) {
double tmp;
if ((n <= -21000000000.0) || !(n <= 1e+24)) {
tmp = log(((x + 1.0) / x)) / n;
} else {
tmp = exp((log1p(x) / n)) - pow(x, (1.0 / n));
}
return tmp;
}
public static double code(double x, double n) {
double tmp;
if ((n <= -21000000000.0) || !(n <= 1e+24)) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else {
tmp = Math.exp((Math.log1p(x) / n)) - Math.pow(x, (1.0 / n));
}
return tmp;
}
def code(x, n): tmp = 0 if (n <= -21000000000.0) or not (n <= 1e+24): tmp = math.log(((x + 1.0) / x)) / n else: tmp = math.exp((math.log1p(x) / n)) - math.pow(x, (1.0 / n)) return tmp
function code(x, n) tmp = 0.0 if ((n <= -21000000000.0) || !(n <= 1e+24)) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); else tmp = Float64(exp(Float64(log1p(x) / n)) - (x ^ Float64(1.0 / n))); end return tmp end
code[x_, n_] := If[Or[LessEqual[n, -21000000000.0], N[Not[LessEqual[n, 1e+24]], $MachinePrecision]], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -21000000000 \lor \neg \left(n \leq 10^{+24}\right):\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - {x}^{\left(\frac{1}{n}\right)}\\
\end{array}
\end{array}
if n < -2.1e10 or 9.9999999999999998e23 < n Initial program 24.3%
Taylor expanded in n around inf 78.7%
diff-log78.8%
Applied egg-rr78.8%
+-commutative78.8%
Simplified78.8%
if -2.1e10 < n < 9.9999999999999998e23Initial program 84.4%
Taylor expanded in n around 0 84.4%
log1p-define98.0%
*-rgt-identity98.0%
associate-*l/98.0%
associate-/l*98.0%
exp-to-pow98.0%
Simplified98.0%
Final simplification87.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -5e-5)
(- (pow (+ x 1.0) (/ 1.0 n)) t_0)
(if (<= (/ 1.0 n) 5e-5)
(/ (log (/ (+ x 1.0) x)) n)
(-
(+ 1.0 (* x (+ (/ 1.0 n) (/ (+ (* x -0.5) (* 0.5 (/ x n))) n))))
t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-5) {
tmp = pow((x + 1.0), (1.0 / n)) - t_0;
} else if ((1.0 / n) <= 5e-5) {
tmp = log(((x + 1.0) / x)) / n;
} else {
tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-5d-5)) then
tmp = ((x + 1.0d0) ** (1.0d0 / n)) - t_0
else if ((1.0d0 / n) <= 5d-5) then
tmp = log(((x + 1.0d0) / x)) / n
else
tmp = (1.0d0 + (x * ((1.0d0 / n) + (((x * (-0.5d0)) + (0.5d0 * (x / n))) / n)))) - t_0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e-5) {
tmp = Math.pow((x + 1.0), (1.0 / n)) - t_0;
} else if ((1.0 / n) <= 5e-5) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else {
tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e-5: tmp = math.pow((x + 1.0), (1.0 / n)) - t_0 elif (1.0 / n) <= 5e-5: tmp = math.log(((x + 1.0) / x)) / n else: tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_0 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -5e-5) tmp = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - t_0); elseif (Float64(1.0 / n) <= 5e-5) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); else tmp = Float64(Float64(1.0 + Float64(x * Float64(Float64(1.0 / n) + Float64(Float64(Float64(x * -0.5) + Float64(0.5 * Float64(x / n))) / n)))) - t_0); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -5e-5) tmp = ((x + 1.0) ^ (1.0 / n)) - t_0; elseif ((1.0 / n) <= 5e-5) tmp = log(((x + 1.0) / x)) / n; else tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_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], -5e-5], N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-5], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 + N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(x * -0.5), $MachinePrecision] + N[(0.5 * N[(x / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $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 -5 \cdot 10^{-5}:\\
\;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-5}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + \frac{x \cdot -0.5 + 0.5 \cdot \frac{x}{n}}{n}\right)\right) - t\_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -5.00000000000000024e-5Initial program 99.7%
if -5.00000000000000024e-5 < (/.f64 1 n) < 5.00000000000000024e-5Initial program 25.0%
Taylor expanded in n around inf 77.9%
diff-log78.0%
Applied egg-rr78.0%
+-commutative78.0%
Simplified78.0%
if 5.00000000000000024e-5 < (/.f64 1 n) Initial program 63.4%
Taylor expanded in x around 0 70.8%
Taylor expanded in n around inf 77.7%
Final simplification83.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (+ (* n -0.3333333333333333) (* n 0.25)))
(t_1 (- 1.0 (pow x (/ 1.0 n))))
(t_2 (/ (log x) (- n))))
(if (<= x 6.8e-298)
t_1
(if (<= x 2.6e-283)
t_2
(if (<= x 3.6e-257)
t_1
(if (<= x 2.8e-163)
t_2
(if (<= x 1.4e-152)
t_1
(if (<= x 1.2e-135)
t_2
(if (<= x 9.2e-94)
(/
(-
(/ 1.0 n)
(/
(-
(* (/ 1.0 n) 0.5)
(* 0.3333333333333333 (/ 1.0 (* n x))))
x))
x)
(if (<= x 5e-79)
t_2
(if (<= x 2.1e-43)
t_1
(if (<= x 0.5)
(/ (- x (log x)) n)
(if (<= x 3.7e+73)
(/
1.0
(*
x
(-
n
(/
(+
(/
(-
(+
(* -0.5 (/ t_0 x))
(+
(* (/ n x) -0.25)
(* (/ n x) 0.16666666666666666)))
t_0)
x)
(* n -0.5))
x))))
0.0)))))))))))))
double code(double x, double n) {
double t_0 = (n * -0.3333333333333333) + (n * 0.25);
double t_1 = 1.0 - pow(x, (1.0 / n));
double t_2 = log(x) / -n;
double tmp;
if (x <= 6.8e-298) {
tmp = t_1;
} else if (x <= 2.6e-283) {
tmp = t_2;
} else if (x <= 3.6e-257) {
tmp = t_1;
} else if (x <= 2.8e-163) {
tmp = t_2;
} else if (x <= 1.4e-152) {
tmp = t_1;
} else if (x <= 1.2e-135) {
tmp = t_2;
} else if (x <= 9.2e-94) {
tmp = ((1.0 / n) - ((((1.0 / n) * 0.5) - (0.3333333333333333 * (1.0 / (n * x)))) / x)) / x;
} else if (x <= 5e-79) {
tmp = t_2;
} else if (x <= 2.1e-43) {
tmp = t_1;
} else if (x <= 0.5) {
tmp = (x - log(x)) / n;
} else if (x <= 3.7e+73) {
tmp = 1.0 / (x * (n - ((((((-0.5 * (t_0 / x)) + (((n / x) * -0.25) + ((n / x) * 0.16666666666666666))) - t_0) / x) + (n * -0.5)) / x)));
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (n * (-0.3333333333333333d0)) + (n * 0.25d0)
t_1 = 1.0d0 - (x ** (1.0d0 / n))
t_2 = log(x) / -n
if (x <= 6.8d-298) then
tmp = t_1
else if (x <= 2.6d-283) then
tmp = t_2
else if (x <= 3.6d-257) then
tmp = t_1
else if (x <= 2.8d-163) then
tmp = t_2
else if (x <= 1.4d-152) then
tmp = t_1
else if (x <= 1.2d-135) then
tmp = t_2
else if (x <= 9.2d-94) then
tmp = ((1.0d0 / n) - ((((1.0d0 / n) * 0.5d0) - (0.3333333333333333d0 * (1.0d0 / (n * x)))) / x)) / x
else if (x <= 5d-79) then
tmp = t_2
else if (x <= 2.1d-43) then
tmp = t_1
else if (x <= 0.5d0) then
tmp = (x - log(x)) / n
else if (x <= 3.7d+73) then
tmp = 1.0d0 / (x * (n - (((((((-0.5d0) * (t_0 / x)) + (((n / x) * (-0.25d0)) + ((n / x) * 0.16666666666666666d0))) - t_0) / x) + (n * (-0.5d0))) / x)))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = (n * -0.3333333333333333) + (n * 0.25);
double t_1 = 1.0 - Math.pow(x, (1.0 / n));
double t_2 = Math.log(x) / -n;
double tmp;
if (x <= 6.8e-298) {
tmp = t_1;
} else if (x <= 2.6e-283) {
tmp = t_2;
} else if (x <= 3.6e-257) {
tmp = t_1;
} else if (x <= 2.8e-163) {
tmp = t_2;
} else if (x <= 1.4e-152) {
tmp = t_1;
} else if (x <= 1.2e-135) {
tmp = t_2;
} else if (x <= 9.2e-94) {
tmp = ((1.0 / n) - ((((1.0 / n) * 0.5) - (0.3333333333333333 * (1.0 / (n * x)))) / x)) / x;
} else if (x <= 5e-79) {
tmp = t_2;
} else if (x <= 2.1e-43) {
tmp = t_1;
} else if (x <= 0.5) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 3.7e+73) {
tmp = 1.0 / (x * (n - ((((((-0.5 * (t_0 / x)) + (((n / x) * -0.25) + ((n / x) * 0.16666666666666666))) - t_0) / x) + (n * -0.5)) / x)));
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): t_0 = (n * -0.3333333333333333) + (n * 0.25) t_1 = 1.0 - math.pow(x, (1.0 / n)) t_2 = math.log(x) / -n tmp = 0 if x <= 6.8e-298: tmp = t_1 elif x <= 2.6e-283: tmp = t_2 elif x <= 3.6e-257: tmp = t_1 elif x <= 2.8e-163: tmp = t_2 elif x <= 1.4e-152: tmp = t_1 elif x <= 1.2e-135: tmp = t_2 elif x <= 9.2e-94: tmp = ((1.0 / n) - ((((1.0 / n) * 0.5) - (0.3333333333333333 * (1.0 / (n * x)))) / x)) / x elif x <= 5e-79: tmp = t_2 elif x <= 2.1e-43: tmp = t_1 elif x <= 0.5: tmp = (x - math.log(x)) / n elif x <= 3.7e+73: tmp = 1.0 / (x * (n - ((((((-0.5 * (t_0 / x)) + (((n / x) * -0.25) + ((n / x) * 0.16666666666666666))) - t_0) / x) + (n * -0.5)) / x))) else: tmp = 0.0 return tmp
function code(x, n) t_0 = Float64(Float64(n * -0.3333333333333333) + Float64(n * 0.25)) t_1 = Float64(1.0 - (x ^ Float64(1.0 / n))) t_2 = Float64(log(x) / Float64(-n)) tmp = 0.0 if (x <= 6.8e-298) tmp = t_1; elseif (x <= 2.6e-283) tmp = t_2; elseif (x <= 3.6e-257) tmp = t_1; elseif (x <= 2.8e-163) tmp = t_2; elseif (x <= 1.4e-152) tmp = t_1; elseif (x <= 1.2e-135) tmp = t_2; elseif (x <= 9.2e-94) tmp = Float64(Float64(Float64(1.0 / n) - Float64(Float64(Float64(Float64(1.0 / n) * 0.5) - Float64(0.3333333333333333 * Float64(1.0 / Float64(n * x)))) / x)) / x); elseif (x <= 5e-79) tmp = t_2; elseif (x <= 2.1e-43) tmp = t_1; elseif (x <= 0.5) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 3.7e+73) tmp = Float64(1.0 / Float64(x * Float64(n - Float64(Float64(Float64(Float64(Float64(Float64(-0.5 * Float64(t_0 / x)) + Float64(Float64(Float64(n / x) * -0.25) + Float64(Float64(n / x) * 0.16666666666666666))) - t_0) / x) + Float64(n * -0.5)) / x)))); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) t_0 = (n * -0.3333333333333333) + (n * 0.25); t_1 = 1.0 - (x ^ (1.0 / n)); t_2 = log(x) / -n; tmp = 0.0; if (x <= 6.8e-298) tmp = t_1; elseif (x <= 2.6e-283) tmp = t_2; elseif (x <= 3.6e-257) tmp = t_1; elseif (x <= 2.8e-163) tmp = t_2; elseif (x <= 1.4e-152) tmp = t_1; elseif (x <= 1.2e-135) tmp = t_2; elseif (x <= 9.2e-94) tmp = ((1.0 / n) - ((((1.0 / n) * 0.5) - (0.3333333333333333 * (1.0 / (n * x)))) / x)) / x; elseif (x <= 5e-79) tmp = t_2; elseif (x <= 2.1e-43) tmp = t_1; elseif (x <= 0.5) tmp = (x - log(x)) / n; elseif (x <= 3.7e+73) tmp = 1.0 / (x * (n - ((((((-0.5 * (t_0 / x)) + (((n / x) * -0.25) + ((n / x) * 0.16666666666666666))) - t_0) / x) + (n * -0.5)) / x))); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(n * -0.3333333333333333), $MachinePrecision] + N[(n * 0.25), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, If[LessEqual[x, 6.8e-298], t$95$1, If[LessEqual[x, 2.6e-283], t$95$2, If[LessEqual[x, 3.6e-257], t$95$1, If[LessEqual[x, 2.8e-163], t$95$2, If[LessEqual[x, 1.4e-152], t$95$1, If[LessEqual[x, 1.2e-135], t$95$2, If[LessEqual[x, 9.2e-94], N[(N[(N[(1.0 / n), $MachinePrecision] - N[(N[(N[(N[(1.0 / n), $MachinePrecision] * 0.5), $MachinePrecision] - N[(0.3333333333333333 * N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 5e-79], t$95$2, If[LessEqual[x, 2.1e-43], t$95$1, If[LessEqual[x, 0.5], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 3.7e+73], N[(1.0 / N[(x * N[(n - N[(N[(N[(N[(N[(N[(-0.5 * N[(t$95$0 / x), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(n / x), $MachinePrecision] * -0.25), $MachinePrecision] + N[(N[(n / x), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision] / x), $MachinePrecision] + N[(n * -0.5), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot -0.3333333333333333 + n \cdot 0.25\\
t_1 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
t_2 := \frac{\log x}{-n}\\
\mathbf{if}\;x \leq 6.8 \cdot 10^{-298}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{-283}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{-257}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-163}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{-152}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{-135}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq 9.2 \cdot 10^{-94}:\\
\;\;\;\;\frac{\frac{1}{n} - \frac{\frac{1}{n} \cdot 0.5 - 0.3333333333333333 \cdot \frac{1}{n \cdot x}}{x}}{x}\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-79}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{-43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 0.5:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 3.7 \cdot 10^{+73}:\\
\;\;\;\;\frac{1}{x \cdot \left(n - \frac{\frac{\left(-0.5 \cdot \frac{t\_0}{x} + \left(\frac{n}{x} \cdot -0.25 + \frac{n}{x} \cdot 0.16666666666666666\right)\right) - t\_0}{x} + n \cdot -0.5}{x}\right)}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 6.8e-298 or 2.6000000000000001e-283 < x < 3.60000000000000007e-257 or 2.8e-163 < x < 1.39999999999999992e-152 or 4.99999999999999999e-79 < x < 2.1000000000000001e-43Initial program 79.9%
Taylor expanded in x around 0 80.0%
*-rgt-identity80.0%
associate-*l/80.0%
associate-/l*80.0%
exp-to-pow79.9%
Simplified79.9%
if 6.8e-298 < x < 2.6000000000000001e-283 or 3.60000000000000007e-257 < x < 2.8e-163 or 1.39999999999999992e-152 < x < 1.1999999999999999e-135 or 9.1999999999999997e-94 < x < 4.99999999999999999e-79Initial program 24.6%
Taylor expanded in n around inf 76.5%
Taylor expanded in x around 0 76.5%
neg-mul-176.5%
Simplified76.5%
if 1.1999999999999999e-135 < x < 9.1999999999999997e-94Initial program 35.9%
Taylor expanded in n around inf 23.1%
Taylor expanded in x around -inf 73.1%
if 2.1000000000000001e-43 < x < 0.5Initial program 33.7%
Taylor expanded in n around inf 58.8%
Taylor expanded in x around 0 53.7%
if 0.5 < x < 3.69999999999999973e73Initial program 29.1%
Taylor expanded in n around inf 31.0%
clear-num31.0%
inv-pow31.0%
log1p-define31.0%
Applied egg-rr31.0%
unpow-131.0%
Simplified31.0%
Taylor expanded in x around -inf 77.7%
if 3.69999999999999973e73 < x Initial program 80.4%
Taylor expanded in x around 0 46.0%
Taylor expanded in n around inf 80.4%
Final simplification76.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (+ (* n -0.3333333333333333) (* n 0.25)))
(t_1 (- 1.0 (pow x (/ 1.0 n))))
(t_2 (/ -1.0 (/ n (log x))))
(t_3 (/ (log x) (- n))))
(if (<= x 5.8e-298)
t_1
(if (<= x 4.8e-282)
t_2
(if (<= x 1.9e-257)
t_1
(if (<= x 2.75e-163)
t_2
(if (<= x 1.5e-152)
t_1
(if (<= x 1.2e-135)
t_3
(if (<= x 3.1e-94)
(/
(-
(/ 1.0 n)
(/
(-
(* (/ 1.0 n) 0.5)
(* 0.3333333333333333 (/ 1.0 (* n x))))
x))
x)
(if (<= x 6e-79)
t_3
(if (<= x 7.5e-43)
t_1
(if (<= x 0.5)
(/ (- x (log x)) n)
(if (<= x 1.12e+74)
(/
1.0
(*
x
(-
n
(/
(+
(/
(-
(+
(* -0.5 (/ t_0 x))
(+
(* (/ n x) -0.25)
(* (/ n x) 0.16666666666666666)))
t_0)
x)
(* n -0.5))
x))))
0.0)))))))))))))
double code(double x, double n) {
double t_0 = (n * -0.3333333333333333) + (n * 0.25);
double t_1 = 1.0 - pow(x, (1.0 / n));
double t_2 = -1.0 / (n / log(x));
double t_3 = log(x) / -n;
double tmp;
if (x <= 5.8e-298) {
tmp = t_1;
} else if (x <= 4.8e-282) {
tmp = t_2;
} else if (x <= 1.9e-257) {
tmp = t_1;
} else if (x <= 2.75e-163) {
tmp = t_2;
} else if (x <= 1.5e-152) {
tmp = t_1;
} else if (x <= 1.2e-135) {
tmp = t_3;
} else if (x <= 3.1e-94) {
tmp = ((1.0 / n) - ((((1.0 / n) * 0.5) - (0.3333333333333333 * (1.0 / (n * x)))) / x)) / x;
} else if (x <= 6e-79) {
tmp = t_3;
} else if (x <= 7.5e-43) {
tmp = t_1;
} else if (x <= 0.5) {
tmp = (x - log(x)) / n;
} else if (x <= 1.12e+74) {
tmp = 1.0 / (x * (n - ((((((-0.5 * (t_0 / x)) + (((n / x) * -0.25) + ((n / x) * 0.16666666666666666))) - t_0) / x) + (n * -0.5)) / x)));
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = (n * (-0.3333333333333333d0)) + (n * 0.25d0)
t_1 = 1.0d0 - (x ** (1.0d0 / n))
t_2 = (-1.0d0) / (n / log(x))
t_3 = log(x) / -n
if (x <= 5.8d-298) then
tmp = t_1
else if (x <= 4.8d-282) then
tmp = t_2
else if (x <= 1.9d-257) then
tmp = t_1
else if (x <= 2.75d-163) then
tmp = t_2
else if (x <= 1.5d-152) then
tmp = t_1
else if (x <= 1.2d-135) then
tmp = t_3
else if (x <= 3.1d-94) then
tmp = ((1.0d0 / n) - ((((1.0d0 / n) * 0.5d0) - (0.3333333333333333d0 * (1.0d0 / (n * x)))) / x)) / x
else if (x <= 6d-79) then
tmp = t_3
else if (x <= 7.5d-43) then
tmp = t_1
else if (x <= 0.5d0) then
tmp = (x - log(x)) / n
else if (x <= 1.12d+74) then
tmp = 1.0d0 / (x * (n - (((((((-0.5d0) * (t_0 / x)) + (((n / x) * (-0.25d0)) + ((n / x) * 0.16666666666666666d0))) - t_0) / x) + (n * (-0.5d0))) / x)))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = (n * -0.3333333333333333) + (n * 0.25);
double t_1 = 1.0 - Math.pow(x, (1.0 / n));
double t_2 = -1.0 / (n / Math.log(x));
double t_3 = Math.log(x) / -n;
double tmp;
if (x <= 5.8e-298) {
tmp = t_1;
} else if (x <= 4.8e-282) {
tmp = t_2;
} else if (x <= 1.9e-257) {
tmp = t_1;
} else if (x <= 2.75e-163) {
tmp = t_2;
} else if (x <= 1.5e-152) {
tmp = t_1;
} else if (x <= 1.2e-135) {
tmp = t_3;
} else if (x <= 3.1e-94) {
tmp = ((1.0 / n) - ((((1.0 / n) * 0.5) - (0.3333333333333333 * (1.0 / (n * x)))) / x)) / x;
} else if (x <= 6e-79) {
tmp = t_3;
} else if (x <= 7.5e-43) {
tmp = t_1;
} else if (x <= 0.5) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 1.12e+74) {
tmp = 1.0 / (x * (n - ((((((-0.5 * (t_0 / x)) + (((n / x) * -0.25) + ((n / x) * 0.16666666666666666))) - t_0) / x) + (n * -0.5)) / x)));
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): t_0 = (n * -0.3333333333333333) + (n * 0.25) t_1 = 1.0 - math.pow(x, (1.0 / n)) t_2 = -1.0 / (n / math.log(x)) t_3 = math.log(x) / -n tmp = 0 if x <= 5.8e-298: tmp = t_1 elif x <= 4.8e-282: tmp = t_2 elif x <= 1.9e-257: tmp = t_1 elif x <= 2.75e-163: tmp = t_2 elif x <= 1.5e-152: tmp = t_1 elif x <= 1.2e-135: tmp = t_3 elif x <= 3.1e-94: tmp = ((1.0 / n) - ((((1.0 / n) * 0.5) - (0.3333333333333333 * (1.0 / (n * x)))) / x)) / x elif x <= 6e-79: tmp = t_3 elif x <= 7.5e-43: tmp = t_1 elif x <= 0.5: tmp = (x - math.log(x)) / n elif x <= 1.12e+74: tmp = 1.0 / (x * (n - ((((((-0.5 * (t_0 / x)) + (((n / x) * -0.25) + ((n / x) * 0.16666666666666666))) - t_0) / x) + (n * -0.5)) / x))) else: tmp = 0.0 return tmp
function code(x, n) t_0 = Float64(Float64(n * -0.3333333333333333) + Float64(n * 0.25)) t_1 = Float64(1.0 - (x ^ Float64(1.0 / n))) t_2 = Float64(-1.0 / Float64(n / log(x))) t_3 = Float64(log(x) / Float64(-n)) tmp = 0.0 if (x <= 5.8e-298) tmp = t_1; elseif (x <= 4.8e-282) tmp = t_2; elseif (x <= 1.9e-257) tmp = t_1; elseif (x <= 2.75e-163) tmp = t_2; elseif (x <= 1.5e-152) tmp = t_1; elseif (x <= 1.2e-135) tmp = t_3; elseif (x <= 3.1e-94) tmp = Float64(Float64(Float64(1.0 / n) - Float64(Float64(Float64(Float64(1.0 / n) * 0.5) - Float64(0.3333333333333333 * Float64(1.0 / Float64(n * x)))) / x)) / x); elseif (x <= 6e-79) tmp = t_3; elseif (x <= 7.5e-43) tmp = t_1; elseif (x <= 0.5) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 1.12e+74) tmp = Float64(1.0 / Float64(x * Float64(n - Float64(Float64(Float64(Float64(Float64(Float64(-0.5 * Float64(t_0 / x)) + Float64(Float64(Float64(n / x) * -0.25) + Float64(Float64(n / x) * 0.16666666666666666))) - t_0) / x) + Float64(n * -0.5)) / x)))); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) t_0 = (n * -0.3333333333333333) + (n * 0.25); t_1 = 1.0 - (x ^ (1.0 / n)); t_2 = -1.0 / (n / log(x)); t_3 = log(x) / -n; tmp = 0.0; if (x <= 5.8e-298) tmp = t_1; elseif (x <= 4.8e-282) tmp = t_2; elseif (x <= 1.9e-257) tmp = t_1; elseif (x <= 2.75e-163) tmp = t_2; elseif (x <= 1.5e-152) tmp = t_1; elseif (x <= 1.2e-135) tmp = t_3; elseif (x <= 3.1e-94) tmp = ((1.0 / n) - ((((1.0 / n) * 0.5) - (0.3333333333333333 * (1.0 / (n * x)))) / x)) / x; elseif (x <= 6e-79) tmp = t_3; elseif (x <= 7.5e-43) tmp = t_1; elseif (x <= 0.5) tmp = (x - log(x)) / n; elseif (x <= 1.12e+74) tmp = 1.0 / (x * (n - ((((((-0.5 * (t_0 / x)) + (((n / x) * -0.25) + ((n / x) * 0.16666666666666666))) - t_0) / x) + (n * -0.5)) / x))); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(n * -0.3333333333333333), $MachinePrecision] + N[(n * 0.25), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-1.0 / N[(n / N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, If[LessEqual[x, 5.8e-298], t$95$1, If[LessEqual[x, 4.8e-282], t$95$2, If[LessEqual[x, 1.9e-257], t$95$1, If[LessEqual[x, 2.75e-163], t$95$2, If[LessEqual[x, 1.5e-152], t$95$1, If[LessEqual[x, 1.2e-135], t$95$3, If[LessEqual[x, 3.1e-94], N[(N[(N[(1.0 / n), $MachinePrecision] - N[(N[(N[(N[(1.0 / n), $MachinePrecision] * 0.5), $MachinePrecision] - N[(0.3333333333333333 * N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 6e-79], t$95$3, If[LessEqual[x, 7.5e-43], t$95$1, If[LessEqual[x, 0.5], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 1.12e+74], N[(1.0 / N[(x * N[(n - N[(N[(N[(N[(N[(N[(-0.5 * N[(t$95$0 / x), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(n / x), $MachinePrecision] * -0.25), $MachinePrecision] + N[(N[(n / x), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision] / x), $MachinePrecision] + N[(n * -0.5), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]]]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot -0.3333333333333333 + n \cdot 0.25\\
t_1 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
t_2 := \frac{-1}{\frac{n}{\log x}}\\
t_3 := \frac{\log x}{-n}\\
\mathbf{if}\;x \leq 5.8 \cdot 10^{-298}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{-282}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{-257}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.75 \cdot 10^{-163}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{-152}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{-135}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{-94}:\\
\;\;\;\;\frac{\frac{1}{n} - \frac{\frac{1}{n} \cdot 0.5 - 0.3333333333333333 \cdot \frac{1}{n \cdot x}}{x}}{x}\\
\mathbf{elif}\;x \leq 6 \cdot 10^{-79}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 0.5:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 1.12 \cdot 10^{+74}:\\
\;\;\;\;\frac{1}{x \cdot \left(n - \frac{\frac{\left(-0.5 \cdot \frac{t\_0}{x} + \left(\frac{n}{x} \cdot -0.25 + \frac{n}{x} \cdot 0.16666666666666666\right)\right) - t\_0}{x} + n \cdot -0.5}{x}\right)}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 5.8000000000000003e-298 or 4.79999999999999994e-282 < x < 1.9000000000000002e-257 or 2.7499999999999999e-163 < x < 1.5e-152 or 5.99999999999999999e-79 < x < 7.50000000000000068e-43Initial program 79.9%
Taylor expanded in x around 0 80.0%
*-rgt-identity80.0%
associate-*l/80.0%
associate-/l*80.0%
exp-to-pow79.9%
Simplified79.9%
if 5.8000000000000003e-298 < x < 4.79999999999999994e-282 or 1.9000000000000002e-257 < x < 2.7499999999999999e-163Initial program 29.6%
Taylor expanded in n around inf 71.8%
clear-num71.9%
inv-pow71.9%
log1p-define71.9%
Applied egg-rr71.9%
unpow-171.9%
Simplified71.9%
Taylor expanded in x around 0 71.9%
associate-*r/71.9%
neg-mul-171.9%
Simplified71.9%
if 1.5e-152 < x < 1.1999999999999999e-135 or 3.0999999999999998e-94 < x < 5.99999999999999999e-79Initial program 10.1%
Taylor expanded in n around inf 90.1%
Taylor expanded in x around 0 90.1%
neg-mul-190.1%
Simplified90.1%
if 1.1999999999999999e-135 < x < 3.0999999999999998e-94Initial program 35.9%
Taylor expanded in n around inf 23.1%
Taylor expanded in x around -inf 73.1%
if 7.50000000000000068e-43 < x < 0.5Initial program 33.7%
Taylor expanded in n around inf 58.8%
Taylor expanded in x around 0 53.7%
if 0.5 < x < 1.12000000000000003e74Initial program 29.1%
Taylor expanded in n around inf 31.0%
clear-num31.0%
inv-pow31.0%
log1p-define31.0%
Applied egg-rr31.0%
unpow-131.0%
Simplified31.0%
Taylor expanded in x around -inf 77.7%
if 1.12000000000000003e74 < x Initial program 80.4%
Taylor expanded in x around 0 46.0%
Taylor expanded in n around inf 80.4%
Final simplification76.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-27)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 5e-5)
(/ (log (/ (+ x 1.0) x)) n)
(-
(+ 1.0 (* x (+ (/ 1.0 n) (/ (+ (* x -0.5) (* 0.5 (/ x n))) n))))
t_0)))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-27) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 5e-5) {
tmp = log(((x + 1.0) / x)) / n;
} else {
tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-1d-27)) then
tmp = (t_0 / n) / x
else if ((1.0d0 / n) <= 5d-5) then
tmp = log(((x + 1.0d0) / x)) / n
else
tmp = (1.0d0 + (x * ((1.0d0 / n) + (((x * (-0.5d0)) + (0.5d0 * (x / n))) / n)))) - t_0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-27) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 5e-5) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else {
tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_0;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-27: tmp = (t_0 / n) / x elif (1.0 / n) <= 5e-5: tmp = math.log(((x + 1.0) / x)) / n else: tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / 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-27) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 5e-5) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); else tmp = Float64(Float64(1.0 + Float64(x * Float64(Float64(1.0 / n) + Float64(Float64(Float64(x * -0.5) + Float64(0.5 * Float64(x / n))) / n)))) - t_0); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -1e-27) tmp = (t_0 / n) / x; elseif ((1.0 / n) <= 5e-5) tmp = log(((x + 1.0) / x)) / n; else tmp = (1.0 + (x * ((1.0 / n) + (((x * -0.5) + (0.5 * (x / n))) / n)))) - t_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], -1e-27], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-5], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], N[(N[(1.0 + N[(x * N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(x * -0.5), $MachinePrecision] + N[(0.5 * N[(x / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $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^{-27}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-5}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + x \cdot \left(\frac{1}{n} + \frac{x \cdot -0.5 + 0.5 \cdot \frac{x}{n}}{n}\right)\right) - t\_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -1e-27Initial program 98.3%
Taylor expanded in x around inf 94.5%
associate-/r*94.5%
mul-1-neg94.5%
log-rec94.5%
mul-1-neg94.5%
distribute-neg-frac94.5%
mul-1-neg94.5%
remove-double-neg94.5%
*-rgt-identity94.5%
associate-/l*94.5%
exp-to-pow94.5%
Simplified94.5%
if -1e-27 < (/.f64 1 n) < 5.00000000000000024e-5Initial program 25.1%
Taylor expanded in n around inf 78.4%
diff-log78.5%
Applied egg-rr78.5%
+-commutative78.5%
Simplified78.5%
if 5.00000000000000024e-5 < (/.f64 1 n) Initial program 63.4%
Taylor expanded in x around 0 70.8%
Taylor expanded in n around inf 77.7%
Final simplification82.7%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-27)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 5e-5)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 5e+218)
(- (+ 1.0 (/ x n)) t_0)
(/ 1.0 (+ -1.0 (- 1.0 (/ n (log x))))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-27) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 5e-5) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e+218) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 1.0 / (-1.0 + (1.0 - (n / log(x))));
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-1d-27)) then
tmp = (t_0 / n) / x
else if ((1.0d0 / n) <= 5d-5) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 5d+218) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = 1.0d0 / ((-1.0d0) + (1.0d0 - (n / log(x))))
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-27) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 5e-5) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e+218) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = 1.0 / (-1.0 + (1.0 - (n / Math.log(x))));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-27: tmp = (t_0 / n) / x elif (1.0 / n) <= 5e-5: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 5e+218: tmp = (1.0 + (x / n)) - t_0 else: tmp = 1.0 / (-1.0 + (1.0 - (n / math.log(x)))) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-27) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 5e-5) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 5e+218) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(1.0 / Float64(-1.0 + Float64(1.0 - Float64(n / log(x))))); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -1e-27) tmp = (t_0 / n) / x; elseif ((1.0 / n) <= 5e-5) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 5e+218) tmp = (1.0 + (x / n)) - t_0; else tmp = 1.0 / (-1.0 + (1.0 - (n / log(x)))); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-27], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-5], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+218], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(1.0 / N[(-1.0 + N[(1.0 - N[(n / N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-27}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-5}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+218}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{-1 + \left(1 - \frac{n}{\log x}\right)}\\
\end{array}
\end{array}
if (/.f64 1 n) < -1e-27Initial program 98.3%
Taylor expanded in x around inf 94.5%
associate-/r*94.5%
mul-1-neg94.5%
log-rec94.5%
mul-1-neg94.5%
distribute-neg-frac94.5%
mul-1-neg94.5%
remove-double-neg94.5%
*-rgt-identity94.5%
associate-/l*94.5%
exp-to-pow94.5%
Simplified94.5%
if -1e-27 < (/.f64 1 n) < 5.00000000000000024e-5Initial program 25.1%
Taylor expanded in n around inf 78.4%
diff-log78.5%
Applied egg-rr78.5%
+-commutative78.5%
Simplified78.5%
if 5.00000000000000024e-5 < (/.f64 1 n) < 4.99999999999999983e218Initial program 79.8%
Taylor expanded in x around 0 74.2%
if 4.99999999999999983e218 < (/.f64 1 n) Initial program 25.5%
Taylor expanded in n around inf 8.0%
clear-num8.0%
inv-pow8.0%
log1p-define8.0%
Applied egg-rr8.0%
unpow-18.0%
Simplified8.0%
Taylor expanded in x around 0 8.0%
associate-*r/8.0%
neg-mul-18.0%
Simplified8.0%
expm1-log1p-u8.0%
expm1-undefine92.5%
Applied egg-rr92.5%
sub-neg92.5%
metadata-eval92.5%
+-commutative92.5%
log1p-undefine92.5%
rem-exp-log92.5%
distribute-frac-neg92.5%
unsub-neg92.5%
Simplified92.5%
Final simplification83.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (- x (log x)) n)))
(if (<= n -2.5)
t_0
(if (<= n 2.1e-219)
(/ (/ 0.25 n) (pow x 4.0))
(if (<= n 1e+24)
(- 1.0 (pow x (/ 1.0 n)))
(if (or (<= n 3e+139) (not (<= n 2.85e+197)))
t_0
(/ 1.0 (* x (+ n (* 0.5 (/ n x)))))))))))
double code(double x, double n) {
double t_0 = (x - log(x)) / n;
double tmp;
if (n <= -2.5) {
tmp = t_0;
} else if (n <= 2.1e-219) {
tmp = (0.25 / n) / pow(x, 4.0);
} else if (n <= 1e+24) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if ((n <= 3e+139) || !(n <= 2.85e+197)) {
tmp = t_0;
} else {
tmp = 1.0 / (x * (n + (0.5 * (n / x))));
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = (x - log(x)) / n
if (n <= (-2.5d0)) then
tmp = t_0
else if (n <= 2.1d-219) then
tmp = (0.25d0 / n) / (x ** 4.0d0)
else if (n <= 1d+24) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if ((n <= 3d+139) .or. (.not. (n <= 2.85d+197))) then
tmp = t_0
else
tmp = 1.0d0 / (x * (n + (0.5d0 * (n / x))))
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = (x - Math.log(x)) / n;
double tmp;
if (n <= -2.5) {
tmp = t_0;
} else if (n <= 2.1e-219) {
tmp = (0.25 / n) / Math.pow(x, 4.0);
} else if (n <= 1e+24) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if ((n <= 3e+139) || !(n <= 2.85e+197)) {
tmp = t_0;
} else {
tmp = 1.0 / (x * (n + (0.5 * (n / x))));
}
return tmp;
}
def code(x, n): t_0 = (x - math.log(x)) / n tmp = 0 if n <= -2.5: tmp = t_0 elif n <= 2.1e-219: tmp = (0.25 / n) / math.pow(x, 4.0) elif n <= 1e+24: tmp = 1.0 - math.pow(x, (1.0 / n)) elif (n <= 3e+139) or not (n <= 2.85e+197): tmp = t_0 else: tmp = 1.0 / (x * (n + (0.5 * (n / x)))) return tmp
function code(x, n) t_0 = Float64(Float64(x - log(x)) / n) tmp = 0.0 if (n <= -2.5) tmp = t_0; elseif (n <= 2.1e-219) tmp = Float64(Float64(0.25 / n) / (x ^ 4.0)); elseif (n <= 1e+24) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif ((n <= 3e+139) || !(n <= 2.85e+197)) tmp = t_0; else tmp = Float64(1.0 / Float64(x * Float64(n + Float64(0.5 * Float64(n / x))))); end return tmp end
function tmp_2 = code(x, n) t_0 = (x - log(x)) / n; tmp = 0.0; if (n <= -2.5) tmp = t_0; elseif (n <= 2.1e-219) tmp = (0.25 / n) / (x ^ 4.0); elseif (n <= 1e+24) tmp = 1.0 - (x ^ (1.0 / n)); elseif ((n <= 3e+139) || ~((n <= 2.85e+197))) tmp = t_0; else tmp = 1.0 / (x * (n + (0.5 * (n / x)))); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]}, If[LessEqual[n, -2.5], t$95$0, If[LessEqual[n, 2.1e-219], N[(N[(0.25 / n), $MachinePrecision] / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1e+24], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[n, 3e+139], N[Not[LessEqual[n, 2.85e+197]], $MachinePrecision]], t$95$0, N[(1.0 / N[(x * N[(n + N[(0.5 * N[(n / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x - \log x}{n}\\
\mathbf{if}\;n \leq -2.5:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 2.1 \cdot 10^{-219}:\\
\;\;\;\;\frac{\frac{0.25}{n}}{{x}^{4}}\\
\mathbf{elif}\;n \leq 10^{+24}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;n \leq 3 \cdot 10^{+139} \lor \neg \left(n \leq 2.85 \cdot 10^{+197}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot \left(n + 0.5 \cdot \frac{n}{x}\right)}\\
\end{array}
\end{array}
if n < -2.5 or 9.9999999999999998e23 < n < 3e139 or 2.85000000000000011e197 < n Initial program 22.8%
Taylor expanded in n around inf 75.9%
Taylor expanded in x around 0 59.7%
if -2.5 < n < 2.1e-219Initial program 87.4%
Taylor expanded in n around inf 41.1%
Taylor expanded in x around -inf 1.2%
add-sqr-sqrt0.0%
sqrt-unprod17.5%
sqr-neg17.5%
mul-1-neg17.5%
mul-1-neg17.5%
sqrt-unprod1.2%
add-sqr-sqrt53.9%
Applied egg-rr53.9%
neg-sub053.9%
distribute-neg-frac53.9%
Simplified53.9%
Taylor expanded in x around 0 81.5%
associate-/r*81.5%
Simplified81.5%
if 2.1e-219 < n < 9.9999999999999998e23Initial program 76.2%
Taylor expanded in x around 0 70.3%
*-rgt-identity70.3%
associate-*l/70.3%
associate-/l*70.3%
exp-to-pow70.3%
Simplified70.3%
if 3e139 < n < 2.85000000000000011e197Initial program 55.3%
Taylor expanded in n around inf 86.5%
clear-num86.6%
inv-pow86.6%
log1p-define86.6%
Applied egg-rr86.6%
unpow-186.6%
Simplified86.6%
Taylor expanded in x around inf 70.9%
Final simplification68.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-27)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 5e-5)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 5e+218)
(- 1.0 t_0)
(/ 1.0 (+ -1.0 (- 1.0 (/ n (log x))))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-27) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 5e-5) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e+218) {
tmp = 1.0 - t_0;
} else {
tmp = 1.0 / (-1.0 + (1.0 - (n / log(x))));
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-1d-27)) then
tmp = (t_0 / n) / x
else if ((1.0d0 / n) <= 5d-5) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 5d+218) then
tmp = 1.0d0 - t_0
else
tmp = 1.0d0 / ((-1.0d0) + (1.0d0 - (n / log(x))))
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-27) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 5e-5) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e+218) {
tmp = 1.0 - t_0;
} else {
tmp = 1.0 / (-1.0 + (1.0 - (n / Math.log(x))));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-27: tmp = (t_0 / n) / x elif (1.0 / n) <= 5e-5: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 5e+218: tmp = 1.0 - t_0 else: tmp = 1.0 / (-1.0 + (1.0 - (n / math.log(x)))) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-27) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 5e-5) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 5e+218) tmp = Float64(1.0 - t_0); else tmp = Float64(1.0 / Float64(-1.0 + Float64(1.0 - Float64(n / log(x))))); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -1e-27) tmp = (t_0 / n) / x; elseif ((1.0 / n) <= 5e-5) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 5e+218) tmp = 1.0 - t_0; else tmp = 1.0 / (-1.0 + (1.0 - (n / log(x)))); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-27], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-5], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+218], N[(1.0 - t$95$0), $MachinePrecision], N[(1.0 / N[(-1.0 + N[(1.0 - N[(n / N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-27}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-5}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+218}:\\
\;\;\;\;1 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{-1 + \left(1 - \frac{n}{\log x}\right)}\\
\end{array}
\end{array}
if (/.f64 1 n) < -1e-27Initial program 98.3%
Taylor expanded in x around inf 94.5%
associate-/r*94.5%
mul-1-neg94.5%
log-rec94.5%
mul-1-neg94.5%
distribute-neg-frac94.5%
mul-1-neg94.5%
remove-double-neg94.5%
*-rgt-identity94.5%
associate-/l*94.5%
exp-to-pow94.5%
Simplified94.5%
if -1e-27 < (/.f64 1 n) < 5.00000000000000024e-5Initial program 25.1%
Taylor expanded in n around inf 78.4%
diff-log78.5%
Applied egg-rr78.5%
+-commutative78.5%
Simplified78.5%
if 5.00000000000000024e-5 < (/.f64 1 n) < 4.99999999999999983e218Initial program 79.8%
Taylor expanded in x around 0 73.3%
*-rgt-identity73.3%
associate-*l/73.3%
associate-/l*73.3%
exp-to-pow73.3%
Simplified73.3%
if 4.99999999999999983e218 < (/.f64 1 n) Initial program 25.5%
Taylor expanded in n around inf 8.0%
clear-num8.0%
inv-pow8.0%
log1p-define8.0%
Applied egg-rr8.0%
unpow-18.0%
Simplified8.0%
Taylor expanded in x around 0 8.0%
associate-*r/8.0%
neg-mul-18.0%
Simplified8.0%
expm1-log1p-u8.0%
expm1-undefine92.5%
Applied egg-rr92.5%
sub-neg92.5%
metadata-eval92.5%
+-commutative92.5%
log1p-undefine92.5%
rem-exp-log92.5%
distribute-frac-neg92.5%
unsub-neg92.5%
Simplified92.5%
Final simplification82.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (/ 0.25 n) (pow x 4.0))))
(if (<= (/ 1.0 n) -2000000.0)
t_0
(if (<= (/ 1.0 n) 5e-5)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 5e+218) (- 1.0 (pow x (/ 1.0 n))) t_0)))))
double code(double x, double n) {
double t_0 = (0.25 / n) / pow(x, 4.0);
double tmp;
if ((1.0 / n) <= -2000000.0) {
tmp = t_0;
} else if ((1.0 / n) <= 5e-5) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e+218) {
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.25d0 / n) / (x ** 4.0d0)
if ((1.0d0 / n) <= (-2000000.0d0)) then
tmp = t_0
else if ((1.0d0 / n) <= 5d-5) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 5d+218) 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.25 / n) / Math.pow(x, 4.0);
double tmp;
if ((1.0 / n) <= -2000000.0) {
tmp = t_0;
} else if ((1.0 / n) <= 5e-5) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e+218) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, n): t_0 = (0.25 / n) / math.pow(x, 4.0) tmp = 0 if (1.0 / n) <= -2000000.0: tmp = t_0 elif (1.0 / n) <= 5e-5: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 5e+218: tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = t_0 return tmp
function code(x, n) t_0 = Float64(Float64(0.25 / n) / (x ^ 4.0)) tmp = 0.0 if (Float64(1.0 / n) <= -2000000.0) tmp = t_0; elseif (Float64(1.0 / n) <= 5e-5) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 5e+218) 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.25 / n) / (x ^ 4.0); tmp = 0.0; if ((1.0 / n) <= -2000000.0) tmp = t_0; elseif ((1.0 / n) <= 5e-5) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 5e+218) tmp = 1.0 - (x ^ (1.0 / n)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(0.25 / n), $MachinePrecision] / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -2000000.0], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-5], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+218], 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{\frac{0.25}{n}}{{x}^{4}}\\
\mathbf{if}\;\frac{1}{n} \leq -2000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-5}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+218}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (/.f64 1 n) < -2e6 or 4.99999999999999983e218 < (/.f64 1 n) Initial program 87.4%
Taylor expanded in n around inf 41.1%
Taylor expanded in x around -inf 1.2%
add-sqr-sqrt0.0%
sqrt-unprod17.5%
sqr-neg17.5%
mul-1-neg17.5%
mul-1-neg17.5%
sqrt-unprod1.2%
add-sqr-sqrt53.9%
Applied egg-rr53.9%
neg-sub053.9%
distribute-neg-frac53.9%
Simplified53.9%
Taylor expanded in x around 0 81.5%
associate-/r*81.5%
Simplified81.5%
if -2e6 < (/.f64 1 n) < 5.00000000000000024e-5Initial program 26.8%
Taylor expanded in n around inf 76.3%
diff-log76.4%
Applied egg-rr76.4%
+-commutative76.4%
Simplified76.4%
if 5.00000000000000024e-5 < (/.f64 1 n) < 4.99999999999999983e218Initial program 79.8%
Taylor expanded in x around 0 73.3%
*-rgt-identity73.3%
associate-*l/73.3%
associate-/l*73.3%
exp-to-pow73.3%
Simplified73.3%
Final simplification77.6%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-27)
(/ (/ t_0 n) x)
(if (<= (/ 1.0 n) 5e-5)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 5e+218) (- 1.0 t_0) (/ (/ 0.25 n) (pow x 4.0)))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-27) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 5e-5) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e+218) {
tmp = 1.0 - t_0;
} else {
tmp = (0.25 / n) / pow(x, 4.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) <= (-1d-27)) then
tmp = (t_0 / n) / x
else if ((1.0d0 / n) <= 5d-5) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 5d+218) then
tmp = 1.0d0 - t_0
else
tmp = (0.25d0 / n) / (x ** 4.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) <= -1e-27) {
tmp = (t_0 / n) / x;
} else if ((1.0 / n) <= 5e-5) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e+218) {
tmp = 1.0 - t_0;
} else {
tmp = (0.25 / n) / Math.pow(x, 4.0);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-27: tmp = (t_0 / n) / x elif (1.0 / n) <= 5e-5: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 5e+218: tmp = 1.0 - t_0 else: tmp = (0.25 / n) / math.pow(x, 4.0) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-27) tmp = Float64(Float64(t_0 / n) / x); elseif (Float64(1.0 / n) <= 5e-5) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 5e+218) tmp = Float64(1.0 - t_0); else tmp = Float64(Float64(0.25 / n) / (x ^ 4.0)); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); tmp = 0.0; if ((1.0 / n) <= -1e-27) tmp = (t_0 / n) / x; elseif ((1.0 / n) <= 5e-5) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 5e+218) tmp = 1.0 - t_0; else tmp = (0.25 / n) / (x ^ 4.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], -1e-27], N[(N[(t$95$0 / n), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-5], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e+218], N[(1.0 - t$95$0), $MachinePrecision], N[(N[(0.25 / n), $MachinePrecision] / N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-27}:\\
\;\;\;\;\frac{\frac{t\_0}{n}}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-5}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{+218}:\\
\;\;\;\;1 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0.25}{n}}{{x}^{4}}\\
\end{array}
\end{array}
if (/.f64 1 n) < -1e-27Initial program 98.3%
Taylor expanded in x around inf 94.5%
associate-/r*94.5%
mul-1-neg94.5%
log-rec94.5%
mul-1-neg94.5%
distribute-neg-frac94.5%
mul-1-neg94.5%
remove-double-neg94.5%
*-rgt-identity94.5%
associate-/l*94.5%
exp-to-pow94.5%
Simplified94.5%
if -1e-27 < (/.f64 1 n) < 5.00000000000000024e-5Initial program 25.1%
Taylor expanded in n around inf 78.4%
diff-log78.5%
Applied egg-rr78.5%
+-commutative78.5%
Simplified78.5%
if 5.00000000000000024e-5 < (/.f64 1 n) < 4.99999999999999983e218Initial program 79.8%
Taylor expanded in x around 0 73.3%
*-rgt-identity73.3%
associate-*l/73.3%
associate-/l*73.3%
exp-to-pow73.3%
Simplified73.3%
if 4.99999999999999983e218 < (/.f64 1 n) Initial program 25.5%
Taylor expanded in n around inf 8.0%
Taylor expanded in x around -inf 0.1%
add-sqr-sqrt0.1%
sqrt-unprod0.1%
sqr-neg0.1%
mul-1-neg0.1%
mul-1-neg0.1%
sqrt-unprod0.0%
add-sqr-sqrt79.0%
Applied egg-rr79.0%
neg-sub079.0%
distribute-neg-frac79.0%
Simplified79.0%
Taylor expanded in x around 0 79.0%
associate-/r*79.0%
Simplified79.0%
Final simplification82.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (+ (* n -0.3333333333333333) (* n 0.25))))
(if (<= x 9.5e-136)
(/ (log x) (- n))
(if (<= x 4.5e-94)
(/
(-
(/ 1.0 n)
(/ (- (* (/ 1.0 n) 0.5) (* 0.3333333333333333 (/ 1.0 (* n x)))) x))
x)
(if (<= x 0.5)
(/ (- x (log x)) n)
(if (<= x 8.8e+73)
(/
1.0
(*
x
(-
n
(/
(+
(/
(-
(+
(* -0.5 (/ t_0 x))
(+ (* (/ n x) -0.25) (* (/ n x) 0.16666666666666666)))
t_0)
x)
(* n -0.5))
x))))
0.0))))))
double code(double x, double n) {
double t_0 = (n * -0.3333333333333333) + (n * 0.25);
double tmp;
if (x <= 9.5e-136) {
tmp = log(x) / -n;
} else if (x <= 4.5e-94) {
tmp = ((1.0 / n) - ((((1.0 / n) * 0.5) - (0.3333333333333333 * (1.0 / (n * x)))) / x)) / x;
} else if (x <= 0.5) {
tmp = (x - log(x)) / n;
} else if (x <= 8.8e+73) {
tmp = 1.0 / (x * (n - ((((((-0.5 * (t_0 / x)) + (((n / x) * -0.25) + ((n / x) * 0.16666666666666666))) - t_0) / x) + (n * -0.5)) / x)));
} else {
tmp = 0.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 = (n * (-0.3333333333333333d0)) + (n * 0.25d0)
if (x <= 9.5d-136) then
tmp = log(x) / -n
else if (x <= 4.5d-94) then
tmp = ((1.0d0 / n) - ((((1.0d0 / n) * 0.5d0) - (0.3333333333333333d0 * (1.0d0 / (n * x)))) / x)) / x
else if (x <= 0.5d0) then
tmp = (x - log(x)) / n
else if (x <= 8.8d+73) then
tmp = 1.0d0 / (x * (n - (((((((-0.5d0) * (t_0 / x)) + (((n / x) * (-0.25d0)) + ((n / x) * 0.16666666666666666d0))) - t_0) / x) + (n * (-0.5d0))) / x)))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = (n * -0.3333333333333333) + (n * 0.25);
double tmp;
if (x <= 9.5e-136) {
tmp = Math.log(x) / -n;
} else if (x <= 4.5e-94) {
tmp = ((1.0 / n) - ((((1.0 / n) * 0.5) - (0.3333333333333333 * (1.0 / (n * x)))) / x)) / x;
} else if (x <= 0.5) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 8.8e+73) {
tmp = 1.0 / (x * (n - ((((((-0.5 * (t_0 / x)) + (((n / x) * -0.25) + ((n / x) * 0.16666666666666666))) - t_0) / x) + (n * -0.5)) / x)));
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): t_0 = (n * -0.3333333333333333) + (n * 0.25) tmp = 0 if x <= 9.5e-136: tmp = math.log(x) / -n elif x <= 4.5e-94: tmp = ((1.0 / n) - ((((1.0 / n) * 0.5) - (0.3333333333333333 * (1.0 / (n * x)))) / x)) / x elif x <= 0.5: tmp = (x - math.log(x)) / n elif x <= 8.8e+73: tmp = 1.0 / (x * (n - ((((((-0.5 * (t_0 / x)) + (((n / x) * -0.25) + ((n / x) * 0.16666666666666666))) - t_0) / x) + (n * -0.5)) / x))) else: tmp = 0.0 return tmp
function code(x, n) t_0 = Float64(Float64(n * -0.3333333333333333) + Float64(n * 0.25)) tmp = 0.0 if (x <= 9.5e-136) tmp = Float64(log(x) / Float64(-n)); elseif (x <= 4.5e-94) tmp = Float64(Float64(Float64(1.0 / n) - Float64(Float64(Float64(Float64(1.0 / n) * 0.5) - Float64(0.3333333333333333 * Float64(1.0 / Float64(n * x)))) / x)) / x); elseif (x <= 0.5) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 8.8e+73) tmp = Float64(1.0 / Float64(x * Float64(n - Float64(Float64(Float64(Float64(Float64(Float64(-0.5 * Float64(t_0 / x)) + Float64(Float64(Float64(n / x) * -0.25) + Float64(Float64(n / x) * 0.16666666666666666))) - t_0) / x) + Float64(n * -0.5)) / x)))); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) t_0 = (n * -0.3333333333333333) + (n * 0.25); tmp = 0.0; if (x <= 9.5e-136) tmp = log(x) / -n; elseif (x <= 4.5e-94) tmp = ((1.0 / n) - ((((1.0 / n) * 0.5) - (0.3333333333333333 * (1.0 / (n * x)))) / x)) / x; elseif (x <= 0.5) tmp = (x - log(x)) / n; elseif (x <= 8.8e+73) tmp = 1.0 / (x * (n - ((((((-0.5 * (t_0 / x)) + (((n / x) * -0.25) + ((n / x) * 0.16666666666666666))) - t_0) / x) + (n * -0.5)) / x))); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(n * -0.3333333333333333), $MachinePrecision] + N[(n * 0.25), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 9.5e-136], N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision], If[LessEqual[x, 4.5e-94], N[(N[(N[(1.0 / n), $MachinePrecision] - N[(N[(N[(N[(1.0 / n), $MachinePrecision] * 0.5), $MachinePrecision] - N[(0.3333333333333333 * N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 0.5], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 8.8e+73], N[(1.0 / N[(x * N[(n - N[(N[(N[(N[(N[(N[(-0.5 * N[(t$95$0 / x), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(n / x), $MachinePrecision] * -0.25), $MachinePrecision] + N[(N[(n / x), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision] / x), $MachinePrecision] + N[(n * -0.5), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot -0.3333333333333333 + n \cdot 0.25\\
\mathbf{if}\;x \leq 9.5 \cdot 10^{-136}:\\
\;\;\;\;\frac{\log x}{-n}\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-94}:\\
\;\;\;\;\frac{\frac{1}{n} - \frac{\frac{1}{n} \cdot 0.5 - 0.3333333333333333 \cdot \frac{1}{n \cdot x}}{x}}{x}\\
\mathbf{elif}\;x \leq 0.5:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 8.8 \cdot 10^{+73}:\\
\;\;\;\;\frac{1}{x \cdot \left(n - \frac{\frac{\left(-0.5 \cdot \frac{t\_0}{x} + \left(\frac{n}{x} \cdot -0.25 + \frac{n}{x} \cdot 0.16666666666666666\right)\right) - t\_0}{x} + n \cdot -0.5}{x}\right)}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 9.5000000000000007e-136Initial program 45.1%
Taylor expanded in n around inf 58.3%
Taylor expanded in x around 0 58.3%
neg-mul-158.3%
Simplified58.3%
if 9.5000000000000007e-136 < x < 4.5000000000000002e-94Initial program 35.9%
Taylor expanded in n around inf 23.1%
Taylor expanded in x around -inf 73.1%
if 4.5000000000000002e-94 < x < 0.5Initial program 43.1%
Taylor expanded in n around inf 54.1%
Taylor expanded in x around 0 51.6%
if 0.5 < x < 8.8e73Initial program 29.1%
Taylor expanded in n around inf 31.0%
clear-num31.0%
inv-pow31.0%
log1p-define31.0%
Applied egg-rr31.0%
unpow-131.0%
Simplified31.0%
Taylor expanded in x around -inf 77.7%
if 8.8e73 < x Initial program 80.4%
Taylor expanded in x around 0 46.0%
Taylor expanded in n around inf 80.4%
Final simplification65.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (log x) (- n))) (t_1 (+ (* n -0.3333333333333333) (* n 0.25))))
(if (<= x 1.2e-135)
t_0
(if (<= x 3.3e-94)
(/
(-
(/ 1.0 n)
(/ (- (* (/ 1.0 n) 0.5) (* 0.3333333333333333 (/ 1.0 (* n x)))) x))
x)
(if (<= x 0.35)
t_0
(if (<= x 1.16e+73)
(/
1.0
(*
x
(-
n
(/
(+
(/
(-
(+
(* -0.5 (/ t_1 x))
(+ (* (/ n x) -0.25) (* (/ n x) 0.16666666666666666)))
t_1)
x)
(* n -0.5))
x))))
0.0))))))
double code(double x, double n) {
double t_0 = log(x) / -n;
double t_1 = (n * -0.3333333333333333) + (n * 0.25);
double tmp;
if (x <= 1.2e-135) {
tmp = t_0;
} else if (x <= 3.3e-94) {
tmp = ((1.0 / n) - ((((1.0 / n) * 0.5) - (0.3333333333333333 * (1.0 / (n * x)))) / x)) / x;
} else if (x <= 0.35) {
tmp = t_0;
} else if (x <= 1.16e+73) {
tmp = 1.0 / (x * (n - ((((((-0.5 * (t_1 / x)) + (((n / x) * -0.25) + ((n / x) * 0.16666666666666666))) - t_1) / x) + (n * -0.5)) / x)));
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = log(x) / -n
t_1 = (n * (-0.3333333333333333d0)) + (n * 0.25d0)
if (x <= 1.2d-135) then
tmp = t_0
else if (x <= 3.3d-94) then
tmp = ((1.0d0 / n) - ((((1.0d0 / n) * 0.5d0) - (0.3333333333333333d0 * (1.0d0 / (n * x)))) / x)) / x
else if (x <= 0.35d0) then
tmp = t_0
else if (x <= 1.16d+73) then
tmp = 1.0d0 / (x * (n - (((((((-0.5d0) * (t_1 / x)) + (((n / x) * (-0.25d0)) + ((n / x) * 0.16666666666666666d0))) - t_1) / x) + (n * (-0.5d0))) / x)))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.log(x) / -n;
double t_1 = (n * -0.3333333333333333) + (n * 0.25);
double tmp;
if (x <= 1.2e-135) {
tmp = t_0;
} else if (x <= 3.3e-94) {
tmp = ((1.0 / n) - ((((1.0 / n) * 0.5) - (0.3333333333333333 * (1.0 / (n * x)))) / x)) / x;
} else if (x <= 0.35) {
tmp = t_0;
} else if (x <= 1.16e+73) {
tmp = 1.0 / (x * (n - ((((((-0.5 * (t_1 / x)) + (((n / x) * -0.25) + ((n / x) * 0.16666666666666666))) - t_1) / x) + (n * -0.5)) / x)));
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): t_0 = math.log(x) / -n t_1 = (n * -0.3333333333333333) + (n * 0.25) tmp = 0 if x <= 1.2e-135: tmp = t_0 elif x <= 3.3e-94: tmp = ((1.0 / n) - ((((1.0 / n) * 0.5) - (0.3333333333333333 * (1.0 / (n * x)))) / x)) / x elif x <= 0.35: tmp = t_0 elif x <= 1.16e+73: tmp = 1.0 / (x * (n - ((((((-0.5 * (t_1 / x)) + (((n / x) * -0.25) + ((n / x) * 0.16666666666666666))) - t_1) / x) + (n * -0.5)) / x))) else: tmp = 0.0 return tmp
function code(x, n) t_0 = Float64(log(x) / Float64(-n)) t_1 = Float64(Float64(n * -0.3333333333333333) + Float64(n * 0.25)) tmp = 0.0 if (x <= 1.2e-135) tmp = t_0; elseif (x <= 3.3e-94) tmp = Float64(Float64(Float64(1.0 / n) - Float64(Float64(Float64(Float64(1.0 / n) * 0.5) - Float64(0.3333333333333333 * Float64(1.0 / Float64(n * x)))) / x)) / x); elseif (x <= 0.35) tmp = t_0; elseif (x <= 1.16e+73) tmp = Float64(1.0 / Float64(x * Float64(n - Float64(Float64(Float64(Float64(Float64(Float64(-0.5 * Float64(t_1 / x)) + Float64(Float64(Float64(n / x) * -0.25) + Float64(Float64(n / x) * 0.16666666666666666))) - t_1) / x) + Float64(n * -0.5)) / x)))); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) t_0 = log(x) / -n; t_1 = (n * -0.3333333333333333) + (n * 0.25); tmp = 0.0; if (x <= 1.2e-135) tmp = t_0; elseif (x <= 3.3e-94) tmp = ((1.0 / n) - ((((1.0 / n) * 0.5) - (0.3333333333333333 * (1.0 / (n * x)))) / x)) / x; elseif (x <= 0.35) tmp = t_0; elseif (x <= 1.16e+73) tmp = 1.0 / (x * (n - ((((((-0.5 * (t_1 / x)) + (((n / x) * -0.25) + ((n / x) * 0.16666666666666666))) - t_1) / x) + (n * -0.5)) / x))); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] / (-n)), $MachinePrecision]}, Block[{t$95$1 = N[(N[(n * -0.3333333333333333), $MachinePrecision] + N[(n * 0.25), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.2e-135], t$95$0, If[LessEqual[x, 3.3e-94], N[(N[(N[(1.0 / n), $MachinePrecision] - N[(N[(N[(N[(1.0 / n), $MachinePrecision] * 0.5), $MachinePrecision] - N[(0.3333333333333333 * N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 0.35], t$95$0, If[LessEqual[x, 1.16e+73], N[(1.0 / N[(x * N[(n - N[(N[(N[(N[(N[(N[(-0.5 * N[(t$95$1 / x), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(n / x), $MachinePrecision] * -0.25), $MachinePrecision] + N[(N[(n / x), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision] / x), $MachinePrecision] + N[(n * -0.5), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\log x}{-n}\\
t_1 := n \cdot -0.3333333333333333 + n \cdot 0.25\\
\mathbf{if}\;x \leq 1.2 \cdot 10^{-135}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3.3 \cdot 10^{-94}:\\
\;\;\;\;\frac{\frac{1}{n} - \frac{\frac{1}{n} \cdot 0.5 - 0.3333333333333333 \cdot \frac{1}{n \cdot x}}{x}}{x}\\
\mathbf{elif}\;x \leq 0.35:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.16 \cdot 10^{+73}:\\
\;\;\;\;\frac{1}{x \cdot \left(n - \frac{\frac{\left(-0.5 \cdot \frac{t\_1}{x} + \left(\frac{n}{x} \cdot -0.25 + \frac{n}{x} \cdot 0.16666666666666666\right)\right) - t\_1}{x} + n \cdot -0.5}{x}\right)}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.1999999999999999e-135 or 3.3000000000000001e-94 < x < 0.34999999999999998Initial program 44.5%
Taylor expanded in n around inf 56.9%
Taylor expanded in x around 0 55.4%
neg-mul-155.4%
Simplified55.4%
if 1.1999999999999999e-135 < x < 3.3000000000000001e-94Initial program 35.9%
Taylor expanded in n around inf 23.1%
Taylor expanded in x around -inf 73.1%
if 0.34999999999999998 < x < 1.16000000000000007e73Initial program 29.1%
Taylor expanded in n around inf 31.0%
clear-num31.0%
inv-pow31.0%
log1p-define31.0%
Applied egg-rr31.0%
unpow-131.0%
Simplified31.0%
Taylor expanded in x around -inf 77.7%
if 1.16000000000000007e73 < x Initial program 80.4%
Taylor expanded in x around 0 46.0%
Taylor expanded in n around inf 80.4%
Final simplification65.5%
(FPCore (x n) :precision binary64 (if (<= x 1.12e+74) (/ (+ 1.0 (/ (+ -0.5 (/ (+ -0.3333333333333333 (/ 0.25 x)) x)) x)) (* n x)) 0.0))
double code(double x, double n) {
double tmp;
if (x <= 1.12e+74) {
tmp = (1.0 + ((-0.5 + ((-0.3333333333333333 + (0.25 / x)) / x)) / x)) / (n * x);
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 1.12d+74) then
tmp = (1.0d0 + (((-0.5d0) + (((-0.3333333333333333d0) + (0.25d0 / x)) / x)) / x)) / (n * x)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 1.12e+74) {
tmp = (1.0 + ((-0.5 + ((-0.3333333333333333 + (0.25 / x)) / x)) / x)) / (n * x);
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.12e+74: tmp = (1.0 + ((-0.5 + ((-0.3333333333333333 + (0.25 / x)) / x)) / x)) / (n * x) else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 1.12e+74) tmp = Float64(Float64(1.0 + Float64(Float64(-0.5 + Float64(Float64(-0.3333333333333333 + Float64(0.25 / x)) / x)) / x)) / Float64(n * x)); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.12e+74) tmp = (1.0 + ((-0.5 + ((-0.3333333333333333 + (0.25 / x)) / x)) / x)) / (n * x); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.12e+74], N[(N[(1.0 + N[(N[(-0.5 + N[(N[(-0.3333333333333333 + N[(0.25 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.12 \cdot 10^{+74}:\\
\;\;\;\;\frac{1 + \frac{-0.5 + \frac{-0.3333333333333333 + \frac{0.25}{x}}{x}}{x}}{n \cdot x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.12000000000000003e74Initial program 41.3%
Taylor expanded in n around inf 49.8%
Taylor expanded in x around -inf 12.5%
Applied egg-rr36.9%
*-lft-identity36.9%
+-commutative36.9%
Simplified36.9%
if 1.12000000000000003e74 < x Initial program 80.4%
Taylor expanded in x around 0 46.0%
Taylor expanded in n around inf 80.4%
Final simplification47.9%
(FPCore (x n) :precision binary64 (if (<= x 8.8e+73) (/ (/ (+ -1.0 (/ (+ 0.5 (/ -0.3333333333333333 x)) x)) (- x)) n) 0.0))
double code(double x, double n) {
double tmp;
if (x <= 8.8e+73) {
tmp = ((-1.0 + ((0.5 + (-0.3333333333333333 / x)) / x)) / -x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 8.8d+73) then
tmp = (((-1.0d0) + ((0.5d0 + ((-0.3333333333333333d0) / x)) / x)) / -x) / n
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 8.8e+73) {
tmp = ((-1.0 + ((0.5 + (-0.3333333333333333 / x)) / x)) / -x) / n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 8.8e+73: tmp = ((-1.0 + ((0.5 + (-0.3333333333333333 / x)) / x)) / -x) / n else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 8.8e+73) tmp = Float64(Float64(Float64(-1.0 + Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x)) / Float64(-x)) / n); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 8.8e+73) tmp = ((-1.0 + ((0.5 + (-0.3333333333333333 / x)) / x)) / -x) / n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 8.8e+73], N[(N[(N[(-1.0 + N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / (-x)), $MachinePrecision] / n), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 8.8 \cdot 10^{+73}:\\
\;\;\;\;\frac{\frac{-1 + \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{-x}}{n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 8.8e73Initial program 41.3%
Taylor expanded in n around inf 49.8%
diff-log49.9%
Applied egg-rr49.9%
+-commutative49.9%
Simplified49.9%
Taylor expanded in x around -inf 35.5%
mul-1-neg35.5%
distribute-neg-frac235.5%
sub-neg35.5%
associate-*r/35.5%
sub-neg35.5%
metadata-eval35.5%
distribute-lft-in35.5%
associate-*r/35.5%
metadata-eval35.5%
associate-*r/35.5%
metadata-eval35.5%
metadata-eval35.5%
metadata-eval35.5%
Simplified35.5%
if 8.8e73 < x Initial program 80.4%
Taylor expanded in x around 0 46.0%
Taylor expanded in n around inf 80.4%
Final simplification46.9%
(FPCore (x n) :precision binary64 (if (<= x 2.8e+73) (/ (+ (/ 1.0 n) (/ 0.5 (* n x))) x) 0.0))
double code(double x, double n) {
double tmp;
if (x <= 2.8e+73) {
tmp = ((1.0 / n) + (0.5 / (n * x))) / x;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 2.8d+73) then
tmp = ((1.0d0 / n) + (0.5d0 / (n * x))) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 2.8e+73) {
tmp = ((1.0 / n) + (0.5 / (n * x))) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 2.8e+73: tmp = ((1.0 / n) + (0.5 / (n * x))) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 2.8e+73) tmp = Float64(Float64(Float64(1.0 / n) + Float64(0.5 / Float64(n * x))) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 2.8e+73) tmp = ((1.0 / n) + (0.5 / (n * x))) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 2.8e+73], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(0.5 / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.8 \cdot 10^{+73}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{0.5}{n \cdot x}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2.80000000000000008e73Initial program 41.3%
Taylor expanded in n around inf 49.8%
Taylor expanded in x around -inf 12.5%
add-cube-cbrt12.3%
pow312.3%
Applied egg-rr12.0%
Taylor expanded in x around inf 34.1%
associate-*r/34.1%
metadata-eval34.1%
*-commutative34.1%
Simplified34.1%
if 2.80000000000000008e73 < x Initial program 80.4%
Taylor expanded in x around 0 46.0%
Taylor expanded in n around inf 80.4%
Final simplification45.8%
(FPCore (x n) :precision binary64 (if (<= x 1.12e+74) (/ (/ (+ -1.0 (/ -0.5 x)) x) (- n)) 0.0))
double code(double x, double n) {
double tmp;
if (x <= 1.12e+74) {
tmp = ((-1.0 + (-0.5 / x)) / x) / -n;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 1.12d+74) then
tmp = (((-1.0d0) + ((-0.5d0) / x)) / x) / -n
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 1.12e+74) {
tmp = ((-1.0 + (-0.5 / x)) / x) / -n;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.12e+74: tmp = ((-1.0 + (-0.5 / x)) / x) / -n else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 1.12e+74) tmp = Float64(Float64(Float64(-1.0 + Float64(-0.5 / x)) / x) / Float64(-n)); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.12e+74) tmp = ((-1.0 + (-0.5 / x)) / x) / -n; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.12e+74], N[(N[(N[(-1.0 + N[(-0.5 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / (-n)), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.12 \cdot 10^{+74}:\\
\;\;\;\;\frac{\frac{-1 + \frac{-0.5}{x}}{x}}{-n}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.12000000000000003e74Initial program 41.3%
Taylor expanded in n around inf 49.8%
Taylor expanded in x around -inf 12.5%
add-cube-cbrt12.3%
pow312.3%
Applied egg-rr12.0%
Taylor expanded in x around inf 34.0%
associate-*r/34.0%
distribute-lft-in34.0%
metadata-eval34.0%
neg-mul-134.0%
associate-*r/34.0%
metadata-eval34.0%
distribute-neg-frac34.0%
metadata-eval34.0%
Simplified34.0%
if 1.12000000000000003e74 < x Initial program 80.4%
Taylor expanded in x around 0 46.0%
Taylor expanded in n around inf 80.4%
Final simplification45.8%
(FPCore (x n) :precision binary64 (if (<= x 1.15e+72) (/ 1.0 (* n x)) 0.0))
double code(double x, double n) {
double tmp;
if (x <= 1.15e+72) {
tmp = 1.0 / (n * x);
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: tmp
if (x <= 1.15d+72) then
tmp = 1.0d0 / (n * x)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 1.15e+72) {
tmp = 1.0 / (n * x);
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 1.15e+72: tmp = 1.0 / (n * x) else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 1.15e+72) tmp = Float64(1.0 / Float64(n * x)); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 1.15e+72) tmp = 1.0 / (n * x); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 1.15e+72], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.15 \cdot 10^{+72}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.15e72Initial program 41.3%
Taylor expanded in n around inf 49.8%
Taylor expanded in x around inf 29.4%
*-commutative29.4%
Simplified29.4%
if 1.15e72 < x Initial program 80.4%
Taylor expanded in x around 0 46.0%
Taylor expanded in n around inf 80.4%
Final simplification42.4%
(FPCore (x n) :precision binary64 0.0)
double code(double x, double n) {
return 0.0;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = 0.0d0
end function
public static double code(double x, double n) {
return 0.0;
}
def code(x, n): return 0.0
function code(x, n) return 0.0 end
function tmp = code(x, n) tmp = 0.0; end
code[x_, n_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 51.3%
Taylor expanded in x around 0 38.7%
Taylor expanded in n around inf 26.1%
Final simplification26.1%
herbie shell --seed 2024054
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))