[net.unix-wizards] Bug in 4.1BSD C library "printf"

chris@umcp-cs.UUCP (08/07/83)

There seems to be a bug in the floating point conversion routines
for printf.  Specifically, I've seen a "%1.0f" format generate
"10" several times.  I suspect this happens when 9.<something>
gets rounded up.

Has anyone else seen this bug?  Does anyone have a fix?  (Vax
assembly -- especially floating point -- is not my forte.)

				- Chris
-- 
In-Real-Life:	Chris Torek, Univ of MD Comp Sci
UUCP:		{seismo,allegra,brl-bmd}!umcp-cs!chris
CSNet:		chris@umcp-cs
ARPA:		chris.umcp-cs@UDel-Relay

gwyn@brl-vld@sri-unix.UUCP (08/08/83)

From:      Doug Gwyn (VLD/VMB) <gwyn@brl-vld>

I don't think that's a bug.  "%1.0f" means use a minimum field width
of 1 character with 0 characters after the decimal point and no
decimal point, but as many characters as required left of the decimal
point.  So 10.0 converted this way would give you "10", etc.

Printf's philosophy is to never truncate significant digits.