method of getting around the rounding of floating and double precision numbers using printf().

Morris jec at ihlpe.ATT.COM
Thu Jul 13 02:01:08 AEST 1989


The subject of the inaccuracies caused by rounding has probably been brought 
up many times in this news group and I apoligize if it has. I need to know
of any routines that are currently being used to get around C's rounding of
foating point and double precision numbers when using the printf() routine from
the stdio.h header file. I have talked to many comrades but none of them can 
remember how the routine went. I have tried all the usual stuff with the 
printf() statement [the %*.*f,7,2,variable_name  or %4.2f  or %.2  etc.,etc.]
but none of these techniques were able to get around the rounding when printing
these variables. The variables have been declared to be of type float and of 
type double but to no avail. I would appreciate any responses either by replying
directly to this posting or to my email address ...att!ihcae!jec. Thanx in
advance.



More information about the Comp.lang.c mailing list