sigma0 <- sqrt((6. * var(maxima))/pi) What does the '.' do here? -- View this message in context: http://www.nabble.com/extra-.-tp25073255p25073255.html Sent from the R help mailing list archive at Nabble.com.
My guess is that 6. comes for 6.0 - something which comes from programming languages where 6 represents 6 as integer while 6. (or 6.0) represents 6 as floating point number. --- On Fri, 21/8/09, kfcnhl <zhengchenji18 at hotmail.com> wrote:> From: kfcnhl <zhengchenji18 at hotmail.com> > Subject: [R] extra . > To: r-help at r-project.org > Received: Friday, 21 August, 2009, 12:34 PM > > sigma0 <- sqrt((6. * var(maxima))/pi) > > What does the '.' do here? > -- > View this message in context: http://www.nabble.com/extra-.-tp25073255p25073255.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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. >
It has no effect. Both 6 and 6. represent the number six as a double:> identical(6, 6.)[1] TRUE> typeof(6.)[1] "double" On Thu, Aug 20, 2009 at 10:34 PM, kfcnhl<zhengchenji18 at hotmail.com> wrote:> > sigma0 <- sqrt((6. * var(maxima))/pi) > > What does the '.' do here? > -- > View this message in context: http://www.nabble.com/extra-.-tp25073255p25073255.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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. >
> -----Original Message----- > From: r-help-bounces at r-project.org > [mailto:r-help-bounces at r-project.org] On Behalf Of kfcnhl > Sent: Thursday, August 20, 2009 7:34 PM > To: r-help at 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. S+'s parse has a parse.mode="R" argument that parses text more like R does: '6' is a numeric, '_' is not the assignment operator, && has higher precedence than ||, etc.> -- > View this message in context: > http://www.nabble.com/extra-.-tp25073255p25073255.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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. >