Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!phavl!rob From: rob@phavl.UUCP (Robert Ransbottom) Newsgroups: comp.lang.c Subject: Re: Help rounding-off numbers (not using printf) Summary: strtod(3c) & sprintf(3s) Message-ID: <239@phavl.UUCP> Date: 21 May 89 04:22:00 GMT References: <2730@oregon.uoregon.edu> Organization: General Supply & Metals, Inc., New Bedford, MA Lines: 20 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. For example Seems unlikely, consider the vagaries of this with binary representation and decimal conceptualization. Printf() was a good suggestion. Look at sprintf to print to a string, and strtod to convert it back. WARNING: This should do the trick, but again the result is not as straight-forward as you _might_ think. Hope this helps. rob kill( blair, SIGKILL) -- ...!uunet!phavl!rob Robert Ransbottom