
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x n) :precision binary64 (- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))
double code(double x, double n) {
return pow((x + 1.0), (1.0 / n)) - pow(x, (1.0 / n));
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((x + 1.0d0) ** (1.0d0 / n)) - (x ** (1.0d0 / n))
end function
public static double code(double x, double n) {
return Math.pow((x + 1.0), (1.0 / n)) - Math.pow(x, (1.0 / n));
}
def code(x, n): return math.pow((x + 1.0), (1.0 / n)) - math.pow(x, (1.0 / n))
function code(x, n) return Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - (x ^ Float64(1.0 / n))) end
function tmp = code(x, n) tmp = ((x + 1.0) ^ (1.0 / n)) - (x ^ (1.0 / n)); end
code[x_, n_] := N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - {x}^{\left(\frac{1}{n}\right)}
\end{array}
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= n -34000000.0)
(/
(+
(log1p x)
(- (* 0.5 (/ (- (pow (log1p x) 2.0) (pow (log x) 2.0)) n)) (log x)))
n)
(if (<= n 4100.0)
(- (exp (/ (log1p x) n)) t_0)
(if (<= n 1.65e+96)
(/ t_0 (* n x))
(* (/ 1.0 n) (log (/ (+ x 1.0) x))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if (n <= -34000000.0) {
tmp = (log1p(x) + ((0.5 * ((pow(log1p(x), 2.0) - pow(log(x), 2.0)) / n)) - log(x))) / n;
} else if (n <= 4100.0) {
tmp = exp((log1p(x) / n)) - t_0;
} else if (n <= 1.65e+96) {
tmp = t_0 / (n * x);
} else {
tmp = (1.0 / n) * log(((x + 1.0) / x));
}
return tmp;
}
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if (n <= -34000000.0) {
tmp = (Math.log1p(x) + ((0.5 * ((Math.pow(Math.log1p(x), 2.0) - Math.pow(Math.log(x), 2.0)) / n)) - Math.log(x))) / n;
} else if (n <= 4100.0) {
tmp = Math.exp((Math.log1p(x) / n)) - t_0;
} else if (n <= 1.65e+96) {
tmp = t_0 / (n * x);
} else {
tmp = (1.0 / n) * Math.log(((x + 1.0) / x));
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if n <= -34000000.0: tmp = (math.log1p(x) + ((0.5 * ((math.pow(math.log1p(x), 2.0) - math.pow(math.log(x), 2.0)) / n)) - math.log(x))) / n elif n <= 4100.0: tmp = math.exp((math.log1p(x) / n)) - t_0 elif n <= 1.65e+96: tmp = t_0 / (n * x) else: tmp = (1.0 / n) * math.log(((x + 1.0) / x)) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (n <= -34000000.0) tmp = Float64(Float64(log1p(x) + Float64(Float64(0.5 * Float64(Float64((log1p(x) ^ 2.0) - (log(x) ^ 2.0)) / n)) - log(x))) / n); elseif (n <= 4100.0) tmp = Float64(exp(Float64(log1p(x) / n)) - t_0); elseif (n <= 1.65e+96) tmp = Float64(t_0 / Float64(n * x)); else tmp = Float64(Float64(1.0 / n) * log(Float64(Float64(x + 1.0) / x))); end return tmp end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[n, -34000000.0], N[(N[(N[Log[1 + x], $MachinePrecision] + N[(N[(0.5 * N[(N[(N[Power[N[Log[1 + x], $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[Log[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[Log[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[n, 4100.0], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[n, 1.65e+96], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / n), $MachinePrecision] * N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;n \leq -34000000:\\
\;\;\;\;\frac{\mathsf{log1p}\left(x\right) + \left(0.5 \cdot \frac{{\left(\mathsf{log1p}\left(x\right)\right)}^{2} - {\log x}^{2}}{n} - \log x\right)}{n}\\
\mathbf{elif}\;n \leq 4100:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\
\mathbf{elif}\;n \leq 1.65 \cdot 10^{+96}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n} \cdot \log \left(\frac{x + 1}{x}\right)\\
\end{array}
\end{array}
if n < -3.4e7Initial program 30.4%
Taylor expanded in n around inf 79.0%
Simplified79.0%
if -3.4e7 < n < 4100Initial program 82.5%
Taylor expanded in n around 0 82.5%
log1p-define100.0%
Simplified100.0%
if 4100 < n < 1.64999999999999992e96Initial program 8.9%
Taylor expanded in x around inf 69.6%
mul-1-neg69.6%
log-rec69.6%
mul-1-neg69.6%
distribute-neg-frac69.6%
mul-1-neg69.6%
remove-double-neg69.6%
*-commutative69.6%
Simplified69.6%
*-un-lft-identity69.6%
div-inv69.6%
exp-to-pow69.6%
*-commutative69.6%
Applied egg-rr69.6%
*-lft-identity69.6%
*-commutative69.6%
Simplified69.6%
if 1.64999999999999992e96 < n Initial program 32.9%
Taylor expanded in n around inf 88.4%
log1p-define88.4%
Simplified88.4%
div-inv88.5%
Applied egg-rr88.5%
log1p-undefine88.5%
diff-log88.8%
Applied egg-rr88.8%
+-commutative88.8%
Simplified88.8%
Final simplification89.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (log (/ (+ x 1.0) x))))
(if (<= n -22500000000.0)
(/ t_1 n)
(if (<= n 5200.0)
(- (exp (/ (log1p x) n)) t_0)
(if (<= n 1.25e+96) (/ t_0 (* n x)) (* (/ 1.0 n) t_1))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = log(((x + 1.0) / x));
double tmp;
if (n <= -22500000000.0) {
tmp = t_1 / n;
} else if (n <= 5200.0) {
tmp = exp((log1p(x) / n)) - t_0;
} else if (n <= 1.25e+96) {
tmp = t_0 / (n * x);
} else {
tmp = (1.0 / n) * 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.log(((x + 1.0) / x));
double tmp;
if (n <= -22500000000.0) {
tmp = t_1 / n;
} else if (n <= 5200.0) {
tmp = Math.exp((Math.log1p(x) / n)) - t_0;
} else if (n <= 1.25e+96) {
tmp = t_0 / (n * x);
} else {
tmp = (1.0 / n) * t_1;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = math.log(((x + 1.0) / x)) tmp = 0 if n <= -22500000000.0: tmp = t_1 / n elif n <= 5200.0: tmp = math.exp((math.log1p(x) / n)) - t_0 elif n <= 1.25e+96: tmp = t_0 / (n * x) else: tmp = (1.0 / n) * t_1 return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = log(Float64(Float64(x + 1.0) / x)) tmp = 0.0 if (n <= -22500000000.0) tmp = Float64(t_1 / n); elseif (n <= 5200.0) tmp = Float64(exp(Float64(log1p(x) / n)) - t_0); elseif (n <= 1.25e+96) tmp = Float64(t_0 / Float64(n * x)); else tmp = Float64(Float64(1.0 / n) * 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[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[n, -22500000000.0], N[(t$95$1 / n), $MachinePrecision], If[LessEqual[n, 5200.0], N[(N[Exp[N[(N[Log[1 + x], $MachinePrecision] / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[n, 1.25e+96], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / n), $MachinePrecision] * t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \log \left(\frac{x + 1}{x}\right)\\
\mathbf{if}\;n \leq -22500000000:\\
\;\;\;\;\frac{t\_1}{n}\\
\mathbf{elif}\;n \leq 5200:\\
\;\;\;\;e^{\frac{\mathsf{log1p}\left(x\right)}{n}} - t\_0\\
\mathbf{elif}\;n \leq 1.25 \cdot 10^{+96}:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{n} \cdot t\_1\\
\end{array}
\end{array}
if n < -2.25e10Initial program 30.4%
Taylor expanded in n around inf 78.9%
log1p-define78.9%
Simplified78.9%
log1p-undefine78.9%
diff-log78.8%
Applied egg-rr78.9%
+-commutative78.8%
Simplified78.9%
if -2.25e10 < n < 5200Initial program 82.5%
Taylor expanded in n around 0 82.5%
log1p-define100.0%
Simplified100.0%
if 5200 < n < 1.2500000000000001e96Initial program 8.9%
Taylor expanded in x around inf 69.6%
mul-1-neg69.6%
log-rec69.6%
mul-1-neg69.6%
distribute-neg-frac69.6%
mul-1-neg69.6%
remove-double-neg69.6%
*-commutative69.6%
Simplified69.6%
*-un-lft-identity69.6%
div-inv69.6%
exp-to-pow69.6%
*-commutative69.6%
Applied egg-rr69.6%
*-lft-identity69.6%
*-commutative69.6%
Simplified69.6%
if 1.2500000000000001e96 < n Initial program 32.9%
Taylor expanded in n around inf 88.4%
log1p-define88.4%
Simplified88.4%
div-inv88.5%
Applied egg-rr88.5%
log1p-undefine88.5%
diff-log88.8%
Applied egg-rr88.8%
+-commutative88.8%
Simplified88.8%
Final simplification89.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-33)
(* (/ 1.0 n) (/ t_0 x))
(if (<= (/ 1.0 n) 5e-100)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 5e-36)
(/ 1.0 (* x (+ n (* 0.5 (/ n x)))))
(if (<= (/ 1.0 n) 2e-23)
(/ (- x (log x)) n)
(if (<= (/ 1.0 n) 0.0002)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 1e+187)
(- (pow (+ x 1.0) (/ 1.0 n)) t_0)
(/
(+ -1.0 (/ (+ 0.5 (/ -0.3333333333333333 x)) x))
(* n (- x)))))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-33) {
tmp = (1.0 / n) * (t_0 / x);
} else if ((1.0 / n) <= 5e-100) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e-36) {
tmp = 1.0 / (x * (n + (0.5 * (n / x))));
} else if ((1.0 / n) <= 2e-23) {
tmp = (x - log(x)) / n;
} else if ((1.0 / n) <= 0.0002) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e+187) {
tmp = pow((x + 1.0), (1.0 / n)) - t_0;
} else {
tmp = (-1.0 + ((0.5 + (-0.3333333333333333 / x)) / x)) / (n * -x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-1d-33)) then
tmp = (1.0d0 / n) * (t_0 / x)
else if ((1.0d0 / n) <= 5d-100) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 5d-36) then
tmp = 1.0d0 / (x * (n + (0.5d0 * (n / x))))
else if ((1.0d0 / n) <= 2d-23) then
tmp = (x - log(x)) / n
else if ((1.0d0 / n) <= 0.0002d0) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 1d+187) then
tmp = ((x + 1.0d0) ** (1.0d0 / n)) - t_0
else
tmp = ((-1.0d0) + ((0.5d0 + ((-0.3333333333333333d0) / x)) / x)) / (n * -x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-33) {
tmp = (1.0 / n) * (t_0 / x);
} else if ((1.0 / n) <= 5e-100) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e-36) {
tmp = 1.0 / (x * (n + (0.5 * (n / x))));
} else if ((1.0 / n) <= 2e-23) {
tmp = (x - Math.log(x)) / n;
} else if ((1.0 / n) <= 0.0002) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e+187) {
tmp = Math.pow((x + 1.0), (1.0 / n)) - t_0;
} else {
tmp = (-1.0 + ((0.5 + (-0.3333333333333333 / x)) / x)) / (n * -x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-33: tmp = (1.0 / n) * (t_0 / x) elif (1.0 / n) <= 5e-100: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 5e-36: tmp = 1.0 / (x * (n + (0.5 * (n / x)))) elif (1.0 / n) <= 2e-23: tmp = (x - math.log(x)) / n elif (1.0 / n) <= 0.0002: tmp = t_0 / (n * x) elif (1.0 / n) <= 1e+187: tmp = math.pow((x + 1.0), (1.0 / n)) - t_0 else: tmp = (-1.0 + ((0.5 + (-0.3333333333333333 / x)) / x)) / (n * -x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-33) tmp = Float64(Float64(1.0 / n) * Float64(t_0 / x)); elseif (Float64(1.0 / n) <= 5e-100) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 5e-36) tmp = Float64(1.0 / Float64(x * Float64(n + Float64(0.5 * Float64(n / x))))); elseif (Float64(1.0 / n) <= 2e-23) tmp = Float64(Float64(x - log(x)) / n); elseif (Float64(1.0 / n) <= 0.0002) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 1e+187) tmp = Float64((Float64(x + 1.0) ^ Float64(1.0 / n)) - t_0); else tmp = Float64(Float64(-1.0 + Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x)) / Float64(n * Float64(-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-33) tmp = (1.0 / n) * (t_0 / x); elseif ((1.0 / n) <= 5e-100) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 5e-36) tmp = 1.0 / (x * (n + (0.5 * (n / x)))); elseif ((1.0 / n) <= 2e-23) tmp = (x - log(x)) / n; elseif ((1.0 / n) <= 0.0002) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 1e+187) tmp = ((x + 1.0) ^ (1.0 / n)) - t_0; else tmp = (-1.0 + ((0.5 + (-0.3333333333333333 / x)) / x)) / (n * -x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-33], N[(N[(1.0 / n), $MachinePrecision] * N[(t$95$0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-100], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-36], N[(1.0 / N[(x * N[(n + N[(0.5 * N[(n / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-23], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.0002], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+187], N[(N[Power[N[(x + 1.0), $MachinePrecision], N[(1.0 / n), $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(-1.0 + N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(n * (-x)), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-33}:\\
\;\;\;\;\frac{1}{n} \cdot \frac{t\_0}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-100}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-36}:\\
\;\;\;\;\frac{1}{x \cdot \left(n + 0.5 \cdot \frac{n}{x}\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-23}:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.0002:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+187}:\\
\;\;\;\;{\left(x + 1\right)}^{\left(\frac{1}{n}\right)} - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{-1 + \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{n \cdot \left(-x\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.0000000000000001e-33Initial program 95.1%
Taylor expanded in x around inf 97.3%
mul-1-neg97.3%
log-rec97.3%
mul-1-neg97.3%
distribute-neg-frac97.3%
mul-1-neg97.3%
remove-double-neg97.3%
*-commutative97.3%
Simplified97.3%
associate-/r*97.5%
div-inv97.5%
div-inv97.5%
exp-to-pow97.5%
Applied egg-rr97.5%
if -1.0000000000000001e-33 < (/.f64 #s(literal 1 binary64) n) < 5.0000000000000001e-100Initial program 31.1%
Taylor expanded in n around inf 84.8%
log1p-define84.8%
Simplified84.8%
log1p-undefine84.8%
diff-log84.9%
Applied egg-rr84.9%
+-commutative84.9%
Simplified84.9%
if 5.0000000000000001e-100 < (/.f64 #s(literal 1 binary64) n) < 5.00000000000000004e-36Initial program 12.3%
Taylor expanded in n around inf 32.8%
log1p-define32.8%
Simplified32.8%
clear-num32.8%
inv-pow32.8%
Applied egg-rr32.8%
unpow-132.8%
Simplified32.8%
Taylor expanded in x around inf 81.6%
if 5.00000000000000004e-36 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999992e-23Initial program 3.4%
Taylor expanded in n around inf 83.7%
log1p-define83.7%
Simplified83.7%
Taylor expanded in x around 0 84.3%
if 1.99999999999999992e-23 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-4Initial program 5.9%
Taylor expanded in x around inf 99.7%
mul-1-neg99.7%
log-rec99.7%
mul-1-neg99.7%
distribute-neg-frac99.7%
mul-1-neg99.7%
remove-double-neg99.7%
*-commutative99.7%
Simplified99.7%
*-un-lft-identity99.7%
div-inv99.7%
exp-to-pow99.7%
*-commutative99.7%
Applied egg-rr99.7%
*-lft-identity99.7%
*-commutative99.7%
Simplified99.7%
if 2.0000000000000001e-4 < (/.f64 #s(literal 1 binary64) n) < 9.99999999999999907e186Initial program 78.6%
if 9.99999999999999907e186 < (/.f64 #s(literal 1 binary64) n) Initial program 19.3%
Taylor expanded in n around inf 7.2%
log1p-define7.2%
Simplified7.2%
Taylor expanded in x around -inf 83.9%
Taylor expanded in n around 0 83.9%
sub-neg83.9%
associate-*r/83.9%
sub-neg83.9%
metadata-eval83.9%
distribute-lft-in83.9%
neg-mul-183.9%
associate-*r/83.9%
metadata-eval83.9%
distribute-neg-frac83.9%
metadata-eval83.9%
metadata-eval83.9%
metadata-eval83.9%
*-commutative83.9%
Simplified83.9%
Final simplification88.1%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-33)
(* (/ 1.0 n) (/ t_0 x))
(if (<= (/ 1.0 n) 5e-100)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 5e-36)
(/ 1.0 (* x (+ n (* 0.5 (/ n x)))))
(if (<= (/ 1.0 n) 2e-23)
(/ (- x (log x)) n)
(if (<= (/ 1.0 n) 0.0002)
(/ t_0 (* n x))
(-
(+ 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-33) {
tmp = (1.0 / n) * (t_0 / x);
} else if ((1.0 / n) <= 5e-100) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e-36) {
tmp = 1.0 / (x * (n + (0.5 * (n / x))));
} else if ((1.0 / n) <= 2e-23) {
tmp = (x - log(x)) / n;
} else if ((1.0 / n) <= 0.0002) {
tmp = t_0 / (n * x);
} 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-33)) then
tmp = (1.0d0 / n) * (t_0 / x)
else if ((1.0d0 / n) <= 5d-100) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 5d-36) then
tmp = 1.0d0 / (x * (n + (0.5d0 * (n / x))))
else if ((1.0d0 / n) <= 2d-23) then
tmp = (x - log(x)) / n
else if ((1.0d0 / n) <= 0.0002d0) then
tmp = t_0 / (n * x)
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-33) {
tmp = (1.0 / n) * (t_0 / x);
} else if ((1.0 / n) <= 5e-100) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e-36) {
tmp = 1.0 / (x * (n + (0.5 * (n / x))));
} else if ((1.0 / n) <= 2e-23) {
tmp = (x - Math.log(x)) / n;
} else if ((1.0 / n) <= 0.0002) {
tmp = t_0 / (n * x);
} 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-33: tmp = (1.0 / n) * (t_0 / x) elif (1.0 / n) <= 5e-100: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 5e-36: tmp = 1.0 / (x * (n + (0.5 * (n / x)))) elif (1.0 / n) <= 2e-23: tmp = (x - math.log(x)) / n elif (1.0 / n) <= 0.0002: tmp = t_0 / (n * x) 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-33) tmp = Float64(Float64(1.0 / n) * Float64(t_0 / x)); elseif (Float64(1.0 / n) <= 5e-100) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 5e-36) tmp = Float64(1.0 / Float64(x * Float64(n + Float64(0.5 * Float64(n / x))))); elseif (Float64(1.0 / n) <= 2e-23) tmp = Float64(Float64(x - log(x)) / n); elseif (Float64(1.0 / n) <= 0.0002) tmp = Float64(t_0 / Float64(n * x)); 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-33) tmp = (1.0 / n) * (t_0 / x); elseif ((1.0 / n) <= 5e-100) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 5e-36) tmp = 1.0 / (x * (n + (0.5 * (n / x)))); elseif ((1.0 / n) <= 2e-23) tmp = (x - log(x)) / n; elseif ((1.0 / n) <= 0.0002) tmp = t_0 / (n * x); 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-33], N[(N[(1.0 / n), $MachinePrecision] * N[(t$95$0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-100], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-36], N[(1.0 / N[(x * N[(n + N[(0.5 * N[(n / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-23], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.0002], N[(t$95$0 / N[(n * x), $MachinePrecision]), $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^{-33}:\\
\;\;\;\;\frac{1}{n} \cdot \frac{t\_0}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-100}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-36}:\\
\;\;\;\;\frac{1}{x \cdot \left(n + 0.5 \cdot \frac{n}{x}\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-23}:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.0002:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\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 #s(literal 1 binary64) n) < -1.0000000000000001e-33Initial program 95.1%
Taylor expanded in x around inf 97.3%
mul-1-neg97.3%
log-rec97.3%
mul-1-neg97.3%
distribute-neg-frac97.3%
mul-1-neg97.3%
remove-double-neg97.3%
*-commutative97.3%
Simplified97.3%
associate-/r*97.5%
div-inv97.5%
div-inv97.5%
exp-to-pow97.5%
Applied egg-rr97.5%
if -1.0000000000000001e-33 < (/.f64 #s(literal 1 binary64) n) < 5.0000000000000001e-100Initial program 31.1%
Taylor expanded in n around inf 84.8%
log1p-define84.8%
Simplified84.8%
log1p-undefine84.8%
diff-log84.9%
Applied egg-rr84.9%
+-commutative84.9%
Simplified84.9%
if 5.0000000000000001e-100 < (/.f64 #s(literal 1 binary64) n) < 5.00000000000000004e-36Initial program 12.3%
Taylor expanded in n around inf 32.8%
log1p-define32.8%
Simplified32.8%
clear-num32.8%
inv-pow32.8%
Applied egg-rr32.8%
unpow-132.8%
Simplified32.8%
Taylor expanded in x around inf 81.6%
if 5.00000000000000004e-36 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999992e-23Initial program 3.4%
Taylor expanded in n around inf 83.7%
log1p-define83.7%
Simplified83.7%
Taylor expanded in x around 0 84.3%
if 1.99999999999999992e-23 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-4Initial program 5.9%
Taylor expanded in x around inf 99.7%
mul-1-neg99.7%
log-rec99.7%
mul-1-neg99.7%
distribute-neg-frac99.7%
mul-1-neg99.7%
remove-double-neg99.7%
*-commutative99.7%
Simplified99.7%
*-un-lft-identity99.7%
div-inv99.7%
exp-to-pow99.7%
*-commutative99.7%
Applied egg-rr99.7%
*-lft-identity99.7%
*-commutative99.7%
Simplified99.7%
if 2.0000000000000001e-4 < (/.f64 #s(literal 1 binary64) n) Initial program 52.6%
Taylor expanded in x around 0 67.1%
Taylor expanded in n around inf 69.6%
Final simplification86.3%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-33)
(* (/ 1.0 n) (/ t_0 x))
(if (<= (/ 1.0 n) 5e-100)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 5e-36)
(/ 1.0 (* x (+ n (* 0.5 (/ n x)))))
(if (<= (/ 1.0 n) 2e-23)
(/ (- x (log x)) n)
(if (<= (/ 1.0 n) 0.0002)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 1e+197)
(- (+ 1.0 (/ x n)) t_0)
(/
(+ -1.0 (/ (+ 0.5 (/ -0.3333333333333333 x)) x))
(* n (- x)))))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-33) {
tmp = (1.0 / n) * (t_0 / x);
} else if ((1.0 / n) <= 5e-100) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e-36) {
tmp = 1.0 / (x * (n + (0.5 * (n / x))));
} else if ((1.0 / n) <= 2e-23) {
tmp = (x - log(x)) / n;
} else if ((1.0 / n) <= 0.0002) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e+197) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = (-1.0 + ((0.5 + (-0.3333333333333333 / x)) / x)) / (n * -x);
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
if ((1.0d0 / n) <= (-1d-33)) then
tmp = (1.0d0 / n) * (t_0 / x)
else if ((1.0d0 / n) <= 5d-100) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 5d-36) then
tmp = 1.0d0 / (x * (n + (0.5d0 * (n / x))))
else if ((1.0d0 / n) <= 2d-23) then
tmp = (x - log(x)) / n
else if ((1.0d0 / n) <= 0.0002d0) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 1d+197) then
tmp = (1.0d0 + (x / n)) - t_0
else
tmp = ((-1.0d0) + ((0.5d0 + ((-0.3333333333333333d0) / x)) / x)) / (n * -x)
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-33) {
tmp = (1.0 / n) * (t_0 / x);
} else if ((1.0 / n) <= 5e-100) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e-36) {
tmp = 1.0 / (x * (n + (0.5 * (n / x))));
} else if ((1.0 / n) <= 2e-23) {
tmp = (x - Math.log(x)) / n;
} else if ((1.0 / n) <= 0.0002) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e+197) {
tmp = (1.0 + (x / n)) - t_0;
} else {
tmp = (-1.0 + ((0.5 + (-0.3333333333333333 / x)) / x)) / (n * -x);
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-33: tmp = (1.0 / n) * (t_0 / x) elif (1.0 / n) <= 5e-100: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 5e-36: tmp = 1.0 / (x * (n + (0.5 * (n / x)))) elif (1.0 / n) <= 2e-23: tmp = (x - math.log(x)) / n elif (1.0 / n) <= 0.0002: tmp = t_0 / (n * x) elif (1.0 / n) <= 1e+197: tmp = (1.0 + (x / n)) - t_0 else: tmp = (-1.0 + ((0.5 + (-0.3333333333333333 / x)) / x)) / (n * -x) return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-33) tmp = Float64(Float64(1.0 / n) * Float64(t_0 / x)); elseif (Float64(1.0 / n) <= 5e-100) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 5e-36) tmp = Float64(1.0 / Float64(x * Float64(n + Float64(0.5 * Float64(n / x))))); elseif (Float64(1.0 / n) <= 2e-23) tmp = Float64(Float64(x - log(x)) / n); elseif (Float64(1.0 / n) <= 0.0002) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 1e+197) tmp = Float64(Float64(1.0 + Float64(x / n)) - t_0); else tmp = Float64(Float64(-1.0 + Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x)) / Float64(n * Float64(-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-33) tmp = (1.0 / n) * (t_0 / x); elseif ((1.0 / n) <= 5e-100) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 5e-36) tmp = 1.0 / (x * (n + (0.5 * (n / x)))); elseif ((1.0 / n) <= 2e-23) tmp = (x - log(x)) / n; elseif ((1.0 / n) <= 0.0002) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 1e+197) tmp = (1.0 + (x / n)) - t_0; else tmp = (-1.0 + ((0.5 + (-0.3333333333333333 / x)) / x)) / (n * -x); end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-33], N[(N[(1.0 / n), $MachinePrecision] * N[(t$95$0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-100], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-36], N[(1.0 / N[(x * N[(n + N[(0.5 * N[(n / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-23], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.0002], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+197], N[(N[(1.0 + N[(x / n), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(-1.0 + N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(n * (-x)), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-33}:\\
\;\;\;\;\frac{1}{n} \cdot \frac{t\_0}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-100}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-36}:\\
\;\;\;\;\frac{1}{x \cdot \left(n + 0.5 \cdot \frac{n}{x}\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-23}:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.0002:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+197}:\\
\;\;\;\;\left(1 + \frac{x}{n}\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{-1 + \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{n \cdot \left(-x\right)}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.0000000000000001e-33Initial program 95.1%
Taylor expanded in x around inf 97.3%
mul-1-neg97.3%
log-rec97.3%
mul-1-neg97.3%
distribute-neg-frac97.3%
mul-1-neg97.3%
remove-double-neg97.3%
*-commutative97.3%
Simplified97.3%
associate-/r*97.5%
div-inv97.5%
div-inv97.5%
exp-to-pow97.5%
Applied egg-rr97.5%
if -1.0000000000000001e-33 < (/.f64 #s(literal 1 binary64) n) < 5.0000000000000001e-100Initial program 31.1%
Taylor expanded in n around inf 84.8%
log1p-define84.8%
Simplified84.8%
log1p-undefine84.8%
diff-log84.9%
Applied egg-rr84.9%
+-commutative84.9%
Simplified84.9%
if 5.0000000000000001e-100 < (/.f64 #s(literal 1 binary64) n) < 5.00000000000000004e-36Initial program 12.3%
Taylor expanded in n around inf 32.8%
log1p-define32.8%
Simplified32.8%
clear-num32.8%
inv-pow32.8%
Applied egg-rr32.8%
unpow-132.8%
Simplified32.8%
Taylor expanded in x around inf 81.6%
if 5.00000000000000004e-36 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999992e-23Initial program 3.4%
Taylor expanded in n around inf 83.7%
log1p-define83.7%
Simplified83.7%
Taylor expanded in x around 0 84.3%
if 1.99999999999999992e-23 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-4Initial program 5.9%
Taylor expanded in x around inf 99.7%
mul-1-neg99.7%
log-rec99.7%
mul-1-neg99.7%
distribute-neg-frac99.7%
mul-1-neg99.7%
remove-double-neg99.7%
*-commutative99.7%
Simplified99.7%
*-un-lft-identity99.7%
div-inv99.7%
exp-to-pow99.7%
*-commutative99.7%
Applied egg-rr99.7%
*-lft-identity99.7%
*-commutative99.7%
Simplified99.7%
if 2.0000000000000001e-4 < (/.f64 #s(literal 1 binary64) n) < 9.9999999999999995e196Initial program 76.4%
Taylor expanded in x around 0 65.4%
if 9.9999999999999995e196 < (/.f64 #s(literal 1 binary64) n) Initial program 15.2%
Taylor expanded in n around inf 7.5%
log1p-define7.5%
Simplified7.5%
Taylor expanded in x around -inf 87.9%
Taylor expanded in n around 0 87.9%
sub-neg87.9%
associate-*r/87.9%
sub-neg87.9%
metadata-eval87.9%
distribute-lft-in87.9%
neg-mul-187.9%
associate-*r/87.9%
metadata-eval87.9%
distribute-neg-frac87.9%
metadata-eval87.9%
metadata-eval87.9%
metadata-eval87.9%
*-commutative87.9%
Simplified87.9%
Final simplification87.0%
(FPCore (x n)
:precision binary64
(let* ((t_0 (- 1.0 (pow x (/ 1.0 n)))))
(if (<= (/ 1.0 n) -5e+223)
t_0
(if (<= (/ 1.0 n) -5e+124)
0.0
(if (<= (/ 1.0 n) -1e-33)
(/ (/ (+ 1.0 (/ (- (* 0.3333333333333333 (/ 1.0 x)) 0.5) x)) x) n)
(if (<= (/ 1.0 n) 5e-100)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 0.0002)
(/ 1.0 (* x (+ n (* 0.5 (/ n x)))))
(if (<= (/ 1.0 n) 1e+165)
t_0
(/
(+
(/ 1.0 n)
(*
(/
(+ (* (* n x) -0.5) (* n 0.3333333333333333))
(* n (* n x)))
(/ 1.0 x)))
x)))))))))
double code(double x, double n) {
double t_0 = 1.0 - pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e+223) {
tmp = t_0;
} else if ((1.0 / n) <= -5e+124) {
tmp = 0.0;
} else if ((1.0 / n) <= -1e-33) {
tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n;
} else if ((1.0 / n) <= 5e-100) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 0.0002) {
tmp = 1.0 / (x * (n + (0.5 * (n / x))));
} else if ((1.0 / n) <= 1e+165) {
tmp = t_0;
} else {
tmp = ((1.0 / n) + (((((n * x) * -0.5) + (n * 0.3333333333333333)) / (n * (n * x))) * (1.0 / x))) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (x ** (1.0d0 / n))
if ((1.0d0 / n) <= (-5d+223)) then
tmp = t_0
else if ((1.0d0 / n) <= (-5d+124)) then
tmp = 0.0d0
else if ((1.0d0 / n) <= (-1d-33)) then
tmp = ((1.0d0 + (((0.3333333333333333d0 * (1.0d0 / x)) - 0.5d0) / x)) / x) / n
else if ((1.0d0 / n) <= 5d-100) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 0.0002d0) then
tmp = 1.0d0 / (x * (n + (0.5d0 * (n / x))))
else if ((1.0d0 / n) <= 1d+165) then
tmp = t_0
else
tmp = ((1.0d0 / n) + (((((n * x) * (-0.5d0)) + (n * 0.3333333333333333d0)) / (n * (n * x))) * (1.0d0 / x))) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = 1.0 - Math.pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -5e+223) {
tmp = t_0;
} else if ((1.0 / n) <= -5e+124) {
tmp = 0.0;
} else if ((1.0 / n) <= -1e-33) {
tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n;
} else if ((1.0 / n) <= 5e-100) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 0.0002) {
tmp = 1.0 / (x * (n + (0.5 * (n / x))));
} else if ((1.0 / n) <= 1e+165) {
tmp = t_0;
} else {
tmp = ((1.0 / n) + (((((n * x) * -0.5) + (n * 0.3333333333333333)) / (n * (n * x))) * (1.0 / x))) / x;
}
return tmp;
}
def code(x, n): t_0 = 1.0 - math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -5e+223: tmp = t_0 elif (1.0 / n) <= -5e+124: tmp = 0.0 elif (1.0 / n) <= -1e-33: tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n elif (1.0 / n) <= 5e-100: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 0.0002: tmp = 1.0 / (x * (n + (0.5 * (n / x)))) elif (1.0 / n) <= 1e+165: tmp = t_0 else: tmp = ((1.0 / n) + (((((n * x) * -0.5) + (n * 0.3333333333333333)) / (n * (n * x))) * (1.0 / x))) / x return tmp
function code(x, n) t_0 = Float64(1.0 - (x ^ Float64(1.0 / n))) tmp = 0.0 if (Float64(1.0 / n) <= -5e+223) tmp = t_0; elseif (Float64(1.0 / n) <= -5e+124) tmp = 0.0; elseif (Float64(1.0 / n) <= -1e-33) tmp = Float64(Float64(Float64(1.0 + Float64(Float64(Float64(0.3333333333333333 * Float64(1.0 / x)) - 0.5) / x)) / x) / n); elseif (Float64(1.0 / n) <= 5e-100) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 0.0002) tmp = Float64(1.0 / Float64(x * Float64(n + Float64(0.5 * Float64(n / x))))); elseif (Float64(1.0 / n) <= 1e+165) tmp = t_0; else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(Float64(Float64(n * x) * -0.5) + Float64(n * 0.3333333333333333)) / Float64(n * Float64(n * x))) * Float64(1.0 / x))) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = 1.0 - (x ^ (1.0 / n)); tmp = 0.0; if ((1.0 / n) <= -5e+223) tmp = t_0; elseif ((1.0 / n) <= -5e+124) tmp = 0.0; elseif ((1.0 / n) <= -1e-33) tmp = ((1.0 + (((0.3333333333333333 * (1.0 / x)) - 0.5) / x)) / x) / n; elseif ((1.0 / n) <= 5e-100) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 0.0002) tmp = 1.0 / (x * (n + (0.5 * (n / x)))); elseif ((1.0 / n) <= 1e+165) tmp = t_0; else tmp = ((1.0 / n) + (((((n * x) * -0.5) + (n * 0.3333333333333333)) / (n * (n * x))) * (1.0 / x))) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e+223], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e+124], 0.0, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-33], N[(N[(N[(1.0 + N[(N[(N[(0.3333333333333333 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-100], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.0002], N[(1.0 / N[(x * N[(n + N[(0.5 * N[(n / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+165], t$95$0, N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(N[(N[(n * x), $MachinePrecision] * -0.5), $MachinePrecision] + N[(n * 0.3333333333333333), $MachinePrecision]), $MachinePrecision] / N[(n * N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -5 \cdot 10^{+223}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{+124}:\\
\;\;\;\;0\\
\mathbf{elif}\;\frac{1}{n} \leq -1 \cdot 10^{-33}:\\
\;\;\;\;\frac{\frac{1 + \frac{0.3333333333333333 \cdot \frac{1}{x} - 0.5}{x}}{x}}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-100}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.0002:\\
\;\;\;\;\frac{1}{x \cdot \left(n + 0.5 \cdot \frac{n}{x}\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+165}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\left(n \cdot x\right) \cdot -0.5 + n \cdot 0.3333333333333333}{n \cdot \left(n \cdot x\right)} \cdot \frac{1}{x}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -4.99999999999999985e223 or 2.0000000000000001e-4 < (/.f64 #s(literal 1 binary64) n) < 9.99999999999999899e164Initial program 87.7%
Taylor expanded in x around 0 70.7%
if -4.99999999999999985e223 < (/.f64 #s(literal 1 binary64) n) < -4.9999999999999996e124Initial program 100.0%
Taylor expanded in n around inf 69.6%
log1p-define69.6%
Simplified69.6%
add-log-exp96.1%
div-inv96.1%
exp-prod96.1%
exp-diff96.1%
add-exp-log29.1%
log1p-undefine29.1%
rem-exp-log96.1%
Applied egg-rr96.1%
+-commutative96.1%
Simplified96.1%
Taylor expanded in x around inf 72.4%
if -4.9999999999999996e124 < (/.f64 #s(literal 1 binary64) n) < -1.0000000000000001e-33Initial program 88.4%
Taylor expanded in n around inf 39.8%
log1p-define39.8%
Simplified39.8%
Taylor expanded in x around -inf 60.8%
if -1.0000000000000001e-33 < (/.f64 #s(literal 1 binary64) n) < 5.0000000000000001e-100Initial program 31.1%
Taylor expanded in n around inf 84.8%
log1p-define84.8%
Simplified84.8%
log1p-undefine84.8%
diff-log84.9%
Applied egg-rr84.9%
+-commutative84.9%
Simplified84.9%
if 5.0000000000000001e-100 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-4Initial program 8.9%
Taylor expanded in n around inf 39.6%
log1p-define39.6%
Simplified39.6%
clear-num39.6%
inv-pow39.6%
Applied egg-rr39.6%
unpow-139.6%
Simplified39.6%
Taylor expanded in x around inf 67.7%
if 9.99999999999999899e164 < (/.f64 #s(literal 1 binary64) n) Initial program 27.3%
Taylor expanded in n around inf 7.0%
log1p-define7.0%
Simplified7.0%
Taylor expanded in x around -inf 75.9%
div-inv75.9%
cancel-sign-sub-inv75.9%
un-div-inv75.9%
*-commutative75.9%
un-div-inv75.9%
metadata-eval75.9%
Applied egg-rr75.9%
+-commutative75.9%
frac-add80.6%
*-commutative80.6%
*-commutative80.6%
Applied egg-rr80.6%
Final simplification76.4%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (/ -0.3333333333333333 n) (- (pow x 3.0)))))
(if (<= (/ 1.0 n) -1e+190)
t_0
(if (<= (/ 1.0 n) -5e+125)
0.0
(if (<= (/ 1.0 n) -10.0)
t_0
(if (<= (/ 1.0 n) 5e-100)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 0.0002)
(/ 1.0 (* x (+ n (* 0.5 (/ n x)))))
(if (<= (/ 1.0 n) 1e+165)
(- 1.0 (pow x (/ 1.0 n)))
(/
(+
(/ 1.0 n)
(*
(/
(+ (* (* n x) -0.5) (* n 0.3333333333333333))
(* n (* n x)))
(/ 1.0 x)))
x)))))))))
double code(double x, double n) {
double t_0 = (-0.3333333333333333 / n) / -pow(x, 3.0);
double tmp;
if ((1.0 / n) <= -1e+190) {
tmp = t_0;
} else if ((1.0 / n) <= -5e+125) {
tmp = 0.0;
} else if ((1.0 / n) <= -10.0) {
tmp = t_0;
} else if ((1.0 / n) <= 5e-100) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 0.0002) {
tmp = 1.0 / (x * (n + (0.5 * (n / x))));
} else if ((1.0 / n) <= 1e+165) {
tmp = 1.0 - pow(x, (1.0 / n));
} else {
tmp = ((1.0 / n) + (((((n * x) * -0.5) + (n * 0.3333333333333333)) / (n * (n * x))) * (1.0 / x))) / 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 = ((-0.3333333333333333d0) / n) / -(x ** 3.0d0)
if ((1.0d0 / n) <= (-1d+190)) then
tmp = t_0
else if ((1.0d0 / n) <= (-5d+125)) then
tmp = 0.0d0
else if ((1.0d0 / n) <= (-10.0d0)) then
tmp = t_0
else if ((1.0d0 / n) <= 5d-100) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 0.0002d0) then
tmp = 1.0d0 / (x * (n + (0.5d0 * (n / x))))
else if ((1.0d0 / n) <= 1d+165) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else
tmp = ((1.0d0 / n) + (((((n * x) * (-0.5d0)) + (n * 0.3333333333333333d0)) / (n * (n * x))) * (1.0d0 / x))) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = (-0.3333333333333333 / n) / -Math.pow(x, 3.0);
double tmp;
if ((1.0 / n) <= -1e+190) {
tmp = t_0;
} else if ((1.0 / n) <= -5e+125) {
tmp = 0.0;
} else if ((1.0 / n) <= -10.0) {
tmp = t_0;
} else if ((1.0 / n) <= 5e-100) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 0.0002) {
tmp = 1.0 / (x * (n + (0.5 * (n / x))));
} else if ((1.0 / n) <= 1e+165) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else {
tmp = ((1.0 / n) + (((((n * x) * -0.5) + (n * 0.3333333333333333)) / (n * (n * x))) * (1.0 / x))) / x;
}
return tmp;
}
def code(x, n): t_0 = (-0.3333333333333333 / n) / -math.pow(x, 3.0) tmp = 0 if (1.0 / n) <= -1e+190: tmp = t_0 elif (1.0 / n) <= -5e+125: tmp = 0.0 elif (1.0 / n) <= -10.0: tmp = t_0 elif (1.0 / n) <= 5e-100: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 0.0002: tmp = 1.0 / (x * (n + (0.5 * (n / x)))) elif (1.0 / n) <= 1e+165: tmp = 1.0 - math.pow(x, (1.0 / n)) else: tmp = ((1.0 / n) + (((((n * x) * -0.5) + (n * 0.3333333333333333)) / (n * (n * x))) * (1.0 / x))) / x return tmp
function code(x, n) t_0 = Float64(Float64(-0.3333333333333333 / n) / Float64(-(x ^ 3.0))) tmp = 0.0 if (Float64(1.0 / n) <= -1e+190) tmp = t_0; elseif (Float64(1.0 / n) <= -5e+125) tmp = 0.0; elseif (Float64(1.0 / n) <= -10.0) tmp = t_0; elseif (Float64(1.0 / n) <= 5e-100) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 0.0002) tmp = Float64(1.0 / Float64(x * Float64(n + Float64(0.5 * Float64(n / x))))); elseif (Float64(1.0 / n) <= 1e+165) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(Float64(Float64(n * x) * -0.5) + Float64(n * 0.3333333333333333)) / Float64(n * Float64(n * x))) * Float64(1.0 / x))) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = (-0.3333333333333333 / n) / -(x ^ 3.0); tmp = 0.0; if ((1.0 / n) <= -1e+190) tmp = t_0; elseif ((1.0 / n) <= -5e+125) tmp = 0.0; elseif ((1.0 / n) <= -10.0) tmp = t_0; elseif ((1.0 / n) <= 5e-100) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 0.0002) tmp = 1.0 / (x * (n + (0.5 * (n / x)))); elseif ((1.0 / n) <= 1e+165) tmp = 1.0 - (x ^ (1.0 / n)); else tmp = ((1.0 / n) + (((((n * x) * -0.5) + (n * 0.3333333333333333)) / (n * (n * x))) * (1.0 / x))) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[(N[(-0.3333333333333333 / n), $MachinePrecision] / (-N[Power[x, 3.0], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e+190], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], -5e+125], 0.0, If[LessEqual[N[(1.0 / n), $MachinePrecision], -10.0], t$95$0, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-100], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.0002], N[(1.0 / N[(x * N[(n + N[(0.5 * N[(n / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+165], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(N[(N[(n * x), $MachinePrecision] * -0.5), $MachinePrecision] + N[(n * 0.3333333333333333), $MachinePrecision]), $MachinePrecision] / N[(n * N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\frac{-0.3333333333333333}{n}}{-{x}^{3}}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{+190}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq -5 \cdot 10^{+125}:\\
\;\;\;\;0\\
\mathbf{elif}\;\frac{1}{n} \leq -10:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-100}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.0002:\\
\;\;\;\;\frac{1}{x \cdot \left(n + 0.5 \cdot \frac{n}{x}\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+165}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\left(n \cdot x\right) \cdot -0.5 + n \cdot 0.3333333333333333}{n \cdot \left(n \cdot x\right)} \cdot \frac{1}{x}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.0000000000000001e190 or -4.99999999999999962e125 < (/.f64 #s(literal 1 binary64) n) < -10Initial program 100.0%
Taylor expanded in n around inf 41.6%
log1p-define41.6%
Simplified41.6%
Taylor expanded in x around -inf 58.0%
Taylor expanded in x around 0 84.3%
associate-/r*84.3%
Simplified84.3%
if -1.0000000000000001e190 < (/.f64 #s(literal 1 binary64) n) < -4.99999999999999962e125Initial program 100.0%
Taylor expanded in n around inf 72.6%
log1p-define72.6%
Simplified72.6%
add-log-exp93.0%
div-inv93.0%
exp-prod93.0%
exp-diff93.0%
add-exp-log22.7%
log1p-undefine22.7%
rem-exp-log93.0%
Applied egg-rr93.0%
+-commutative93.0%
Simplified93.0%
Taylor expanded in x around inf 78.9%
if -10 < (/.f64 #s(literal 1 binary64) n) < 5.0000000000000001e-100Initial program 32.0%
Taylor expanded in n around inf 82.5%
log1p-define82.5%
Simplified82.5%
log1p-undefine82.5%
diff-log82.6%
Applied egg-rr82.6%
+-commutative82.6%
Simplified82.6%
if 5.0000000000000001e-100 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-4Initial program 8.9%
Taylor expanded in n around inf 39.6%
log1p-define39.6%
Simplified39.6%
clear-num39.6%
inv-pow39.6%
Applied egg-rr39.6%
unpow-139.6%
Simplified39.6%
Taylor expanded in x around inf 67.7%
if 2.0000000000000001e-4 < (/.f64 #s(literal 1 binary64) n) < 9.99999999999999899e164Initial program 76.6%
Taylor expanded in x around 0 67.3%
if 9.99999999999999899e164 < (/.f64 #s(literal 1 binary64) n) Initial program 27.3%
Taylor expanded in n around inf 7.0%
log1p-define7.0%
Simplified7.0%
Taylor expanded in x around -inf 75.9%
div-inv75.9%
cancel-sign-sub-inv75.9%
un-div-inv75.9%
*-commutative75.9%
un-div-inv75.9%
metadata-eval75.9%
Applied egg-rr75.9%
+-commutative75.9%
frac-add80.6%
*-commutative80.6%
*-commutative80.6%
Applied egg-rr80.6%
Final simplification79.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))) (t_1 (/ t_0 (* n x))))
(if (<= (/ 1.0 n) -1e-33)
t_1
(if (<= (/ 1.0 n) 5e-100)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 5e-36)
(/ 1.0 (* x (+ n (* 0.5 (/ n x)))))
(if (<= (/ 1.0 n) 2e-23)
(/ (- x (log x)) n)
(if (<= (/ 1.0 n) 0.0002)
t_1
(if (<= (/ 1.0 n) 1e+165)
(- 1.0 t_0)
(/
(+
(/ 1.0 n)
(*
(/
(+ (* (* n x) -0.5) (* n 0.3333333333333333))
(* n (* n x)))
(/ 1.0 x)))
x)))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double t_1 = t_0 / (n * x);
double tmp;
if ((1.0 / n) <= -1e-33) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-100) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e-36) {
tmp = 1.0 / (x * (n + (0.5 * (n / x))));
} else if ((1.0 / n) <= 2e-23) {
tmp = (x - log(x)) / n;
} else if ((1.0 / n) <= 0.0002) {
tmp = t_1;
} else if ((1.0 / n) <= 1e+165) {
tmp = 1.0 - t_0;
} else {
tmp = ((1.0 / n) + (((((n * x) * -0.5) + (n * 0.3333333333333333)) / (n * (n * x))) * (1.0 / x))) / x;
}
return tmp;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x ** (1.0d0 / n)
t_1 = t_0 / (n * x)
if ((1.0d0 / n) <= (-1d-33)) then
tmp = t_1
else if ((1.0d0 / n) <= 5d-100) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 5d-36) then
tmp = 1.0d0 / (x * (n + (0.5d0 * (n / x))))
else if ((1.0d0 / n) <= 2d-23) then
tmp = (x - log(x)) / n
else if ((1.0d0 / n) <= 0.0002d0) then
tmp = t_1
else if ((1.0d0 / n) <= 1d+165) then
tmp = 1.0d0 - t_0
else
tmp = ((1.0d0 / n) + (((((n * x) * (-0.5d0)) + (n * 0.3333333333333333d0)) / (n * (n * x))) * (1.0d0 / x))) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double t_0 = Math.pow(x, (1.0 / n));
double t_1 = t_0 / (n * x);
double tmp;
if ((1.0 / n) <= -1e-33) {
tmp = t_1;
} else if ((1.0 / n) <= 5e-100) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e-36) {
tmp = 1.0 / (x * (n + (0.5 * (n / x))));
} else if ((1.0 / n) <= 2e-23) {
tmp = (x - Math.log(x)) / n;
} else if ((1.0 / n) <= 0.0002) {
tmp = t_1;
} else if ((1.0 / n) <= 1e+165) {
tmp = 1.0 - t_0;
} else {
tmp = ((1.0 / n) + (((((n * x) * -0.5) + (n * 0.3333333333333333)) / (n * (n * x))) * (1.0 / x))) / x;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) t_1 = t_0 / (n * x) tmp = 0 if (1.0 / n) <= -1e-33: tmp = t_1 elif (1.0 / n) <= 5e-100: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 5e-36: tmp = 1.0 / (x * (n + (0.5 * (n / x)))) elif (1.0 / n) <= 2e-23: tmp = (x - math.log(x)) / n elif (1.0 / n) <= 0.0002: tmp = t_1 elif (1.0 / n) <= 1e+165: tmp = 1.0 - t_0 else: tmp = ((1.0 / n) + (((((n * x) * -0.5) + (n * 0.3333333333333333)) / (n * (n * x))) * (1.0 / x))) / x return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) t_1 = Float64(t_0 / Float64(n * x)) tmp = 0.0 if (Float64(1.0 / n) <= -1e-33) tmp = t_1; elseif (Float64(1.0 / n) <= 5e-100) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 5e-36) tmp = Float64(1.0 / Float64(x * Float64(n + Float64(0.5 * Float64(n / x))))); elseif (Float64(1.0 / n) <= 2e-23) tmp = Float64(Float64(x - log(x)) / n); elseif (Float64(1.0 / n) <= 0.0002) tmp = t_1; elseif (Float64(1.0 / n) <= 1e+165) tmp = Float64(1.0 - t_0); else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(Float64(Float64(n * x) * -0.5) + Float64(n * 0.3333333333333333)) / Float64(n * Float64(n * x))) * Float64(1.0 / x))) / x); end return tmp end
function tmp_2 = code(x, n) t_0 = x ^ (1.0 / n); t_1 = t_0 / (n * x); tmp = 0.0; if ((1.0 / n) <= -1e-33) tmp = t_1; elseif ((1.0 / n) <= 5e-100) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 5e-36) tmp = 1.0 / (x * (n + (0.5 * (n / x)))); elseif ((1.0 / n) <= 2e-23) tmp = (x - log(x)) / n; elseif ((1.0 / n) <= 0.0002) tmp = t_1; elseif ((1.0 / n) <= 1e+165) tmp = 1.0 - t_0; else tmp = ((1.0 / n) + (((((n * x) * -0.5) + (n * 0.3333333333333333)) / (n * (n * x))) * (1.0 / x))) / x; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 / n), $MachinePrecision], -1e-33], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-100], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-36], N[(1.0 / N[(x * N[(n + N[(0.5 * N[(n / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-23], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.0002], t$95$1, If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+165], N[(1.0 - t$95$0), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(N[(N[(n * x), $MachinePrecision] * -0.5), $MachinePrecision] + N[(n * 0.3333333333333333), $MachinePrecision]), $MachinePrecision] / N[(n * N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
t_1 := \frac{t\_0}{n \cdot x}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-33}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-100}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-36}:\\
\;\;\;\;\frac{1}{x \cdot \left(n + 0.5 \cdot \frac{n}{x}\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-23}:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.0002:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+165}:\\
\;\;\;\;1 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\left(n \cdot x\right) \cdot -0.5 + n \cdot 0.3333333333333333}{n \cdot \left(n \cdot x\right)} \cdot \frac{1}{x}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.0000000000000001e-33 or 1.99999999999999992e-23 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-4Initial program 89.6%
Taylor expanded in x around inf 97.5%
mul-1-neg97.5%
log-rec97.5%
mul-1-neg97.5%
distribute-neg-frac97.5%
mul-1-neg97.5%
remove-double-neg97.5%
*-commutative97.5%
Simplified97.5%
*-un-lft-identity97.5%
div-inv97.5%
exp-to-pow97.5%
*-commutative97.5%
Applied egg-rr97.5%
*-lft-identity97.5%
*-commutative97.5%
Simplified97.5%
if -1.0000000000000001e-33 < (/.f64 #s(literal 1 binary64) n) < 5.0000000000000001e-100Initial program 31.1%
Taylor expanded in n around inf 84.8%
log1p-define84.8%
Simplified84.8%
log1p-undefine84.8%
diff-log84.9%
Applied egg-rr84.9%
+-commutative84.9%
Simplified84.9%
if 5.0000000000000001e-100 < (/.f64 #s(literal 1 binary64) n) < 5.00000000000000004e-36Initial program 12.3%
Taylor expanded in n around inf 32.8%
log1p-define32.8%
Simplified32.8%
clear-num32.8%
inv-pow32.8%
Applied egg-rr32.8%
unpow-132.8%
Simplified32.8%
Taylor expanded in x around inf 81.6%
if 5.00000000000000004e-36 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999992e-23Initial program 3.4%
Taylor expanded in n around inf 83.7%
log1p-define83.7%
Simplified83.7%
Taylor expanded in x around 0 84.3%
if 2.0000000000000001e-4 < (/.f64 #s(literal 1 binary64) n) < 9.99999999999999899e164Initial program 76.6%
Taylor expanded in x around 0 67.3%
if 9.99999999999999899e164 < (/.f64 #s(literal 1 binary64) n) Initial program 27.3%
Taylor expanded in n around inf 7.0%
log1p-define7.0%
Simplified7.0%
Taylor expanded in x around -inf 75.9%
div-inv75.9%
cancel-sign-sub-inv75.9%
un-div-inv75.9%
*-commutative75.9%
un-div-inv75.9%
metadata-eval75.9%
Applied egg-rr75.9%
+-commutative75.9%
frac-add80.6%
*-commutative80.6%
*-commutative80.6%
Applied egg-rr80.6%
Final simplification86.9%
(FPCore (x n)
:precision binary64
(let* ((t_0 (pow x (/ 1.0 n))))
(if (<= (/ 1.0 n) -1e-33)
(* (/ 1.0 n) (/ t_0 x))
(if (<= (/ 1.0 n) 5e-100)
(/ (log (/ (+ x 1.0) x)) n)
(if (<= (/ 1.0 n) 5e-36)
(/ 1.0 (* x (+ n (* 0.5 (/ n x)))))
(if (<= (/ 1.0 n) 2e-23)
(/ (- x (log x)) n)
(if (<= (/ 1.0 n) 0.0002)
(/ t_0 (* n x))
(if (<= (/ 1.0 n) 1e+165)
(- 1.0 t_0)
(/
(+
(/ 1.0 n)
(*
(/
(+ (* (* n x) -0.5) (* n 0.3333333333333333))
(* n (* n x)))
(/ 1.0 x)))
x)))))))))
double code(double x, double n) {
double t_0 = pow(x, (1.0 / n));
double tmp;
if ((1.0 / n) <= -1e-33) {
tmp = (1.0 / n) * (t_0 / x);
} else if ((1.0 / n) <= 5e-100) {
tmp = log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e-36) {
tmp = 1.0 / (x * (n + (0.5 * (n / x))));
} else if ((1.0 / n) <= 2e-23) {
tmp = (x - log(x)) / n;
} else if ((1.0 / n) <= 0.0002) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e+165) {
tmp = 1.0 - t_0;
} else {
tmp = ((1.0 / n) + (((((n * x) * -0.5) + (n * 0.3333333333333333)) / (n * (n * x))) * (1.0 / x))) / 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-33)) then
tmp = (1.0d0 / n) * (t_0 / x)
else if ((1.0d0 / n) <= 5d-100) then
tmp = log(((x + 1.0d0) / x)) / n
else if ((1.0d0 / n) <= 5d-36) then
tmp = 1.0d0 / (x * (n + (0.5d0 * (n / x))))
else if ((1.0d0 / n) <= 2d-23) then
tmp = (x - log(x)) / n
else if ((1.0d0 / n) <= 0.0002d0) then
tmp = t_0 / (n * x)
else if ((1.0d0 / n) <= 1d+165) then
tmp = 1.0d0 - t_0
else
tmp = ((1.0d0 / n) + (((((n * x) * (-0.5d0)) + (n * 0.3333333333333333d0)) / (n * (n * x))) * (1.0d0 / x))) / 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-33) {
tmp = (1.0 / n) * (t_0 / x);
} else if ((1.0 / n) <= 5e-100) {
tmp = Math.log(((x + 1.0) / x)) / n;
} else if ((1.0 / n) <= 5e-36) {
tmp = 1.0 / (x * (n + (0.5 * (n / x))));
} else if ((1.0 / n) <= 2e-23) {
tmp = (x - Math.log(x)) / n;
} else if ((1.0 / n) <= 0.0002) {
tmp = t_0 / (n * x);
} else if ((1.0 / n) <= 1e+165) {
tmp = 1.0 - t_0;
} else {
tmp = ((1.0 / n) + (((((n * x) * -0.5) + (n * 0.3333333333333333)) / (n * (n * x))) * (1.0 / x))) / x;
}
return tmp;
}
def code(x, n): t_0 = math.pow(x, (1.0 / n)) tmp = 0 if (1.0 / n) <= -1e-33: tmp = (1.0 / n) * (t_0 / x) elif (1.0 / n) <= 5e-100: tmp = math.log(((x + 1.0) / x)) / n elif (1.0 / n) <= 5e-36: tmp = 1.0 / (x * (n + (0.5 * (n / x)))) elif (1.0 / n) <= 2e-23: tmp = (x - math.log(x)) / n elif (1.0 / n) <= 0.0002: tmp = t_0 / (n * x) elif (1.0 / n) <= 1e+165: tmp = 1.0 - t_0 else: tmp = ((1.0 / n) + (((((n * x) * -0.5) + (n * 0.3333333333333333)) / (n * (n * x))) * (1.0 / x))) / x return tmp
function code(x, n) t_0 = x ^ Float64(1.0 / n) tmp = 0.0 if (Float64(1.0 / n) <= -1e-33) tmp = Float64(Float64(1.0 / n) * Float64(t_0 / x)); elseif (Float64(1.0 / n) <= 5e-100) tmp = Float64(log(Float64(Float64(x + 1.0) / x)) / n); elseif (Float64(1.0 / n) <= 5e-36) tmp = Float64(1.0 / Float64(x * Float64(n + Float64(0.5 * Float64(n / x))))); elseif (Float64(1.0 / n) <= 2e-23) tmp = Float64(Float64(x - log(x)) / n); elseif (Float64(1.0 / n) <= 0.0002) tmp = Float64(t_0 / Float64(n * x)); elseif (Float64(1.0 / n) <= 1e+165) tmp = Float64(1.0 - t_0); else tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(Float64(Float64(n * x) * -0.5) + Float64(n * 0.3333333333333333)) / Float64(n * Float64(n * x))) * Float64(1.0 / x))) / 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-33) tmp = (1.0 / n) * (t_0 / x); elseif ((1.0 / n) <= 5e-100) tmp = log(((x + 1.0) / x)) / n; elseif ((1.0 / n) <= 5e-36) tmp = 1.0 / (x * (n + (0.5 * (n / x)))); elseif ((1.0 / n) <= 2e-23) tmp = (x - log(x)) / n; elseif ((1.0 / n) <= 0.0002) tmp = t_0 / (n * x); elseif ((1.0 / n) <= 1e+165) tmp = 1.0 - t_0; else tmp = ((1.0 / n) + (((((n * x) * -0.5) + (n * 0.3333333333333333)) / (n * (n * x))) * (1.0 / x))) / 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-33], N[(N[(1.0 / n), $MachinePrecision] * N[(t$95$0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-100], N[(N[Log[N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 5e-36], N[(1.0 / N[(x * N[(n + N[(0.5 * N[(n / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 2e-23], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 0.0002], N[(t$95$0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(1.0 / n), $MachinePrecision], 1e+165], N[(1.0 - t$95$0), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(N[(N[(n * x), $MachinePrecision] * -0.5), $MachinePrecision] + N[(n * 0.3333333333333333), $MachinePrecision]), $MachinePrecision] / N[(n * N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{if}\;\frac{1}{n} \leq -1 \cdot 10^{-33}:\\
\;\;\;\;\frac{1}{n} \cdot \frac{t\_0}{x}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-100}:\\
\;\;\;\;\frac{\log \left(\frac{x + 1}{x}\right)}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 5 \cdot 10^{-36}:\\
\;\;\;\;\frac{1}{x \cdot \left(n + 0.5 \cdot \frac{n}{x}\right)}\\
\mathbf{elif}\;\frac{1}{n} \leq 2 \cdot 10^{-23}:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;\frac{1}{n} \leq 0.0002:\\
\;\;\;\;\frac{t\_0}{n \cdot x}\\
\mathbf{elif}\;\frac{1}{n} \leq 10^{+165}:\\
\;\;\;\;1 - t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\left(n \cdot x\right) \cdot -0.5 + n \cdot 0.3333333333333333}{n \cdot \left(n \cdot x\right)} \cdot \frac{1}{x}}{x}\\
\end{array}
\end{array}
if (/.f64 #s(literal 1 binary64) n) < -1.0000000000000001e-33Initial program 95.1%
Taylor expanded in x around inf 97.3%
mul-1-neg97.3%
log-rec97.3%
mul-1-neg97.3%
distribute-neg-frac97.3%
mul-1-neg97.3%
remove-double-neg97.3%
*-commutative97.3%
Simplified97.3%
associate-/r*97.5%
div-inv97.5%
div-inv97.5%
exp-to-pow97.5%
Applied egg-rr97.5%
if -1.0000000000000001e-33 < (/.f64 #s(literal 1 binary64) n) < 5.0000000000000001e-100Initial program 31.1%
Taylor expanded in n around inf 84.8%
log1p-define84.8%
Simplified84.8%
log1p-undefine84.8%
diff-log84.9%
Applied egg-rr84.9%
+-commutative84.9%
Simplified84.9%
if 5.0000000000000001e-100 < (/.f64 #s(literal 1 binary64) n) < 5.00000000000000004e-36Initial program 12.3%
Taylor expanded in n around inf 32.8%
log1p-define32.8%
Simplified32.8%
clear-num32.8%
inv-pow32.8%
Applied egg-rr32.8%
unpow-132.8%
Simplified32.8%
Taylor expanded in x around inf 81.6%
if 5.00000000000000004e-36 < (/.f64 #s(literal 1 binary64) n) < 1.99999999999999992e-23Initial program 3.4%
Taylor expanded in n around inf 83.7%
log1p-define83.7%
Simplified83.7%
Taylor expanded in x around 0 84.3%
if 1.99999999999999992e-23 < (/.f64 #s(literal 1 binary64) n) < 2.0000000000000001e-4Initial program 5.9%
Taylor expanded in x around inf 99.7%
mul-1-neg99.7%
log-rec99.7%
mul-1-neg99.7%
distribute-neg-frac99.7%
mul-1-neg99.7%
remove-double-neg99.7%
*-commutative99.7%
Simplified99.7%
*-un-lft-identity99.7%
div-inv99.7%
exp-to-pow99.7%
*-commutative99.7%
Applied egg-rr99.7%
*-lft-identity99.7%
*-commutative99.7%
Simplified99.7%
if 2.0000000000000001e-4 < (/.f64 #s(literal 1 binary64) n) < 9.99999999999999899e164Initial program 76.6%
Taylor expanded in x around 0 67.3%
if 9.99999999999999899e164 < (/.f64 #s(literal 1 binary64) n) Initial program 27.3%
Taylor expanded in n around inf 7.0%
log1p-define7.0%
Simplified7.0%
Taylor expanded in x around -inf 75.9%
div-inv75.9%
cancel-sign-sub-inv75.9%
un-div-inv75.9%
*-commutative75.9%
un-div-inv75.9%
metadata-eval75.9%
Applied egg-rr75.9%
+-commutative75.9%
frac-add80.6%
*-commutative80.6%
*-commutative80.6%
Applied egg-rr80.6%
Final simplification87.0%
(FPCore (x n)
:precision binary64
(if (<= x 5.1e-267)
(/ (- (log x)) n)
(if (<= x 1.5e-251)
(/ 1.0 (* n x))
(if (<= x 0.86)
(/ (- x (log x)) n)
(if (<= x 6.2e+200)
(/
(-
(/ 1.0 n)
(/
(+ (/ (- (/ 0.25 (* n x)) (/ 0.3333333333333333 n)) x) (/ 0.5 n))
x))
x)
0.0)))))
double code(double x, double n) {
double tmp;
if (x <= 5.1e-267) {
tmp = -log(x) / n;
} else if (x <= 1.5e-251) {
tmp = 1.0 / (n * x);
} else if (x <= 0.86) {
tmp = (x - log(x)) / n;
} else if (x <= 6.2e+200) {
tmp = ((1.0 / n) - (((((0.25 / (n * x)) - (0.3333333333333333 / n)) / x) + (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 <= 5.1d-267) then
tmp = -log(x) / n
else if (x <= 1.5d-251) then
tmp = 1.0d0 / (n * x)
else if (x <= 0.86d0) then
tmp = (x - log(x)) / n
else if (x <= 6.2d+200) then
tmp = ((1.0d0 / n) - (((((0.25d0 / (n * x)) - (0.3333333333333333d0 / n)) / x) + (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 <= 5.1e-267) {
tmp = -Math.log(x) / n;
} else if (x <= 1.5e-251) {
tmp = 1.0 / (n * x);
} else if (x <= 0.86) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 6.2e+200) {
tmp = ((1.0 / n) - (((((0.25 / (n * x)) - (0.3333333333333333 / n)) / x) + (0.5 / n)) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 5.1e-267: tmp = -math.log(x) / n elif x <= 1.5e-251: tmp = 1.0 / (n * x) elif x <= 0.86: tmp = (x - math.log(x)) / n elif x <= 6.2e+200: tmp = ((1.0 / n) - (((((0.25 / (n * x)) - (0.3333333333333333 / n)) / x) + (0.5 / n)) / x)) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 5.1e-267) tmp = Float64(Float64(-log(x)) / n); elseif (x <= 1.5e-251) tmp = Float64(1.0 / Float64(n * x)); elseif (x <= 0.86) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 6.2e+200) tmp = Float64(Float64(Float64(1.0 / n) - Float64(Float64(Float64(Float64(Float64(0.25 / Float64(n * x)) - Float64(0.3333333333333333 / n)) / x) + Float64(0.5 / n)) / x)) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 5.1e-267) tmp = -log(x) / n; elseif (x <= 1.5e-251) tmp = 1.0 / (n * x); elseif (x <= 0.86) tmp = (x - log(x)) / n; elseif (x <= 6.2e+200) tmp = ((1.0 / n) - (((((0.25 / (n * x)) - (0.3333333333333333 / n)) / x) + (0.5 / n)) / x)) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 5.1e-267], N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision], If[LessEqual[x, 1.5e-251], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.86], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 6.2e+200], N[(N[(N[(1.0 / n), $MachinePrecision] - N[(N[(N[(N[(N[(0.25 / N[(n * x), $MachinePrecision]), $MachinePrecision] - N[(0.3333333333333333 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.1 \cdot 10^{-267}:\\
\;\;\;\;\frac{-\log x}{n}\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{-251}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{elif}\;x \leq 0.86:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{+200}:\\
\;\;\;\;\frac{\frac{1}{n} - \frac{\frac{\frac{0.25}{n \cdot x} - \frac{0.3333333333333333}{n}}{x} + \frac{0.5}{n}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 5.10000000000000009e-267Initial program 50.2%
Taylor expanded in n around inf 54.9%
log1p-define54.9%
Simplified54.9%
Taylor expanded in x around 0 54.9%
neg-mul-154.9%
Simplified54.9%
if 5.10000000000000009e-267 < x < 1.4999999999999999e-251Initial program 100.0%
Taylor expanded in n around inf 9.5%
log1p-define9.5%
Simplified9.5%
Taylor expanded in x around inf 83.9%
*-commutative83.9%
Simplified83.9%
if 1.4999999999999999e-251 < x < 0.859999999999999987Initial program 37.3%
Taylor expanded in n around inf 53.6%
log1p-define53.6%
Simplified53.6%
Taylor expanded in x around 0 51.7%
if 0.859999999999999987 < x < 6.19999999999999988e200Initial program 50.4%
Taylor expanded in n around inf 47.6%
log1p-define47.6%
Simplified47.6%
Taylor expanded in x around -inf 68.9%
mul-1-neg68.9%
Simplified68.9%
if 6.19999999999999988e200 < x Initial program 92.1%
Taylor expanded in n around inf 92.1%
log1p-define92.1%
Simplified92.1%
add-log-exp92.1%
div-inv92.1%
exp-prod92.1%
exp-diff92.1%
add-exp-log58.5%
log1p-undefine58.5%
rem-exp-log92.1%
Applied egg-rr92.1%
+-commutative92.1%
Simplified92.1%
Taylor expanded in x around inf 92.1%
Final simplification63.2%
(FPCore (x n)
:precision binary64
(let* ((t_0 (/ (- (log x)) n)))
(if (<= x 4.5e-267)
t_0
(if (<= x 1.5e-251)
(/ 1.0 (* n x))
(if (<= x 0.7)
t_0
(if (<= x 1.08e+201)
(/
(-
(/ 1.0 n)
(/
(+ (/ (- (/ 0.25 (* n x)) (/ 0.3333333333333333 n)) x) (/ 0.5 n))
x))
x)
0.0))))))
double code(double x, double n) {
double t_0 = -log(x) / n;
double tmp;
if (x <= 4.5e-267) {
tmp = t_0;
} else if (x <= 1.5e-251) {
tmp = 1.0 / (n * x);
} else if (x <= 0.7) {
tmp = t_0;
} else if (x <= 1.08e+201) {
tmp = ((1.0 / n) - (((((0.25 / (n * x)) - (0.3333333333333333 / n)) / x) + (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) :: t_0
real(8) :: tmp
t_0 = -log(x) / n
if (x <= 4.5d-267) then
tmp = t_0
else if (x <= 1.5d-251) then
tmp = 1.0d0 / (n * x)
else if (x <= 0.7d0) then
tmp = t_0
else if (x <= 1.08d+201) then
tmp = ((1.0d0 / n) - (((((0.25d0 / (n * x)) - (0.3333333333333333d0 / n)) / x) + (0.5d0 / n)) / x)) / 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 tmp;
if (x <= 4.5e-267) {
tmp = t_0;
} else if (x <= 1.5e-251) {
tmp = 1.0 / (n * x);
} else if (x <= 0.7) {
tmp = t_0;
} else if (x <= 1.08e+201) {
tmp = ((1.0 / n) - (((((0.25 / (n * x)) - (0.3333333333333333 / n)) / x) + (0.5 / n)) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): t_0 = -math.log(x) / n tmp = 0 if x <= 4.5e-267: tmp = t_0 elif x <= 1.5e-251: tmp = 1.0 / (n * x) elif x <= 0.7: tmp = t_0 elif x <= 1.08e+201: tmp = ((1.0 / n) - (((((0.25 / (n * x)) - (0.3333333333333333 / n)) / x) + (0.5 / n)) / x)) / x else: tmp = 0.0 return tmp
function code(x, n) t_0 = Float64(Float64(-log(x)) / n) tmp = 0.0 if (x <= 4.5e-267) tmp = t_0; elseif (x <= 1.5e-251) tmp = Float64(1.0 / Float64(n * x)); elseif (x <= 0.7) tmp = t_0; elseif (x <= 1.08e+201) tmp = Float64(Float64(Float64(1.0 / n) - Float64(Float64(Float64(Float64(Float64(0.25 / Float64(n * x)) - Float64(0.3333333333333333 / n)) / x) + Float64(0.5 / n)) / x)) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) t_0 = -log(x) / n; tmp = 0.0; if (x <= 4.5e-267) tmp = t_0; elseif (x <= 1.5e-251) tmp = 1.0 / (n * x); elseif (x <= 0.7) tmp = t_0; elseif (x <= 1.08e+201) tmp = ((1.0 / n) - (((((0.25 / (n * x)) - (0.3333333333333333 / n)) / x) + (0.5 / n)) / x)) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := Block[{t$95$0 = N[((-N[Log[x], $MachinePrecision]) / n), $MachinePrecision]}, If[LessEqual[x, 4.5e-267], t$95$0, If[LessEqual[x, 1.5e-251], N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.7], t$95$0, If[LessEqual[x, 1.08e+201], N[(N[(N[(1.0 / n), $MachinePrecision] - N[(N[(N[(N[(N[(0.25 / N[(n * x), $MachinePrecision]), $MachinePrecision] - N[(0.3333333333333333 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-\log x}{n}\\
\mathbf{if}\;x \leq 4.5 \cdot 10^{-267}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{-251}:\\
\;\;\;\;\frac{1}{n \cdot x}\\
\mathbf{elif}\;x \leq 0.7:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.08 \cdot 10^{+201}:\\
\;\;\;\;\frac{\frac{1}{n} - \frac{\frac{\frac{0.25}{n \cdot x} - \frac{0.3333333333333333}{n}}{x} + \frac{0.5}{n}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 4.4999999999999999e-267 or 1.4999999999999999e-251 < x < 0.69999999999999996Initial program 39.4%
Taylor expanded in n around inf 53.5%
log1p-define53.5%
Simplified53.5%
Taylor expanded in x around 0 51.7%
neg-mul-151.7%
Simplified51.7%
if 4.4999999999999999e-267 < x < 1.4999999999999999e-251Initial program 100.0%
Taylor expanded in n around inf 9.5%
log1p-define9.5%
Simplified9.5%
Taylor expanded in x around inf 83.9%
*-commutative83.9%
Simplified83.9%
if 0.69999999999999996 < x < 1.08000000000000006e201Initial program 49.7%
Taylor expanded in n around inf 48.4%
log1p-define48.4%
Simplified48.4%
Taylor expanded in x around -inf 68.2%
mul-1-neg68.2%
Simplified68.2%
if 1.08000000000000006e201 < x Initial program 92.1%
Taylor expanded in n around inf 92.1%
log1p-define92.1%
Simplified92.1%
add-log-exp92.1%
div-inv92.1%
exp-prod92.1%
exp-diff92.1%
add-exp-log58.5%
log1p-undefine58.5%
rem-exp-log92.1%
Applied egg-rr92.1%
+-commutative92.1%
Simplified92.1%
Taylor expanded in x around inf 92.1%
Final simplification62.8%
(FPCore (x n)
:precision binary64
(if (<= x 7.2e-242)
(- 1.0 (pow x (/ 1.0 n)))
(if (<= x 0.9)
(/ (- x (log x)) n)
(if (<= x 1.75e+201)
(/
(-
(/ 1.0 n)
(/
(+ (/ (- (/ 0.25 (* n x)) (/ 0.3333333333333333 n)) x) (/ 0.5 n))
x))
x)
0.0))))
double code(double x, double n) {
double tmp;
if (x <= 7.2e-242) {
tmp = 1.0 - pow(x, (1.0 / n));
} else if (x <= 0.9) {
tmp = (x - log(x)) / n;
} else if (x <= 1.75e+201) {
tmp = ((1.0 / n) - (((((0.25 / (n * x)) - (0.3333333333333333 / n)) / x) + (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 <= 7.2d-242) then
tmp = 1.0d0 - (x ** (1.0d0 / n))
else if (x <= 0.9d0) then
tmp = (x - log(x)) / n
else if (x <= 1.75d+201) then
tmp = ((1.0d0 / n) - (((((0.25d0 / (n * x)) - (0.3333333333333333d0 / n)) / x) + (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 <= 7.2e-242) {
tmp = 1.0 - Math.pow(x, (1.0 / n));
} else if (x <= 0.9) {
tmp = (x - Math.log(x)) / n;
} else if (x <= 1.75e+201) {
tmp = ((1.0 / n) - (((((0.25 / (n * x)) - (0.3333333333333333 / n)) / x) + (0.5 / n)) / x)) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 7.2e-242: tmp = 1.0 - math.pow(x, (1.0 / n)) elif x <= 0.9: tmp = (x - math.log(x)) / n elif x <= 1.75e+201: tmp = ((1.0 / n) - (((((0.25 / (n * x)) - (0.3333333333333333 / n)) / x) + (0.5 / n)) / x)) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 7.2e-242) tmp = Float64(1.0 - (x ^ Float64(1.0 / n))); elseif (x <= 0.9) tmp = Float64(Float64(x - log(x)) / n); elseif (x <= 1.75e+201) tmp = Float64(Float64(Float64(1.0 / n) - Float64(Float64(Float64(Float64(Float64(0.25 / Float64(n * x)) - Float64(0.3333333333333333 / n)) / x) + Float64(0.5 / n)) / x)) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 7.2e-242) tmp = 1.0 - (x ^ (1.0 / n)); elseif (x <= 0.9) tmp = (x - log(x)) / n; elseif (x <= 1.75e+201) tmp = ((1.0 / n) - (((((0.25 / (n * x)) - (0.3333333333333333 / n)) / x) + (0.5 / n)) / x)) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 7.2e-242], N[(1.0 - N[Power[x, N[(1.0 / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.9], N[(N[(x - N[Log[x], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision], If[LessEqual[x, 1.75e+201], N[(N[(N[(1.0 / n), $MachinePrecision] - N[(N[(N[(N[(N[(0.25 / N[(n * x), $MachinePrecision]), $MachinePrecision] - N[(0.3333333333333333 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7.2 \cdot 10^{-242}:\\
\;\;\;\;1 - {x}^{\left(\frac{1}{n}\right)}\\
\mathbf{elif}\;x \leq 0.9:\\
\;\;\;\;\frac{x - \log x}{n}\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{+201}:\\
\;\;\;\;\frac{\frac{1}{n} - \frac{\frac{\frac{0.25}{n \cdot x} - \frac{0.3333333333333333}{n}}{x} + \frac{0.5}{n}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 7.20000000000000028e-242Initial program 63.2%
Taylor expanded in x around 0 63.2%
if 7.20000000000000028e-242 < x < 0.900000000000000022Initial program 36.0%
Taylor expanded in n around inf 54.4%
log1p-define54.4%
Simplified54.4%
Taylor expanded in x around 0 52.5%
if 0.900000000000000022 < x < 1.7500000000000001e201Initial program 50.4%
Taylor expanded in n around inf 47.6%
log1p-define47.6%
Simplified47.6%
Taylor expanded in x around -inf 68.9%
mul-1-neg68.9%
Simplified68.9%
if 1.7500000000000001e201 < x Initial program 92.1%
Taylor expanded in n around inf 92.1%
log1p-define92.1%
Simplified92.1%
add-log-exp92.1%
div-inv92.1%
exp-prod92.1%
exp-diff92.1%
add-exp-log58.5%
log1p-undefine58.5%
rem-exp-log92.1%
Applied egg-rr92.1%
+-commutative92.1%
Simplified92.1%
Taylor expanded in x around inf 92.1%
Final simplification63.9%
(FPCore (x n)
:precision binary64
(if (<= x 0.86)
(/
(+
(/ 1.0 n)
(*
(/ (+ (* (* n x) -0.5) (* n 0.3333333333333333)) (* n (* n x)))
(/ 1.0 x)))
x)
(/
(-
(/ 1.0 n)
(/ (+ (/ (- (/ 0.25 (* n x)) (/ 0.3333333333333333 n)) x) (/ 0.5 n)) x))
x)))
double code(double x, double n) {
double tmp;
if (x <= 0.86) {
tmp = ((1.0 / n) + (((((n * x) * -0.5) + (n * 0.3333333333333333)) / (n * (n * x))) * (1.0 / x))) / x;
} else {
tmp = ((1.0 / n) - (((((0.25 / (n * x)) - (0.3333333333333333 / n)) / x) + (0.5 / n)) / x)) / 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.86d0) then
tmp = ((1.0d0 / n) + (((((n * x) * (-0.5d0)) + (n * 0.3333333333333333d0)) / (n * (n * x))) * (1.0d0 / x))) / x
else
tmp = ((1.0d0 / n) - (((((0.25d0 / (n * x)) - (0.3333333333333333d0 / n)) / x) + (0.5d0 / n)) / x)) / x
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 0.86) {
tmp = ((1.0 / n) + (((((n * x) * -0.5) + (n * 0.3333333333333333)) / (n * (n * x))) * (1.0 / x))) / x;
} else {
tmp = ((1.0 / n) - (((((0.25 / (n * x)) - (0.3333333333333333 / n)) / x) + (0.5 / n)) / x)) / x;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 0.86: tmp = ((1.0 / n) + (((((n * x) * -0.5) + (n * 0.3333333333333333)) / (n * (n * x))) * (1.0 / x))) / x else: tmp = ((1.0 / n) - (((((0.25 / (n * x)) - (0.3333333333333333 / n)) / x) + (0.5 / n)) / x)) / x return tmp
function code(x, n) tmp = 0.0 if (x <= 0.86) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(Float64(Float64(n * x) * -0.5) + Float64(n * 0.3333333333333333)) / Float64(n * Float64(n * x))) * Float64(1.0 / x))) / x); else tmp = Float64(Float64(Float64(1.0 / n) - Float64(Float64(Float64(Float64(Float64(0.25 / Float64(n * x)) - Float64(0.3333333333333333 / n)) / x) + Float64(0.5 / n)) / x)) / x); end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 0.86) tmp = ((1.0 / n) + (((((n * x) * -0.5) + (n * 0.3333333333333333)) / (n * (n * x))) * (1.0 / x))) / x; else tmp = ((1.0 / n) - (((((0.25 / (n * x)) - (0.3333333333333333 / n)) / x) + (0.5 / n)) / x)) / x; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 0.86], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(N[(N[(n * x), $MachinePrecision] * -0.5), $MachinePrecision] + N[(n * 0.3333333333333333), $MachinePrecision]), $MachinePrecision] / N[(n * N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(1.0 / n), $MachinePrecision] - N[(N[(N[(N[(N[(0.25 / N[(n * x), $MachinePrecision]), $MachinePrecision] - N[(0.3333333333333333 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(0.5 / n), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.86:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\left(n \cdot x\right) \cdot -0.5 + n \cdot 0.3333333333333333}{n \cdot \left(n \cdot x\right)} \cdot \frac{1}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{n} - \frac{\frac{\frac{0.25}{n \cdot x} - \frac{0.3333333333333333}{n}}{x} + \frac{0.5}{n}}{x}}{x}\\
\end{array}
\end{array}
if x < 0.859999999999999987Initial program 41.6%
Taylor expanded in n around inf 52.0%
log1p-define52.0%
Simplified52.0%
Taylor expanded in x around -inf 34.5%
div-inv34.5%
cancel-sign-sub-inv34.5%
un-div-inv34.5%
*-commutative34.5%
un-div-inv34.5%
metadata-eval34.5%
Applied egg-rr34.5%
+-commutative34.5%
frac-add37.3%
*-commutative37.3%
*-commutative37.3%
Applied egg-rr37.3%
if 0.859999999999999987 < x Initial program 65.5%
Taylor expanded in n around inf 63.7%
log1p-define63.7%
Simplified63.7%
Taylor expanded in x around -inf 68.3%
mul-1-neg68.3%
Simplified68.3%
Final simplification50.0%
(FPCore (x n)
:precision binary64
(if (<= x 4e+88)
(/
(+
(/ 1.0 n)
(*
(/ (+ (* (* n x) -0.5) (* n 0.3333333333333333)) (* n (* n x)))
(/ 1.0 x)))
x)
0.0))
double code(double x, double n) {
double tmp;
if (x <= 4e+88) {
tmp = ((1.0 / n) + (((((n * x) * -0.5) + (n * 0.3333333333333333)) / (n * (n * x))) * (1.0 / 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 <= 4d+88) then
tmp = ((1.0d0 / n) + (((((n * x) * (-0.5d0)) + (n * 0.3333333333333333d0)) / (n * (n * x))) * (1.0d0 / x))) / x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double n) {
double tmp;
if (x <= 4e+88) {
tmp = ((1.0 / n) + (((((n * x) * -0.5) + (n * 0.3333333333333333)) / (n * (n * x))) * (1.0 / x))) / x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, n): tmp = 0 if x <= 4e+88: tmp = ((1.0 / n) + (((((n * x) * -0.5) + (n * 0.3333333333333333)) / (n * (n * x))) * (1.0 / x))) / x else: tmp = 0.0 return tmp
function code(x, n) tmp = 0.0 if (x <= 4e+88) tmp = Float64(Float64(Float64(1.0 / n) + Float64(Float64(Float64(Float64(Float64(n * x) * -0.5) + Float64(n * 0.3333333333333333)) / Float64(n * Float64(n * x))) * Float64(1.0 / x))) / x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, n) tmp = 0.0; if (x <= 4e+88) tmp = ((1.0 / n) + (((((n * x) * -0.5) + (n * 0.3333333333333333)) / (n * (n * x))) * (1.0 / x))) / x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, n_] := If[LessEqual[x, 4e+88], N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(N[(N[(N[(n * x), $MachinePrecision] * -0.5), $MachinePrecision] + N[(n * 0.3333333333333333), $MachinePrecision]), $MachinePrecision] / N[(n * N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4 \cdot 10^{+88}:\\
\;\;\;\;\frac{\frac{1}{n} + \frac{\left(n \cdot x\right) \cdot -0.5 + n \cdot 0.3333333333333333}{n \cdot \left(n \cdot x\right)} \cdot \frac{1}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 3.99999999999999984e88Initial program 40.9%
Taylor expanded in n around inf 48.5%
log1p-define48.5%
Simplified48.5%
Taylor expanded in x around -inf 40.4%
div-inv40.4%
cancel-sign-sub-inv40.4%
un-div-inv40.4%
*-commutative40.4%
un-div-inv40.4%
metadata-eval40.4%
Applied egg-rr40.4%
+-commutative40.4%
frac-add42.2%
*-commutative42.2%
*-commutative42.2%
Applied egg-rr42.2%
if 3.99999999999999984e88 < x Initial program 79.1%
Taylor expanded in n around inf 79.1%
log1p-define79.1%
Simplified79.1%
add-log-exp79.1%
div-inv79.1%
exp-prod79.1%
exp-diff79.1%
add-exp-log49.6%
log1p-undefine49.6%
rem-exp-log79.1%
Applied egg-rr79.1%
+-commutative79.1%
Simplified79.1%
Taylor expanded in x around inf 79.1%
Final simplification52.3%
(FPCore (x n) :precision binary64 (/ (+ (/ 1.0 n) (/ (+ -0.5 (/ 0.3333333333333333 x)) (* n x))) x))
double code(double x, double n) {
return ((1.0 / n) + ((-0.5 + (0.3333333333333333 / x)) / (n * x))) / x;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((1.0d0 / n) + (((-0.5d0) + (0.3333333333333333d0 / x)) / (n * x))) / x
end function
public static double code(double x, double n) {
return ((1.0 / n) + ((-0.5 + (0.3333333333333333 / x)) / (n * x))) / x;
}
def code(x, n): return ((1.0 / n) + ((-0.5 + (0.3333333333333333 / x)) / (n * x))) / x
function code(x, n) return Float64(Float64(Float64(1.0 / n) + Float64(Float64(-0.5 + Float64(0.3333333333333333 / x)) / Float64(n * x))) / x) end
function tmp = code(x, n) tmp = ((1.0 / n) + ((-0.5 + (0.3333333333333333 / x)) / (n * x))) / x; end
code[x_, n_] := N[(N[(N[(1.0 / n), $MachinePrecision] + N[(N[(-0.5 + N[(0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / N[(n * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{n} + \frac{-0.5 + \frac{0.3333333333333333}{x}}{n \cdot x}}{x}
\end{array}
Initial program 51.4%
Taylor expanded in n around inf 56.8%
log1p-define56.8%
Simplified56.8%
div-inv56.8%
Applied egg-rr56.8%
Taylor expanded in x around inf 35.3%
+-commutative35.3%
associate--l+35.3%
*-commutative35.3%
unpow235.3%
associate-*r*35.3%
associate-/r*35.3%
metadata-eval35.3%
associate-*r/35.3%
*-commutative35.3%
div-sub48.3%
sub-neg48.3%
associate-*r/48.3%
metadata-eval48.3%
metadata-eval48.3%
*-commutative48.3%
Simplified48.3%
Final simplification48.3%
(FPCore (x n) :precision binary64 (/ (+ -1.0 (/ (+ 0.5 (/ -0.3333333333333333 x)) x)) (* n (- x))))
double code(double x, double n) {
return (-1.0 + ((0.5 + (-0.3333333333333333 / x)) / x)) / (n * -x);
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = ((-1.0d0) + ((0.5d0 + ((-0.3333333333333333d0) / x)) / x)) / (n * -x)
end function
public static double code(double x, double n) {
return (-1.0 + ((0.5 + (-0.3333333333333333 / x)) / x)) / (n * -x);
}
def code(x, n): return (-1.0 + ((0.5 + (-0.3333333333333333 / x)) / x)) / (n * -x)
function code(x, n) return Float64(Float64(-1.0 + Float64(Float64(0.5 + Float64(-0.3333333333333333 / x)) / x)) / Float64(n * Float64(-x))) end
function tmp = code(x, n) tmp = (-1.0 + ((0.5 + (-0.3333333333333333 / x)) / x)) / (n * -x); end
code[x_, n_] := N[(N[(-1.0 + N[(N[(0.5 + N[(-0.3333333333333333 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(n * (-x)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-1 + \frac{0.5 + \frac{-0.3333333333333333}{x}}{x}}{n \cdot \left(-x\right)}
\end{array}
Initial program 51.4%
Taylor expanded in n around inf 56.8%
log1p-define56.8%
Simplified56.8%
Taylor expanded in x around -inf 48.3%
Taylor expanded in n around 0 48.0%
sub-neg48.0%
associate-*r/48.0%
sub-neg48.0%
metadata-eval48.0%
distribute-lft-in48.0%
neg-mul-148.0%
associate-*r/48.0%
metadata-eval48.0%
distribute-neg-frac48.0%
metadata-eval48.0%
metadata-eval48.0%
metadata-eval48.0%
*-commutative48.0%
Simplified48.0%
Final simplification48.0%
(FPCore (x n) :precision binary64 (/ 1.0 (* n x)))
double code(double x, double n) {
return 1.0 / (n * x);
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = 1.0d0 / (n * x)
end function
public static double code(double x, double n) {
return 1.0 / (n * x);
}
def code(x, n): return 1.0 / (n * x)
function code(x, n) return Float64(1.0 / Float64(n * x)) end
function tmp = code(x, n) tmp = 1.0 / (n * x); end
code[x_, n_] := N[(1.0 / N[(n * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{n \cdot x}
\end{array}
Initial program 51.4%
Taylor expanded in n around inf 56.8%
log1p-define56.8%
Simplified56.8%
Taylor expanded in x around inf 42.9%
*-commutative42.9%
Simplified42.9%
Final simplification42.9%
(FPCore (x n) :precision binary64 (/ (/ 1.0 x) n))
double code(double x, double n) {
return (1.0 / x) / n;
}
real(8) function code(x, n)
real(8), intent (in) :: x
real(8), intent (in) :: n
code = (1.0d0 / x) / n
end function
public static double code(double x, double n) {
return (1.0 / x) / n;
}
def code(x, n): return (1.0 / x) / n
function code(x, n) return Float64(Float64(1.0 / x) / n) end
function tmp = code(x, n) tmp = (1.0 / x) / n; end
code[x_, n_] := N[(N[(1.0 / x), $MachinePrecision] / n), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x}}{n}
\end{array}
Initial program 51.4%
Taylor expanded in n around inf 56.8%
log1p-define56.8%
Simplified56.8%
Taylor expanded in x around inf 43.1%
Final simplification43.1%
herbie shell --seed 2024073
(FPCore (x n)
:name "2nthrt (problem 3.4.6)"
:precision binary64
(- (pow (+ x 1.0) (/ 1.0 n)) (pow x (/ 1.0 n))))