The Writing R Extensions manual, Sec. 6.7.3., states that the R API function declared as double R_pow (double x, double y)
computes x^y
:
[...] using R_FINITE checks and returning the proper result (the same as R) for the cases where
x
,y
or i are 0 or missing or infinite or NaN.
However, I cannot find such x
and y
for which the pow()
function from the C library gives improper results. I tried various cases, like x
, y being
Inf,
NA/
NaN, integers, and so on, but I found no input data that generated the results different than those returned by ordinary
pow()`.
Rcpp::evalCpp("::pow(1.124e-15, 2)", includes = "#include <cmath>") == Rcpp::evalCpp("R_pow(1.124e-15, 2)")
## [1] TRUE
Maybe you guys will provide me with some improper example.
BTW, I'm using gcc 4.8.2 with glibc 2.18 (Fedora 20, x86_64).
For R_pow()
's source code search for R_pow
here.