home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!utcsri!torn!nott!dgbt!netfs!ub!zaphod.mps.ohio-state.edu!darwin.sura.net!paladin.american.edu!auvm!UVVM.BITNET!KLASSEN
- From: KLASSEN@UVVM.BITNET (Melvin Klassen)
- Newsgroups: bit.listserv.sas-l
- Subject: Re: proc FORMAT: oops on numeric values
- Message-ID: <SAS-L%92111212311833@VM.UCS.UALBERTA.CA>
- Date: 12 Nov 92 19:11:11 GMT
- Sender: "SAS(r) Discussion" <SAS-L@UGA.BITNET>
- Reply-To: Melvin Klassen <KLASSEN@UVVM.BITNET>
- Lines: 21
- Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
-
- On Thu, 12 Nov 1992 13:07:00 EST, Ron Fehd <rjf2@PHPDLS1.EM.CDC.GOV> wrote:
- >
- > I need some help understanding what is happening with the FORMAT
- > that I am using to show percents from proc FREQ.
- > ...
- > do SAS_N = 98.999 to 99.001 by 0.001,
- > 99.999 to 100.001 by 0.001 ;
- > SAS_Frmt = SAS_N;
-
- Once again, the hidden dangers of using finite-precision base-two arithmetic
- on a digital computer! Since the value '0.0001' can **not** be stored without
- "round-off", your numeric results differ from the predicted, algebraic, results.
- (If you ask the computer to compute the sum of 1000 occurrences of '0.001',
- the computer will **not** report a value of '1.0'. Try it!)
-
- I got the results you expect when I tried:
-
- do N_SAS = 98999. to 99001. by 0001. ,
- 99999. to 100001. by 0001. ;
- SAS_N = N_SAS / 1000.0; /* Localize the round-off error. */
- SAS_Frmt = SAS_N;
-