Displaying 6 results from an estimated 6 matches for "mathlib_warning2".
2020 Jan 14
2
[R] choose(n, k) as n approaches k
...very close to an integer. So I'd suggest the replacement whenever R_IS_INT(n) is true.
>
But choose() very deliberately ensures that k is integer, so choose(n, n-k) is ill-defined for non-integer n.
double r, k0 = k;
k = R_forceint(k);
...
if (fabs(k - k0) > 1e-7)
MATHLIB_WARNING2(_("'k' (%.2f) must be integer, rounded to %.0f"), k0, k);
> Duncan Murdoch
>
>> -pd
>>> On 14 Jan 2020, at 00:33 , Wright, Erik Scott <ESWRIGHT at pitt.edu> wrote:
>>>
>>> This struck me as incorrect:
>>>
>>>>...
2020 Jan 14
4
[R] choose(n, k) as n approaches k
...d to integer in this near-integer situation, regardless of the value of k.
>
> I believe that lchoose(n, k) already does this.
>
> Duncan Murdoch
>
>> double r, k0 = k;
>> k = R_forceint(k);
>> ...
>> if (fabs(k - k0) > 1e-7)
>> MATHLIB_WARNING2(_("'k' (%.2f) must be integer, rounded to %.0f"), k0, k);
>>
>>> Duncan Murdoch
>>>
>>>> -pd
>>>>> On 14 Jan 2020, at 00:33 , Wright, Erik Scott <ESWRIGHT at pitt.edu> wrote:
>>>>>
>>>>> Th...
2020 Jan 14
0
[R] choose(n, k) as n approaches k
...ink both n and k
should be rounded to integer in this near-integer situation, regardless
of the value of k.
I believe that lchoose(n, k) already does this.
Duncan Murdoch
>
> double r, k0 = k;
> k = R_forceint(k);
> ...
> if (fabs(k - k0) > 1e-7)
> MATHLIB_WARNING2(_("'k' (%.2f) must be integer, rounded to %.0f"), k0, k);
>
>
>> Duncan Murdoch
>>
>>> -pd
>>>> On 14 Jan 2020, at 00:33 , Wright, Erik Scott <ESWRIGHT at pitt.edu> wrote:
>>>>
>>>> This struck me as incorre...
2020 Jan 15
1
[R] choose(n, k) as n approaches k
...gt;>>
>>> I believe that lchoose(n, k) already does this.
>>>
>>> Duncan Murdoch
>>>
>>>> double r, k0 = k;
>>>> k = R_forceint(k);
>>>> ...
>>>> if (fabs(k - k0) > 1e-7)
>>>> MATHLIB_WARNING2(_("'k' (%.2f) must be integer, rounded to %.0f"), k0, k);
>>>>
>>>>> Duncan Murdoch
>>>>>
>>>>>> -pd
>>>>>>> On 14 Jan 2020, at 00:33 , Wright, Erik Scott <ESWRIGHT at pitt.edu> wrote:
>>...
2020 Jan 14
1
[R] choose(n, k) as n approaches k
Yep, that looks wrong (probably want to continue discussion over on R-devel)
I think the culprit is here (in src/nmath/choose.c)
if (k < k_small_max) {
int j;
if(n-k < k && n >= 0 && R_IS_INT(n)) k = n-k; /* <- Symmetry */
if (k < 0) return 0.;
if (k == 0) return 1.;
/* else: k >= 1 */
if n is a near-integer, then k
2020 Jan 14
0
[R] choose(n, k) as n approaches k
...tuation, regardless of the value of k.
>>
>> I believe that lchoose(n, k) already does this.
>>
>> Duncan Murdoch
>>
>>> double r, k0 = k;
>>> k = R_forceint(k);
>>> ...
>>> if (fabs(k - k0) > 1e-7)
>>> MATHLIB_WARNING2(_("'k' (%.2f) must be integer, rounded to %.0f"), k0, k);
>>>
>>>> Duncan Murdoch
>>>>
>>>>> -pd
>>>>>> On 14 Jan 2020, at 00:33 , Wright, Erik Scott <ESWRIGHT at pitt.edu> wrote:
>>>>>>
&...