[Rd] Illegal Logical Values

Tomas Kalibera tomas.kalibera at gmail.com
Mon Oct 23 12:52:50 CEST 2017

On 10/21/2017 04:14 PM, Radford Neal wrote:
>> On Fri, 2017-10-20 at 14:01 +0000, brodie gaslam via R-devel wrote:
>>> I'm thinking of this passage:
>>>> Logical values are sent as 0 (FALSE), 1 (TRUE) or INT_MIN =
>>>> -2147483648 (NA, but only if NAOK is true), and the compiled code
>>>> should return one of these three values. (Non-zero values other
>>>> than INT_MIN are mapped to TRUE.)
>>> The parenthetical seems to suggest that something like 'LOGICAL(x)[0]
>>> = 2;' will be treated as TRUE, which it sometimes is, and sometimes
>>> isn't:
>> From: Martyn Plummer <plummerm at iarc.fr>
>> The title of Section 5.2 is "Interface functions .C and .Fortran" and
>> the text above refers to those interfaces. It explains how logical
>> vectors are mapped to C integer arrays on entry and back again on exit.
>> This does work as advertised.
> Not always.  As I reported on bugzilla three years ago (PR#15878), it
> only works if the logical argument does not have to be copied.  The
> bug has been fixed in pqR since pqR-2014-09-30.
>     Radford Neal
Thanks, that's indeed a bug - now fixed in 73583.

> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

More information about the R-devel mailing list