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

  1. Newsgroups: comp.compilers
  2. Path: sparky!uunet!world!iecc!compilers-sender
  3. From: bill@amber.csd.harris.com (Bill Leonard)
  4. Subject: Re: IEEE arithmetic handling
  5. Reply-To: bill@amber.csd.harris.com (Bill Leonard)
  6. Organization: Harris CSD, Ft. Lauderdale, FL
  7. Date: Fri, 20 Nov 1992 16:09:35 GMT
  8. Approved: compilers@iecc.cambridge.ma.us
  9. Message-ID: <92-11-121@comp.compilers>
  10. Keywords: arithmetic
  11. References: <92-11-041@comp.compilers> <92-11-095@comp.compilers>
  12. Sender: compilers-sender@iecc.cambridge.ma.us
  13. Lines: 31
  14.  
  15. > jlg@cochiti.lanl.gov (J. Giles) writes:
  16. > This is easily accomplished.  Let `b' be the base of your floating point
  17. > representation and let `p' be the number of digits in your significand.
  18. > Then, output followed by input is the identity if:
  19. >         (m-1)     p
  20. >       10      >= b  - 1
  21. > Where `m' is the number of decimal digits output.
  22.  
  23. This doesn't seem to work.  Take an example: let b=2, p=4.  Thus
  24.  p
  25. b  - 1 = 15, so m=3.  Now consider the binary number 1.001, which has
  26. 4 binary digits (as dicated by p=4).  This number, in decimal, is exactly
  27. 1.125, which requires 4 decimal digits, thus exceeding the number m.
  28.  
  29. I don't believe any formula like the above can work if b contains a factor
  30. that is not also a factor of 10 -- for instance, a b of 3 would never
  31. work, since there are fractions in base 3 that are non-terminating
  32. decimals.  (Of course, a computer using base 3 would be pretty strange.
  33. :-)
  34.  
  35. -- 
  36. Bill Leonard
  37. Harris Computer Systems Division
  38. 2101 W. Cypress Creek Road
  39. Fort Lauderdale, FL  33309
  40. bill@ssd.csd.harris.com
  41. -- 
  42. Send compilers articles to compilers@iecc.cambridge.ma.us or
  43. {ima | spdcc | world}!iecc!compilers.  Meta-mail to compilers-request.
  44.