.Machine {base}  R Documentation 
Numerical Characteristics of the Machine
Description
.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.
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, the "integer"
and
"double"
related 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

double.neg.eps 
a small positive floatingpoint number 
double.xmin 
the smallest nonzero normalized
floatingpoint number, a power of the radix, i.e.,

double.xmax 
the largest normalized floatingpoint number.
Typically, it is equal to 
double.base 
the radix for the floatingpoint representation:
normally 
double.digits 
the number of base digits in the floatingpoint
significand: normally 
double.rounding 
the rounding action, one of 
double.guard 
the number of guard digits for multiplication
with truncating arithmetic. It is 1 if floatingpoint arithmetic
truncates and more than 
double.ulp.digits 
the largest negative integer 
double.neg.ulp.digits 
the largest negative integer 
double.exponent 
the number of bits (decimal places if 
double.min.exp 
the largest in magnitude negative integer 
double.max.exp 
the smallest positive power of 
integer.max 
the largest integer which can be represented.
Always 
sizeof.long 
the number of bytes in a C ‘long’ type:

sizeof.longlong 
the number of bytes in a C ‘long long’
type. Will be zero if there is no such type, otherwise usually

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 possibly

sizeof.pointer 
the number of bytes in the C 
sizeof.time_t 
the number of bytes in the C 
longdouble.eps , longdouble.neg.eps , longdouble.digits , ... 
introduced in R 4.0.0. When

Note
In the (typical) case where capabilities("long.double")
is
true, R uses the ‘long double’ C type in quite a few places internally
for accumulators in e.g. sum
, reading noninteger
numeric constants into (binary) double precision numbers, or arithmetic
such as x %% y
; also, ‘long double’ can be read by
readBin
.
For this reason, in that case, .Machine
contains ten further components,
longdouble.eps
, *.neg.eps
, *.digits
, *.rounding
*.guard
, *.ulp.digits
, *.neg.ulp.digits
,
*.exponent
, *.min.exp
, and *.max.exp
, computed
entirely analogously to their double.*
counterparts, see there.
sizeof.longdouble
only tells you the amount of storage
allocated for a long double. 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. There are other implementation of long
double, usually in software for example on Sparc Solaris and AIX.
Note that it is legal for a platform to have a ‘long double’ C
type which is identical to the ‘double’ type — this happens on
ARM CPUs. In that case capabilities("long.double")
will
be false but on versions of R prior to 4.0.4, .Machine
may contain
"longdouble.kind"
elements.
Source
Uses a C translation of Fortran code in the reference, modified by the R Core Team to defeat overoptimization in modern compilers.
References
Cody, W. J. (1988). MACHAR: A subroutine to dynamically determine machine parameters. Transactions on Mathematical Software, 14(4), 303–311. doi:10.1145/50063.51907.
See Also
.Platform
for details of the platform.
Examples
.Machine
## or for a neat printout
noquote(unlist(format(.Machine)))