Skip to content

Commit 8b6c4d6

Browse files
author
maechler
committed
describe gamma()`s behavior for negatives // mention that <complex> does not fulfill is.numeric()
git-svn-id: https://svn.r-project.org/R/trunk@87715 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent fa73948 commit 8b6c4d6

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

doc/NEWS.Rd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,9 @@
196196
\item \code{optimize(f, *)} when \code{f(x)} is not finite says
197197
more about the value in its \code{warning} message. It no longer
198198
replaces \code{-Inf} by the largest \emph{positive} finite number.
199+
200+
\item The documentation of \code{gamma} and \code{is.numeric} is more
201+
specific, thanks to the contributors of \PR{18677}.
199202
}
200203
}
201204

src/library/base/man/Special.Rd

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
% File src/library/base/man/Special.Rd
22
% Part of the R package, https://www.R-project.org
3-
% Copyright 1995-2022 R Core Team
3+
% Copyright 1995-2025 R Core Team
44
% Distributed under GPL 2 or later
55

66
\name{Special}
@@ -62,7 +62,15 @@ lfactorial(x)
6262
gamma function. The gamma function is defined by
6363
(\bibcite{Abramowitz and Stegun section 6.1.1, page 255})
6464
\deqn{\Gamma(x) = \int_0^\infty t^{x-1} e^{-t} dt}{\Gamma(x) = integral_0^Inf t^(x-1) exp(-t) dt}
65-
for all real \code{x} except zero and negative integers (when
65+
for all \eqn{x > 0}, from which the recursions \eqn{\Gamma(x+1) =
66+
x\Gamma(x)} and then \eqn{\Gamma(x+n) = (x+n-1)(x+n-2)\cdots x \Gamma(x)}
67+
for all non-negative integers \eqn{n}. Solving for \eqn{\Gamma(x)} and
68+
analytic continuation leads to the expression for non-integer negative real numbers,
69+
\deqn{\Gamma(x) = \frac{\Gamma(x + n)}{(x + n -1) \cdots (x + 1)x}, \ n \in \mathbb{Z}^{+}, -n < x < 0,%
70+
}{\Gamma(x) = \Gamma(x + n)/((x + n -1) ... (x + 1)x), n in N, -n < x < 0,}
71+
see \bibcite{Abramowitz and Stegun (6.1.16 or 6.1.22, page 256)}.
72+
%
73+
The gamma function is not defined for zero and negative integers (when
6674
\code{NaN} is returned). There will be a warning on possible loss of
6775
precision for values which are too close (within about
6876
\eqn{10^{-8}}{1e-8}) to a negative integer less than \samp{-10}.

src/library/base/man/numeric.Rd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ is.numeric(x)
3939
function: you can write methods to handle specific classes of objects,
4040
see \link{InternalMethods}. It is \strong{not} the same as
4141
\code{\link{is.double}}. Factors are handled by the default method,
42-
and there are methods for classes \code{"\link{Date}"},
42+
and there are methods for classes \code{"\link{complex}"}, \code{"\link{Date}"},
4343
\code{"\link{POSIXt}"} and \code{"\link{difftime}"} (all of which
4444
return false). Methods for \code{is.numeric} should only return true
4545
if the base type of the class is \code{double} or \code{integer}

0 commit comments

Comments
 (0)