[comp.lang.c] Looking for "round towards 0" function.

roy@alanine.phri.nyu.edu (Roy Smith) (12/18/89)

	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"