This is strictly a curiosity question. I am aware the R doesn't possess a float data type. I also don't mean to request that such functionality be implemented as I'm sure it would require a large amount of work with potential back compatibility conflicts. But I wanted to know why R has never had a float data type available? Regards, Charles [[alternative HTML version deleted]]
My understanding is that R does have a float type, it is just called "double" instead of "float". If you are referring to a single precision floating point type, then R does have the "as.single" function, but that does not really change the way the number is stored, just sets a flag so that the proper conversion is done when passing to the ".C" or ".fortran" functions. The original S language and S+ would store things in single precision if needed, but for computations these values were almost always converted to doubles for precision. By the time R was developed the memory saving of using single precision instead of double precision was not as big an issue, so I expect that nobody ever considered it worth the effort to fully implement the single precision storage. If you mean something else other than the above by "float data type" then please give us more details so that we can better answer the question. On Tue, Jun 30, 2015 at 10:42 AM, Charles Determan <cdetermanjr at gmail.com> wrote:> This is strictly a curiosity question. I am aware the R doesn't possess a > float data type. I also don't mean to request that such functionality be > implemented as I'm sure it would require a large amount of work with > potential back compatibility conflicts. But I wanted to know why R has > never had a float data type available? > > Regards, > Charles > > [[alternative HTML version deleted]] > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel-- Gregory (Greg) L. Snow Ph.D. 538280 at gmail.com
Hi Greg, I was referring to the single precision type. Your points were what I expected. I just wanted to ask the R community if there was any other reason than 'there wasn't any reason to implement it'. Thanks, Charles On Tue, Jun 30, 2015 at 12:29 PM, Greg Snow <538280 at gmail.com> wrote:> My understanding is that R does have a float type, it is just called > "double" instead of "float". > > If you are referring to a single precision floating point type, then R > does have the "as.single" function, but that does not really change > the way the number is stored, just sets a flag so that the proper > conversion is done when passing to the ".C" or ".fortran" functions. > The original S language and S+ would store things in single precision > if needed, but for computations these values were almost always > converted to doubles for precision. By the time R was developed the > memory saving of using single precision instead of double precision > was not as big an issue, so I expect that nobody ever considered it > worth the effort to fully implement the single precision storage. > > If you mean something else other than the above by "float data type" > then please give us more details so that we can better answer the > question. > > On Tue, Jun 30, 2015 at 10:42 AM, Charles Determan > <cdetermanjr at gmail.com> wrote: > > This is strictly a curiosity question. I am aware the R doesn't possess > a > > float data type. I also don't mean to request that such functionality be > > implemented as I'm sure it would require a large amount of work with > > potential back compatibility conflicts. But I wanted to know why R has > > never had a float data type available? > > > > Regards, > > Charles > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-devel at r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-devel > > > > -- > Gregory (Greg) L. Snow Ph.D. > 538280 at gmail.com >[[alternative HTML version deleted]]
On 30/06/2015 17:42, Charles Determan wrote:> This is strictly a curiosity question. I am aware the R doesn't possess a > float data type. I also don't mean to request that such functionality be > implemented as I'm sure it would require a large amount of work with > potential back compatibility conflicts. But I wanted to know why R has > never had a float data type available?You said it: 'it would require a large amount of work' and not just for R but also for many packages that users would expect to support data in that format. By the time R started to spread (late 90s), most FPUs were primarily double/extended precision and there was little or no speed advantage to single-precision calculations. And although S[-PLUS] had a 'single' type, we knew it was little used by then. For a few people the storage size may matter (and for others the 32-bit logicals are wasteful): although for most people RAM is cheap enough, there are packages such as 'ff' which address this.> > Regards, > Charles-- Brian D. Ripley, ripley at stats.ox.ac.uk Emeritus Professor of Applied Statistics, University of Oxford 1 South Parks Road, Oxford OX1 3TG, UK
Hi Charles, Probably for the same reason it doesn't have short int, short unsigned int, long int, long unsigned int, long long int, long long unsigned int, long double etc... There are many built-in types in C and, in order to keep things simple, I guess the line had to be drew somewhere. Said otherwise, I don't think the atomic types in R were ever meant to reflect exactly what's available in C. Note that some CRAN packages (e.g. bit64) try to remedy this by providing support for atomic-like types that are not natively supported by R. I don't know if there is one for float though. Cheers, H. On 06/30/2015 09:42 AM, Charles Determan wrote:> This is strictly a curiosity question. I am aware the R doesn't possess a > float data type. I also don't mean to request that such functionality be > implemented as I'm sure it would require a large amount of work with > potential back compatibility conflicts. But I wanted to know why R has > never had a float data type available? > > Regards, > Charles > > [[alternative HTML version deleted]] > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- Herv? Pag?s Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M1-B514 P.O. Box 19024 Seattle, WA 98109-1024 E-mail: hpages at fredhutch.org Phone: (206) 667-5791 Fax: (206) 667-1319