.Machine
Numerical Characteristics of the Machine
.Machine
is a variable holding information on the numerical
characteristics of the machine R is running on, such as the largest
double or integer and the machine's precision.
 Keywords
 programming, math, sysdata
Usage
.Machine
Details
The algorithm is based on Cody's (1988) subroutine MACHAR. As all current implementations of R use 32bit integers and use IEC 60559 floatingpoint (double precision) arithmetic, all but three of the last four values are the same for almost all R builds.
Note that on most platforms smaller positive values than
.Machine$double.xmin
can occur. On a typical R platform the
smallest positive double is about 5e324
.
Value

A list with components
 double.eps
 the smallest positive floatingpoint number
x
such that1 + x != 1
. It equalsdouble.base ^ ulp.digits
if eitherdouble.base
is 2 ordouble.rounding
is 0; otherwise, it is(double.base ^ double.ulp.digits) / 2
. Normally2.220446e16
.  double.neg.eps
 a small positive floatingpoint number
x
such that1  x != 1
. It equalsdouble.base ^ double.neg.ulp.digits
ifdouble.base
is 2 ordouble.rounding
is 0; otherwise, it is(double.base ^ double.neg.ulp.digits) / 2
. Normally1.110223e16
. Asdouble.neg.ulp.digits
is bounded below by(double.digits + 3)
,double.neg.eps
may not be the smallest number that can alter 1 by subtraction.  double.xmin
 the smallest nonzero normalized
floatingpoint number, a power of the radix, i.e.,
double.base ^ double.min.exp
. Normally2.225074e308
.  double.xmax
 the largest normalized floatingpoint number.
Typically, it is equal to
(1  double.neg.eps) * double.base ^ double.max.exp
, but on some machines it is only the second or third largest such number, being too small by 1 or 2 units in the last digit of the significand. Normally1.797693e+308
. Note that larger unnormalized numbers can occur.  double.base
 the radix for the floatingpoint representation:
normally
2
.  double.digits
 the number of base digits in the floatingpoint
significand: normally
53
.  double.rounding
 the rounding action, one of
0 if floatingpoint addition chops;
1 if floatingpoint addition rounds, but not in the IEEE style;
2 if floatingpoint addition rounds in the IEEE style;
3 if floatingpoint addition chops, and there is partial underflow;
4 if floatingpoint addition rounds, but not in the IEEE style, and
there is partial underflow;
5 if floatingpoint addition rounds in the IEEE style, and there is
partial underflow.
Normally
5
.  double.guard
 the number of guard digits for multiplication
with truncating arithmetic. It is 1 if floatingpoint arithmetic
truncates and more than
double digits
basedouble.base
digits participate in the postnormalization shift of the floatingpoint significand in multiplication, and 0 otherwise. Normally0
.  double.ulp.digits
 the largest negative integer
i
such that1 + double.base ^ i != 1
, except that it is bounded below by(double.digits + 3)
. Normally52
.  double.neg.ulp.digits
 the largest negative integer
i
such that1  double.base ^ i != 1
, except that it is bounded below by(double.digits + 3)
. Normally53
.  double.exponent

the number of bits (decimal places if
double.base
is 10) reserved for the representation of the exponent (including the bias or sign) of a floatingpoint number. Normally11
.  double.min.exp

the largest in magnitude negative integer
i
such thatdouble.base ^ i
is positive and normalized. Normally1022
.  double.max.exp

the smallest positive power of
double.base
that overflows. Normally1024
.  integer.max
 the largest integer which can be represented. Always $2^31  1 = 2147483647$.
 sizeof.long
 the number of bytes in a C
long
type:4
or8
(most 64bit systems, but not Windows).  sizeof.longlong
 the number of bytes in a C
long long
type. Will be zero if there is no such type, otherwise usually8
.  sizeof.longdouble
 the number of bytes in a C
long double
type. Will be zero if there is no such type (or its use was disabled when R was built), otherwise possibly12
(most 32bit builds) or16
(most 64bit builds).  sizeof.pointer
 the number of bytes in a C
SEXP
type. Will be4
on 32bit builds and8
on 64bit builds of R.
Note
sizeof.longdouble
only tells you the amount of storage
allocated for a long double (which are normally used internally by R for
accumulators in e.g.\ifelse{latex}{\out{~}}{ } sum
, and can be read by
readBin
). Often what is stored is the 80bit extended
double type of IEC 60559, padded to the double alignment used on the
platform  this seems to be the case for the common R platforms
using ix86 and x86_64 chips.
Source
Uses a C translation of Fortran code in the reference, modified by the R Core Team to defeat overoptimization in recent compilers.
References
Cody, W. J. (1988) MACHAR: A subroutine to dynamically determine machine parameters. Transactions on Mathematical Software, 14, 4, 303311.
See Also
.Platform
for details of the platform.
Examples
library(base)
.Machine
## or for a neat printout
noquote(unlist(format(.Machine)))