RE: [R] Integer precision etc.

2003-08-14 Thread Ted Harding
Thanks to James Holtman for the confirmation of the IEEE definition,
and to Marc Schwartz and Roger Koenker for pointing out .Machine
which I had not been aware of!

For the latter, the information I wanted is in

 .Machine$double.digits
[1] 53

so that the largest integer exactly represented is indeed 2^53 -1.

Best wishes to all,
Ted.



E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 167 1972
Date: 13-Aug-03   Time: 14:48:48
-- XFMail --

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] Integer precision etc.

2003-08-14 Thread Simon Fear
1e100 is just one example of much bigger number that is exactly
represented
(in floating point). But of course
 1e100+1 - 1e100
[1] 0

You mean the biggest number such that adding one changes the result?

I should be extremely careful with

 print( 9007199254740994, digits=20)
[1] 9007199254740994
 print( 9007199254740994-1, digits=20)
[1] 9007199254740992

Here subtracting one makes a difference of two ... but the numbers look
like
integers.
 

Simon Fear
Senior Statistician
Syne qua non Ltd
Tel: +44 (0) 1379 69
Fax: +44 (0) 1379 65
email: [EMAIL PROTECTED]
web: http://www.synequanon.com
 
Number of attachments included with this message: 0
 
This message (and any associated files) is confidential and\...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Integer precision etc.

2003-08-14 Thread Douglas Bates
(Ted Harding) [EMAIL PROTECTED] writes:

 With a bit of experimentation I have determined (I think)
 that on my R implementation the largest positive integer
 that is exactly represented is (2^53 - 1), based on
 
  (((2^53)-1)+1) - ((2^53)-1)
 [1] 1
  ((2^53)+1) - (2^53)
 [1] 0

Those integer values are being silently converted to double
precision so what you are determining is the relative machine
precision for doubles.  Use .Machine$integer.max instead.  On your
platform it will probably be 2^31-1

 .Machine$integer.max
[1] 2147483647
 log(.Machine$integer.max, 2)
[1] 31
 2^31-1
[1] 2147483647
 log(.Machine$double.eps, 2)
[1] -52
 log(.Machine$double.neg.eps, 2)
[1] -53

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Integer precision etc.

2003-08-14 Thread Marc Schwartz
On Wed, 2003-08-13 at 07:55, [EMAIL PROTECTED] wrote:
 Hi Folks,
 With a bit of experimentation I have determined (I think)
 that on my R implementation the largest positive integer
 that is exactly represented is (2^53 - 1), based on
 
  (((2^53)-1)+1) - ((2^53)-1)
 [1] 1
  ((2^53)+1) - (2^53)
 [1] 0
 
 System:
 platform i686-pc-linux-gnu
 arch i686
 os   linux-gnu
 system   i686, linux-gnu
 status
 major1
 minor6.1
 year 2002
 month11
 day  01
 language R
 
 Is there any other way to determine this sort of information?
 
 With thanks,
 Ted.


Ted,

See ?.Machine

No experimentation required  :-)

HTH,

Marc Schwartz

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help