Path: utzoo!attcan!uunet!wuarchive!psuvax1!rutgers!cmcl2!phri!alanine.phri.nyu.edu!roy From: roy@alanine.phri.nyu.edu (Roy Smith) Newsgroups: comp.lang.c Subject: Looking for "round towards 0" function. Message-ID: <1989Dec17.160821.13219@phri.nyu.edu> Date: 17 Dec 89 16:08:21 GMT Sender: news@phri.nyu.edu (News System) Organization: Public Health Research Institute, NYC Lines: 14 I want to round a (possibly negative) double towards zero (ending up with another double). As far as I can tell, what I need to do is x2 = copysign (floor (fabs (x1))), x1); but it seems like there should be a simplier way. Is there? If it helps, I can guarantee that the integral part of the double will fit into an int with no loss of precision (i.e. -90 <= x <= 90). -- Roy Smith, Public Health Research Institute 455 First Avenue, New York, NY 10016 roy@alanine.phri.nyu.edu -OR- {att,philabs,cmcl2,rutgers,hombre}!phri!roy "My karma ran over my dogma"