11

Is there a function that returns the highest and lowest possible numeric values?

Gavin Simpson
  • 170,508
  • 25
  • 396
  • 453
Suraj
  • 35,905
  • 47
  • 139
  • 250

2 Answers2

23

help(numeric) sends you to help(double) which has

Double-precision values:

 All R platforms are required to work with values conforming tothe
 IEC 60559 (also known as IEEE 754) standard.  This basically works
 with a precision of 53 bits, and represents to that precision a
 range of absolute values from about 2e-308 to 2e+308.  It also has
 special values ‘NaN’ (many of them), plus and minus infinity and
 plus and minus zero (although R acts as if these are the same).
 There are also _denormal(ized)_ (or _subnormal_) numbers with
 absolute values above or below the range given above but
 represented to less precision.

 See ‘.Machine’ for precise information on these limits.  Note that
 ultimately how double precision numbers are handled is down to the
 CPU/FPU and compiler.

So you want to look at .Machine which on my 64-bit box has

$double.xmin
[1] 2.22507e-308

$double.xmax
[1] 1.79769e+308
Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • much appreciated! .Machine is new to me...good stuff to know! – Suraj Sep 21 '11 at 18:21
  • 1
    I would be pretty surprised if these values were different on any mainstream OS ... the bit-ness of the OS doesn't affect whether numerics are stored as double precision floats ... – Ben Bolker Sep 21 '11 at 20:17
-1
help("numeric")

will ask you to do

help("double)

which will give the answer: range of absolute values from about 2e-308 to 2e+308.