[R] what is R equivalent of Fortran DOUBLE PRECISION ?
Steven McKinney
smckinney at bccrc.ca
Tue Mar 31 04:45:03 CEST 2009
>From the help page for "Foreign"
> ?Foreign
Numeric vectors in R will be passed as type double * to C (and as double precision to Fortran)
Also, see the help page for "double"
> ?double
R has no single precision data type. All real numbers are stored in double precision format.
The functions as.single and single are identical to as.double and double except they set
the attribute Csingle that is used in the .C and .Fortran interface, and they are intended
only to be used in that context.
HTH
Steven McKinney, Ph.D.
Statistician
Molecular Oncology and Breast Cancer Program
British Columbia Cancer Research Centre
email: smckinney +at+ bccrc +dot+ ca
tel: 604-675-8000 x7561
BCCRC
Molecular Oncology
675 West 10th Ave, Floor 4
Vancouver B.C.
V5Z 1L3
Canada
-----Original Message-----
From: r-help-bounces at r-project.org on behalf of mauede at alice.it
Sent: Mon 3/30/2009 3:07 AM
To: r-help at r-project.org
Cc: John C. Nash
Subject: [R] what is R equivalent of Fortran DOUBLE PRECISION ?
I noticed taht R cannot understand certain Fortran real constant formats. For instance:
c14 <- as.double( 7.785205408500864D-02)
Error: unexpected symbol in " c14 <- as.double( 7.785205408500864D"
The above "D" is used in Fortran language to indicate the memory starage mode. That is for instructing Fortran compiler
to store such a REAL constant in DOUBLE PRECISION... am I right ?
Since R cannot undestand numerical conatant post-fixed by the letter "D", I wonder how I can instruct R interpreter to
store such a numerical constant reserving as muh memory as necessary so as to accommodate a double precision number.
I noticed R accepts the folllowing syntax but I do not know if i have achieved my goal thsi way:
> c14 <- as.double( 7.785205408500864E-02)
> typeof(c4)
[1] "double"
My questions are: what is the best precision I can get with R when dealing with real number ?
Is R "double" type equvalent to Fortran DOUBLE PRECISION for internal number representation ?
Thank you very much.
Maura
tutti i telefonini TIM!
[[alternative HTML version deleted]]
______________________________________________
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.
More information about the R-help
mailing list