# numer-utils

From DPQ v0.3-3
0th

Percentile

##### Numerical Utilities - Functions, Constants

The DPQ package provides some numeric constants used in some of its distribution computations.

all_mpfr() and any_mpfr() return TRUE iff all (or ‘any’, respectively) of their arguments inherit from class "mpfr" (from package Rmpfr).

logr(x,a) computes log(x / (x + a)) in a numerically stable way.

Keywords
math
##### Usage
## Numeric Constants : % mostly in   ../R/beta-fns.R
M_LN2        # = log(2) = 0.693....
M_cutoff     # := If |x| > |k| * M_cutoff, then  log[ exp(-x) * k^x ]  =~=  -x
#  = 3196577161300663808 ~= 3.2e+18
M_minExp     # = log(2) * .Machine\$double.min.exp # ~= -708.396..
G_half       # = sqrt(pi) = Gamma( 1/2 )## Functions :
all_mpfr(...)
any_mpfr(...)
logr(x, a)    # == log(x / (x + a)) -- but numerically smart; x > 0, a >= 0 > -x
##### Arguments

numeric or "mpfr" numeric vectors.

x, a

number-like ..

##### Details

all_mpfr(),

all_mpfr() :

test if all or any of their arguments or of class "mpfr" (from package Rmpfr). The arguments are evaluated only until the result is determined, see the example.

logr()

computes $\log( x / (x+a) )$ in a numerically stable way.

%% which means .... (TODO)

%% \item{\code{..()}}{ ..} %% \item{\code{..()}}{ ..}

##### Value

The numeric constant in the first case; a numeric (or "mpfr") vector of appropriate size in the 2nd case.

.Machine

• M_LN2
• M_minExp
• M_cutoff
• G_half
• all_mpfr
• any_mpfr
• logr
##### Examples
# NOT RUN {
(Ms <- ls("package:DPQ", pattern = "^M"))
lapply(Ms, function(nm) { cat(nm,": "); print(get(nm)) }) -> .tmp
# }

Documentation reproduced from package DPQ, version 0.3-3, License: GPL (>= 2)

### Community examples

Looks like there are no examples yet.