From gregory_r_warnes@groton.pfizer.com  Thu Sep 13 21:45:37 2001
From: gregory_r_warnes@groton.pfizer.com (Warnes, Gregory R)
Date: Thu, 13 Sep 2001 16:45:37 -0400
Subject: FW: [Rd] sum overflow (PR#1091)
Message-ID: <5429125E11E4D411AF7300805FE603A8014CEDEE@groexmbcr02.pfizer.com>


> From: David Smith [mailto:dsmith@insightful.com]
>> From: Prof Brian Ripley
>>
>> If you use integers you need to be aware of the consequences.  It's a
>> feature not a bug.
>
> Perhaps, but maybe a more useful feature would be to signal to the user
when
> such an overflow occurs?  Sv4 does this by returning NA for overflow
integer
> results:
> 
> > a <- (1:1000)
> > b <- (1:1000)
> > sum(a * a) * sum(b * b)
> [1] NA
> 
> When this was introduced in S-PLUS 5, we discovered some overflow errors
we
> were previously unaware of in S-PLUS (by noticing NAs in the results).

This is a first step in the right direction.  I think that having overflows
generate of NA's should be augmented by a warning or an error message.
Thus we would get something like:

> a <- (1:1000)
> b <- (1:1000)
> sum(a * a) * sum(b * b)
Warning messages: 
Integer overflow produced NA's in: .Primitive("*") 
> [1] NA

Now, the problem will be clear to the user, and many users will immediately
see how to get around it.

-Greg


LEGAL NOTICE
Unless expressly stated otherwise, this message is confidential and may be privileged. It is intended for the addressee(s) only. Access to this E-mail by anyone else is unauthorized. If you are not an addressee, any disclosure or copying of the contents of this E-mail or any action taken (or not taken) in reliance on it is unauthorized and may be unlawful. If you are not an addressee, please inform the sender immediately.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


FW: [Rd] sum overflow (PR#1091)
Warnes, Gregory R