home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / compiler / 1943 < prev    next >
Encoding:
Text File  |  1992-11-24  |  1.9 KB  |  51 lines

  1. Newsgroups: comp.compilers
  2. Path: sparky!uunet!world!iecc!compilers-sender
  3. From: Dik.Winter@cwi.nl (Dik T. Winter)
  4. Subject: Re: IEEE arithmetic handling
  5. Reply-To: Dik.Winter@cwi.nl (Dik T. Winter)
  6. Organization: CWI, Amsterdam
  7. Date: Mon, 23 Nov 1992 20:32:17 GMT
  8. Approved: compilers@iecc.cambridge.ma.us
  9. Message-ID: <92-11-135@comp.compilers>
  10. References: <92-11-041@comp.compilers> <92-11-121@comp.compilers>
  11. Keywords: arithmetic
  12. Sender: compilers-sender@iecc.cambridge.ma.us
  13. Lines: 36
  14.  
  15.  
  16. jlg@cochiti.lanl.gov (J. Giles) writes:
  17.  > This is easily accomplished.  Let `b' be the base of your floating point
  18.  > representation and let `p' be the number of digits in your significand.
  19.  > Then, output followed by input is the identity if:
  20.  > 
  21.  >         (m-1)     p
  22.  >       10      >= b  - 1
  23.  > 
  24.  > Where `m' is the number of decimal digits output.
  25.  
  26. bill@amber.csd.harris.com (Bill Leonard) writes:
  27.  > This doesn't seem to work.  Take an example: let b=2, p=4.  Thus
  28.  >  p
  29.  > b  - 1 = 15, so m=3.  Now consider the binary number 1.001, which has
  30.  > 4 binary digits (as dicated by p=4).  This number, in decimal, is exactly
  31.  > 1.125, which requires 4 decimal digits, thus exceeding the number m.
  32.  
  33. No problem, you output 1.12 or 1.13 whatever you fancy.  Now when you read
  34. that back in you get your original back.  Unless your read routines are
  35. wrong of course and read 1.12 or 1.13 back in as 1.25 or 1.00.  That is
  36. the major part, not that output is exact but that output followed by input
  37. is exact.
  38.  
  39.  >            (Of course, a computer using base 3 would be pretty strange.
  40.  > :-)
  41.  
  42. On occasion on alt.folklore.computers you will read about that Russian
  43. ternary beast.
  44. -- 
  45. dik t. winter, cwi, kruislaan 413, 1098 sj  amsterdam, nederland
  46. home: bovenover 215, 1025 jn  amsterdam, nederland; e-mail: dik@cwi.nl
  47.  
  48. -- 
  49. Send compilers articles to compilers@iecc.cambridge.ma.us or
  50. {ima | spdcc | world}!iecc!compilers.  Meta-mail to compilers-request.
  51.