Return to BSD News archive
Newsgroups: comp.unix.bsd Path: sserve!manuel!munnari.oz.au!uunet!usc!cs.utexas.edu!torn!watserv2.uwaterloo.ca!watdragon.uwaterloo.ca!kcwellsc From: kcwellsc@watdragon.uwaterloo.ca (Ken Wellsch) Subject: [386bsd] double->int rounds (__fixdfsi) Message-ID: <BuwoL8.CBs@watdragon.uwaterloo.ca> Sender: kcwellsc@watdragon.uwaterloo.ca (Ken Wellsch) Organization: University of Waterloo Date: Mon, 21 Sep 1992 02:07:55 GMT Lines: 8 While puzzling over the odd behaviour of a large FORTRAN program I am playing with (using f2c), I found that fixdfsi rounds doubles when converting to ints. My past experience always had this conversion truncate (thus lots of code I've seen has + 0.5 to round). I don't know whether K&R2 "specifies" the conversion action (my old K&R claims conversion from float->int truncates but also later mentions something about this being machine dependent). I ended up borrowing a native compiler on a 386 based Sequent to compile a copy of fixdfsi to obtain the "truncate" behaviour and avoid removing the smattering of +0.5's.