On Wed, Sep 11, 2013 at 12:07 AM, William Dunlap <wdun...@tibco.com> wrote: > 'normalized' is key. A normalized double precision floating point > number has 52 binary digits of precision and .Machine$double.eps/2 > does not. E.g., > > > bitsOfPrecision <- function(x)max(which( x != x*(1+2^-(1:60))))
what a nice function :-) > > bitsOfPrecision(4) > [1] 52 > > bitsOfPrecision(.Machine$double.xmin) > [1] 52 > > bitsOfPrecision(.Machine$double.xmin/2) > [1] 51 > > bitsOfPrecision(.Machine$double.xmin/4) > [1] 50 > > Google for 'normalized floating point'. Okay, thanks a lot. Do you know whether one can find out the smallest positive number on the current machine? Or, actually, I was wondering what the smallest number x is, such that exp(-x) = 0 in machine arithmetic. On my machine, x=745 leads to exp(-x) being not quite 0, but x=746 leads to exp(-x)==0 being TRUE. But these are integer x's... Many thanks and cheers, Marius > > Bill Dunlap > Spotfire, TIBCO Software > wdunlap tibco.com > > >> -----Original Message----- >> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On >> Behalf >> Of Marius Hofert >> Sent: Tuesday, September 10, 2013 2:50 PM >> To: R-help >> Subject: [R] double.xmin really the smallest non-zero normalized >> floating-point number? >> >> Hi, >> >> ?.Machine says that 'double.xmin' is 'the smallest non-zero normalized >> floating-point number'. On my machine, this is 2.225074e-308. However, >> 2.225074e-308 / 2 is > 0 and smaller than 2.225074e-308, so >> double.xmin is not the smallest such number (?) Am I missing anything? >> >> Cheers, >> >> Marius >> >> ______________________________________________ >> 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. ______________________________________________ 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.