[R] Displaying numerics to full double precision

From: Jeff Delmerico <jeffdelmerico_at_yahoo.com>
Date: Wed, 5 Dec 2007 08:39:41 -0800 (PST)

I'm working on a shared library of C functions for use with R, and I want to create a matrix in R and pass it to the C routines. I know R computes and supposedly stores numerics in double precision, but when I create a matrix of random numerics using rnorm(), the values are displayed in single precision, and also exported in single precision when I pass them out to my C routines. An example is below:

> a <- matrix(rnorm(16, mean=10, sd=4), nrow=4)
> a

          [,1] [,2] [,3] [,4]

[1,] 14.907606 17.572872 19.708977  9.809943
[2,]  9.322041 13.624452  7.745254  7.596176
[3,] 10.642408  6.151546  9.937434  6.913875
[4,] 14.617647  5.577073  8.217559 12.115465

> storage.mode(a)

[1] "double"

Does anyone know if there is a way to change the display or storage settings so that the values will be displayed to their full precision? Or does rnorm only produce values to single precision?

Any assistance would be greatly appreciated.

Jeff Delmerico

View this message in context: http://www.nabble.com/Displaying-numerics-to-full-double-precision-tf4950807.html#a14175334
Sent from the R help mailing list archive at Nabble.com.

R-help_at_r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Wed 05 Dec 2007 - 19:48:53 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 05 Dec 2007 - 22:30:17 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.