| Date: | Thu, 4 Nov 2004 10:22:34 -0500 |
| Reply-To: | Venky Chakravarthy <venky.chakravarthy@PFIZER.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Venky Chakravarthy <venky.chakravarthy@PFIZER.COM> |
| Subject: | Re: Expecting 0 after calculation... |
|---|
On Windows NT, 8.2 I could replicate the results found by John.
This is a typical case of the floating point representation error. To see
it more clearly, consider:
177 data _null_ ;
178 x = 2.775558E-17 ;
179 put x = : 32. ;
180 run ;
x=0
Venky
On Tue, 2 Nov 2004 10:03:24 -0600, Dunn, Toby <Toby.Dunn@TEA.STATE.TX.US>
wrote:
>John,
>
>It seems to be working for me, no sure whats going on with yoru system.
>
>Windows xp sas v9.1.2
>
>Toby Dunn
>
>-----Original Message-----
>From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
>Bonett, John
>Sent: Tuesday, November 02, 2004 9:41 AM
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: Expecting 0 after calculation...
>
>
>Hello all,
>
>Can anyone tell me why the following code does not result in theta_min=0
>when theta_midpt=.1 or theta_max=0 when theta_midpt=-.1? I'm guessing
>it is in the way var i is incremented in the do loop?
>Note: if I increment from -.1 to .1 by .2 I get the results I expect.
>
>
>%LET intv=.2;
>%macro test;
>Data test;
>do i=-.3 to .3 by .2;
>theta_midpt=i; theta_min=i-(&intv./2); theta_max=i+(&intv./2); drop i;
>output; end; Run; %mend test; %test;
>
>Thanks in advance!
>John
>
>
>
>************************************************************************
>**
>This e-mail and any files transmitted with it may contain privileged or
>confidential information. It is solely for use by the individual for
>whom it is intended, even if addressed incorrectly. If you received this
>e-mail in error, please notify the sender; do not disclose, copy,
>distribute, or take any action in reliance on the contents of this
>information; and delete it from your system. Any other use of this
>e-mail is prohibited. Thank you for your compliance.
|