%g format in printf

Norman Diamond diamond at csl.sony.co.jp
Wed Sep 13 20:06:06 AEST 1989


In article <1989Sep9.013233.9939 at sq.sq.com> msb at sq.com (Mark Brader) writes:

>As for a value of 1024, of course "%.1g" of that should produce "1e3",
>or rather, "1e+03".

Why does the exponent "rather" have a leading zero?  If the standard
mandates (or even allows) this, it is the only place where it specifies
a leading zero in a place where the programmer did not request it.

(And if so, why not pad it with more leading zeroes, so that a machine
that can handle exponents up to 75024 can say 1e+00003.)

--
-- 
Norman Diamond, Sony Corporation (diamond at ws.sony.junet)
  The above opinions are inherited by your machine's init process (pid 1),
  after being disowned and orphaned.  However, if you see this at Waterloo or
  Anterior, then their administrators must have approved of these opinions.



More information about the Comp.std.c mailing list