R largest / smallest representable numbers

I am trying to get the largest / smallest representable number in R.

After entering ".Machine"

I got:

$double.xmin
[1] 2.225074e-308

$double.xmax
[1] 1.797693e+308

However, even if I type 2.225074e-309 at the R command line, I get 2.225074e-309 instead of the expected 0

How to find the largest / smallest number for which adding or subtracting 1 will result in Inf (adding 1 to the largest number) or 0 (subtracting 1 from the smallest number)?

+4
source share
2 answers

.Machine$double.xmin , IEEE 754 . , , :

15 IEEE 754, , . IEEE 754 17 , , .

, , , (, ):

11- 10 -308 10 308 15-17 . , 5 × 10 -324.

R , "" ?.Machine:

, , '. .Machine $double.xmin. R - 5e-324.

, , R, , :

5e-324
# [1] 4.940656e-324
2e-324
# [1] 0
1.4 * 5e-324
# [1] 4.940656e-324
1.6 * 5e-324
# [1] 9.881313e-324
+7

SAS, IEEE 754 Big Endian?

data _null_;
    y=constant('big');
    put y hex16.;
    put y E21.3;
run;quit;

Biggest

7FEFFFFFFFFFFFFF 1.79769313486230E + 308

data _null_;
    y=constant('small');
    put y hex16.;
    put y E21.3;
run;quit;

0010000000000000 2.22507385850720E-308

, , SAS .

0

All Articles