Help needed to round-off a number
Chris Torek
chris at mimsy.UUCP
Sat May 20 15:46:56 AEST 1989
In article <2666 at oregon.uoregon.edu> michelbi at oregon.uoregon.edu
(Michel Biedermann) writes:
>Is there a C function (user defined or primitive (?)) that will let me
>truncate or round-off a number UP TO a certain decimal place. For example
>transforming .567 into .6 or -1.502 into -1.5.
In the proposed ANSI C standard, printf is defined as rounding when
given a floating point format with a particular precision. Both of
these results will be obtained with a `%.1f' printf format (assuming
a Unix or pANS-conformant printf).
--
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.lang.c
mailing list