home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / coherent / 6384 < prev    next >
Encoding:
Text File  |  1992-12-22  |  1.5 KB  |  34 lines

  1. Newsgroups: comp.os.coherent
  2. Path: sparky!uunet!utcsri!torn!mcshub!csx.cciw.ca!hcp
  3. From: hcp@csx.cciw.ca (H.C. Pulley)
  4. Subject: Re: Floating point: printf "%g" bug?
  5. Organization: Canada Centre for Inland Waters
  6. Date: Wed, 23 Dec 1992 00:39:39 GMT
  7. Message-ID: <1992Dec23.003939.1153@csx.cciw.ca>
  8. References: <1992Dec21.123913.2881@philips.oz.au> <1992Dec22.130028.27444@csx.cciw.ca> <1992Dec22.191630.20591@netlabs.com>
  9. Lines: 23
  10.  
  11. In article <1992Dec22.191630.20591@netlabs.com> lwall@netlabs.com (Larry Wall) writes:
  12. >In article <1992Dec22.130028.27444@csx.cciw.ca> hcp@csx.cciw.ca (H.C. Pulley) writes:
  13. >: I am sure you know, but just like there is 1/3 = .3333333..... in decimal, 
  14. >: there are non-repeating numbers in binary, octal and hex too.  Numbers which 
  15. >: repeat in one system, may not repeat in another.
  16. >
  17. >Certainly, but the integers that were used should be represented exactly
  18. >in almost anybody's floating-point format.  Either %g is busted, or
  19. >the cast from integer to double is busted.
  20. >
  21. >Larry Wall
  22.  
  23. You are absolutely correct, Larry.  This is a %g bug after all, *blush*.
  24.  
  25. The double 46.00000000000000 is also printed out as 46.00000000000001 by 
  26. printf %g.  Thus it is NOT a cast bug, I think.
  27.  
  28. Harry
  29. -- 
  30.          hcp@csx.cciw.ca          |This message released|It takes all kinds,
  31.    hcpiv@grumpy.cis.uoguelph.ca   |to the PUBLIC DOMAIN.|and to each his own.
  32. ----------------------------------+---------------------|This thought in mind,
  33. Stay away from the DOS side, Luke!|Un*x don't play that.|I walk alone.
  34.