Hi,

This is somehow unrelated, but your answer brings up a question that I've been curious about:

On Aug 21, 2009, at 11:48 AM, William Dunlap wrote:


-----Original Message-----
From: r-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org] On Behalf Of kfcnhl
Sent: Thursday, August 20, 2009 7:34 PM
To: r-help@r-project.org
Subject: [R] extra .


sigma0 <- sqrt((6. * var(maxima))/pi)

What does the '.' do here?

In R it does nothing: both '6' and '6.' parse as "numerics"
(in C, double precision numbers).  In SV4 and S+ '6' parses
as an integer (in C, a long) and '6.' parses as a numeric,
so putting the decimal point after numerics makes the
code a bit more portable, although there are not too many
cases where the difference is significant.   Calls to .C, etc.,
and oveflowing arithmetic are the main problem points.

In R and S+ '6L' represents an integer.

If this is true, I'm curious as to why when I'm poking through some source code of different packages, I see that some people are careful to explicitly include the L after integers?

I can't find a good example at the moment, but you can see one such case in the source to the lm.fit function. The details aren't all that important, but here's one of the lines:

    r2 <- if (z$rank < p)
        (z$rank + 1L):p

I mean, why not just (z$rank + 1):p ?

Just wondering if anybody has any insight into that. I've always been curious and I seem to see it done in many different functions and packages, so I feel like I'm missing something ...

Thanks,

-steve

--
Steve Lianoglou
Graduate Student: Computational Systems Biology
  |  Memorial Sloan-Kettering Cancer Center
  |  Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to