Re: [Rd] [R] choose(n, k) as n approaches k

2020-01-17 Thread Peter Dalgaard
More importantly, the gamma function is not nice for negative integer arguments, so gchoose() blows up for integer k and n=-1,-2,... > gchoose(-2,4) [1] NaN Warning messages: 1: In gamma(n + 1) : NaNs produced 2: In gamma(n + 1 - k) : NaNs produced > choose(-2,4) [1] 5 and so does the formula

Re: [Rd] [R] choose(n, k) as n approaches k

2020-01-17 Thread peter dalgaard
Fix committed to R-devel w/regression test. I settled for just doing k = R_forceint(n - k) inside if(n-k < k && n >= 0 && R_IS_INT(n)) k = n-k; /* <- Symmetry */ so that k stays integer. In principle, you also could prefix this code r = n; for(j = 2; j <= k; j++)

Re: [Rd] A bug understanding F relative to FALSE?

2020-01-17 Thread John Mount
>From help(F): TRUE and FALSE are reserved > words denoting >logical constants in the Rlanguage, whereas T and F are global variables whose >initial values set to these. > On Jan 15, 2020, at 6:13 AM, IAGO GINÉ VÁZQUEZ wrote: > > Hi all,