From: Andrew Gibson Newsgroups: comp.os.msdos.djgpp Subject: printf 'g' conversion Date: Fri, 27 Feb 1998 15:17:05 +0000 Message-ID: <34F6D8EE.BF28CC5B@petrologic.co.uk> NNTP-Posting-Host: petrologic.demon.co.uk MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; x-mac-type="54455854"; x-mac-creator="4D4F5353" Content-Transfer-Encoding: 8bit Lines: 31 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk I was comparing the output from a program compiled with DJGPP and the output from the same program compiled with gcc in Linux. The output was generated from calls to printf with ‘g’ as the conversion character. I found that for values with absolute value less than 0.1 the outputs differed. For example the call: printf(“%9.9g”,0.0123456789); displays 0.012345679 using DJGPP but 0.0123456789 using Linux. The definition for the ‘g’ conversion character says the ‘.n’ modifier means that at most n significant figures are printed. I think this means in the example above the .9 means I’m asking for 9 significant figures. From Linux this is what I get. From DJGPP I get 9 decimal places and only 8 sig figs. I have modified my DJGPP library source to make it work the same as Linux in this case. Does anyone have any comments? Andrew Gibson