| .Machine | R Documentation |
.Machine is a variable holding information on the numericalcharacteristics of the machineR is running on, such as the largestdouble or integer and the machine's precision.
.Machine
The algorithm is based on Cody's (1988) subroutine MACHAR. As allcurrent implementations ofR use 32-bit integers and use IEC 60559floating-point (double precision) arithmetic, the"integer" and"double" related values are the same for almost allR builds.
Note that on most platforms smaller positive values than.Machine$double.xmin can occur. On a typicalR platform thesmallest positive double is about5e-324.
A list with components
double.eps | the smallest positive floating-point number |
double.neg.eps | a small positive floating-point number |
double.xmin | the smallest non-zero normalizedfloating-point number, a power of the radix, i.e., |
double.xmax | the largest normalized floating-point number.Typically, it is equal to |
double.base | the radix for the floating-point representation:normally |
double.digits | the number of base digits in the floating-pointsignificand: normally |
double.rounding | the rounding action, one of |
double.guard | the number of guard digits for multiplicationwith truncating arithmetic. It is 1 if floating-point arithmetictruncates 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.Always2^31 - 1 = 2147483647. |
sizeof.long | the number of bytes in a C |
sizeof.longlong | the number of bytes in a C |
sizeof.longdouble | the number of bytes in a C |
sizeof.pointer | the number of bytes in a C |
longdouble.eps, longdouble.neg.eps, longdouble.digits, ... | introduced inR 4.0.0. When |
In the (typical) case wherecapabilities("long.double") istrue,R uses thelong double C type in quite a few places internallyfor accumulators in e.g.sum, reading non-integernumeric constants into (binary) double precision numbers, or arithmeticsuch asx %% y; also,long double can be read byreadBin.
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, computedentirely analogously to theirdouble.* counterparts, see there.
sizeof.longdouble only tells you the amount of storageallocated for a long double. Often what is stored is the 80-bit extendeddouble type of IEC 60559, padded to the double alignment used on theplatform — this seems to be the case for the commonR platformsusing ix86 and x86_64 chips. There are other implementation of longdouble, usually in software for example on Sparc Solaris and AIX.
Note that it is legal for a platform to have along double Ctype which is identical to thedouble type — this happens onARM cpus. In that casecapabilities("long.double") willbe false but on versions ofR prior to 4.0.4,.Machine may contain"longdouble.<kind>" elements.
Uses a C translation of Fortran code in the reference, modified by theR Core Team to defeat over-optimization in modern compilers.
Cody, W. J. (1988).MACHAR: A subroutine to dynamically determine machine parameters.Transactions on Mathematical Software,14(4), 303–311.\Sexpr[results=rd,stage=build]{tools:::Rd_expr_doi("10.1145/50063.51907")}.
.Platform for details of the platform.
.Machine## or for a neat printoutnoquote(unlist(format(.Machine)))
Add the following code to your website.
For more information on customizing the embed code, readEmbedding Snippets.