Possible typo in the C source code of R

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Possible typo in the C source code of R

Martin Bodin
Good morning,

I am Martin Bodin, a postdoc at the CMM in Santiago de Chile, and I am
currently in the process of formalising (a part of) the R language into
the Coq proof assistant. This work makes me look frequently at the
source code of R.

I have noticed a strange line in the file src/main/util.c of the trunk
branch:
https://github.com/wch/r-source/blob/e42531eff56ee6582d7dc6a46f242af5447c633e/src/main/util.c#L70

The line 70 “REAL(x)[0] == REAL(x)[0]” doesn’t make any sense for me:
are we looking for NaN values here? I think that it should be
“REAL(x)[0] == REAL(y)[0]” instead (and the same applies for the next
two lines).

I didn’t searched for any R program that may be affected by this typo,
but I have the feeling that it may lead to unexpected behaviours.

From what I understood, the bug reporting tool for R is closed for
non-members, and I am thus sending this possible bug report in this
list. Please redirect me if I am not reporting in the right place.

Best regards,
Martin Bodin.



______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Possible typo in the C source code of R

Tomas Kalibera
Thank you, Martin, for spotting this, it is clearly a bug, originally a
conformance check was intended here and time series were defined using
integers, so exact comparison would have made sense. Now time series are
defined using doubles and exact comparison could be too strict with
rounding errors. Moreover, it is not clear whether a conformance check
at this low-level is a good thing, so the check has been removed
completely, keeping the current behavior of R (except NaNs in the
definition).

Best
Tomas

On 02/07/2018 04:12 PM, Martin Bodin wrote:

> Good morning,
>
> I am Martin Bodin, a postdoc at the CMM in Santiago de Chile, and I am
> currently in the process of formalising (a part of) the R language into
> the Coq proof assistant. This work makes me look frequently at the
> source code of R.
>
> I have noticed a strange line in the file src/main/util.c of the trunk
> branch:
> https://github.com/wch/r-source/blob/e42531eff56ee6582d7dc6a46f242af5447c633e/src/main/util.c#L70
>
> The line 70 “REAL(x)[0] == REAL(x)[0]” doesn’t make any sense for me:
> are we looking for NaN values here? I think that it should be
> “REAL(x)[0] == REAL(y)[0]” instead (and the same applies for the next
> two lines).
>
> I didn’t searched for any R program that may be affected by this typo,
> but I have the feeling that it may lead to unexpected behaviours.
>
>  From what I understood, the bug reporting tool for R is closed for
> non-members, and I am thus sending this possible bug report in this
> list. Please redirect me if I am not reporting in the right place.
>
> Best regards,
> Martin Bodin.
>
>
>
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel