%g format in printf

Chris Torek chris at mimsy.UUCP
Wed Sep 6 23:43:21 AEST 1989


In article <1439 at hiatus.dec.com> daniels at grue.dec.com (Bradford R. Daniels)
writes:
>Also, the definition of significant digits I learned in my high
>school science classes says that if I am asked to print out 1024
>with 1 significant digit, I should get 1000 printed out.  Is that
>correct?

No: `1000' has four significant digits (as does `1.000'); you need `1e3'.
I have seen arguments on both sides of this, but only believe the one
that says `the number of digits written is the number of significant
digits'.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.std.c mailing list