Re: [R] NAs produced by integer overflow, but only some time ...

2018-05-09 Thread Jeff Newmiller
When you have cooled down you may notice that the answer to your question was in items a-d, though Bill's use of str made it clearer. Also, there was in fact no call to yules.k1, much less one that includes sample data. You will find that the solution to problems in R are very often related to t

Re: [R] NAs produced by integer overflow, but only some time ...

2018-05-09 Thread Stefan Th. Gries
> You are right that various arithmetic operators map a pair of integer > arguments to various type: the power and division operators map them to > double precision while the the addition, multiplication, and subtraction > operators map them to integer results (giving NA's if the result cannot f

Re: [R] NAs produced by integer overflow, but only some time ...

2018-05-09 Thread William Dunlap via R-help
Printing a number does not show whether it is stored as a 32-bit integer or as a 64-bit floating point value. Use. e.g., str() or class() to see. > str(length(runif(3))) int 3 > str(length(runif(3)) + 1) num 4 > str(length(runif(3)) + 1L) int 4 > str( 3L * 3L ) int 9 > str( 3

Re: [R] NAs produced by integer overflow, but only some time ...

2018-05-09 Thread Stefan Th. Gries
Before responding to Jeff's posting, let me reiterate my question: Why does a function using m1*m1 produce an integer overflow, but m1^2 does not? As for Jeff's 'response': > a) Numeric values may be either integers (signed 32 bit) or double precision > (53 bit mantissa). > b) Double precision c

Re: [R] NAs produced by integer overflow, but only some time ...

2018-05-09 Thread Jeff Newmiller
a) Numeric values may be either integers (signed 32 bit) or double precision (53 bit mantissa). b) Double precision constants are numeric with no decoration (e.g. 61224). Integer constants have an L (e.g. 61224L). c) 61224*61224 > 2^31-1 so that answer cannot fit into an integer. d) Exponentia