pow(x,y) calls R C API Rmathlib's R_pow(x,y)
function to compute x^yor when try.int.y is true
(as by default), and y is integer valued and fits into integer
range, R_pow_di(x,y).
pow_di(x,y) with integer y calls R mathlib's R_pow_di(x,y).
a numeric vector like x or y which are recycled to common
length, of course.
Arguments
x
a numeric vector.
y
a numeric or in the case of pow_di() integer vector.
try.int.y
logical indicating if pow() should check if
y is integer valued and fits into integer range, and in that
case call pow_di() automatically.
Author
Martin Maechler
Details
In January 2024, I found (e.g., in tests/pow-tst.R)
that the accuracy of pow_di(), i.e., also the C function
R_pow_di() in R's API is of much lower precision than R's
x^y or (equivalently) R_pow(x,y) in R's API, notably on
Linux and macOS, using glib etc, sometimes as soon as \(y \ge 6\)
or so.
.pow(x,y) is identical to pow(x,y, try.int.y = FALSE)