vc bug -- %g format

mann at Shasta.ARPA mann at Shasta.ARPA
Tue Aug 27 16:45:37 AEST 1985


I just ran into a bug in the spreadsheet calculator ("vc") that was posted
to net.sources a while back.  It uses a %g format to print out numbers in
several places, in particular when save files are generated.  This means
that numbers with more than 6 digits of precision get rounded off when you
save and reload your spreadsheet, when you use the "e" command, etc.  The
fix is to replace each occurrence of "%g" in a printf with "%.20g",
throughout the program.

I can hardly blame the original author of vc for this bug -- the
documentation of %g in the printf man page (at least on 4.2BSD) is very
misleading.

	--Tim



More information about the Comp.sources.bugs mailing list