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