Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ukma!xanth!kremer From: kremer@cs.odu.edu (Lloyd Kremer) Newsgroups: comp.lang.c Subject: Re: Help rounding-off numbers (not using printf) Summary: Try this. Message-ID: <8945@xanth.cs.odu.edu> Date: 22 May 89 14:31:37 GMT References: <2730@oregon.uoregon.edu> Organization: Old Dominion University, Norfolk, Va. Lines: 23 In article <2730@oregon.uoregon.edu> michelbi@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. I believe the function "ceil" is the most mathematically rigorous choice. It rounds up (toward positive infinity) to the nearest integer equal to or greater than the given number. extern double ceil(double); /* Round up to one decimal precision */ double num, result; result = ceil(10.0 * num) / 10.0; -- Lloyd Kremer Brooks Financial Systems ...!uunet!xanth!brooks!lloyd Have terminal...will hack!