Movatterモバイル変換


[0]ホーム

URL:


rdrr.io

zMachine: Numerical Characteristics of the Machine

.MachineR Documentation

Numerical Characteristics of the Machine

Description

.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.

Usage

.Machine

Details

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.

Value

A list with components

double.eps

the smallest positive floating-point numberx 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.220446e-16.

double.neg.eps

a small positive floating-point numberxsuch that1 - x != 1. It equalsdouble.base ^ double.neg.ulp.digits ifdouble.base is 2ordouble.rounding is 0; otherwise, it is(double.base ^ double.neg.ulp.digits) / 2. Normally1.110223e-16. Asdouble.neg.ulp.digits is boundedbelow by-(double.digits + 3),double.neg.eps may notbe the smallest number that can alter 1 by subtraction.

double.xmin

the smallest non-zero normalizedfloating-point number, a power of the radix, i.e.,double.base ^ double.min.exp. Normally2.225074e-308.

double.xmax

the largest normalized floating-point number.Typically, it is equal to(1 - double.neg.eps) * double.base ^ double.max.exp, buton some machines it is only the second or third largest suchnumber, being too small by 1 or 2 units in the last digit of thesignificand. Normally1.797693e+308. Note that largerunnormalized numbers can occur.

double.base

the radix for the floating-point representation:normally2.

double.digits

the number of base digits in the floating-pointsignificand: normally53.

double.rounding

the rounding action, one of
0 if floating-point addition chops;
1 if floating-point addition rounds, but not in the IEEE style;
2 if floating-point addition rounds in the IEEE style;
3 if floating-point addition chops, and there is partial underflow;
4 if floating-point addition rounds, but not in the IEEE style, andthere is partial underflow;
5 if floating-point addition rounds in the IEEE style, and there ispartial underflow.
Normally5.

double.guard

the number of guard digits for multiplicationwith truncating arithmetic. It is 1 if floating-point arithmetictruncates and more thandouble digits base-double.base digitsparticipate in the post-normalization shift of the floating-pointsignificand in multiplication, and 0 otherwise.
Normally0.

double.ulp.digits

the largest negative integeri suchthat1 + double.base ^ i != 1, except that it is bounded below by-(double.digits + 3). Normally-52.

double.neg.ulp.digits

the largest negative integerisuch that1 - double.base ^ i != 1, except that it is boundedbelow by-(double.digits + 3). Normally-53.

double.exponent

the number of bits (decimal places ifdouble.base is 10) reservedfor the representation of the exponent (including the bias or sign)of a floating-point number. Normally11.

double.min.exp

the largest in magnitude negative integeri such thatdouble.base ^ i is positive and normalized. Normally-1022.

double.max.exp

the smallest positive power ofdouble.base that overflows. Normally1024.

integer.max

the largest integer which can be represented.Always2^31 - 1 = 2147483647.

sizeof.long

the number of bytes in a Clong type:4 or8 (most 64-bit systems, but not Windows).

sizeof.longlong

the number of bytes in a Clong longtype. Will be zero if there is no such type, otherwise usually8.

sizeof.longdouble

the number of bytes in a Clong doubletype. Will be zero if there is no such type (or its use wasdisabled whenR was built), otherwise possibly12 (most 32-bit builds),16 (most 64-bit builds) or 8(CPUs such as ARM where for most compilerslong double isidentical todouble).

sizeof.pointer

the number of bytes in a CSEXPtype. Will be4 on 32-bit builds and8 on 64-bitbuilds ofR.

longdouble.eps, longdouble.neg.eps, longdouble.digits, ...

introduced inR 4.0.0. Whencapabilities("long.double") is true, there are 10 such"longdouble.<kind>" values, specifying thelong doubleproperty corresponding to its"double.*" counterpart. Seealso ‘Note’.

Note

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.

Source

Uses a C translation of Fortran code in the reference, modified by theR Core Team to defeat over-optimization in modern compilers.

References

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")}.

See Also

.Platform for details of the platform.

Examples

.Machine## or for a neat printoutnoquote(unlist(format(.Machine)))

What can we improve?

R Package Documentation

Browse R Packages

We want your feedback!

Note that we can't provide technical support on individual packages. You should contact the package authors for that.

 
Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, readEmbedding Snippets.

Close

[8]ページ先頭

©2009-2026 Movatter.jp