Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!srhqla!demott!kdq From: kdq@demott.com (Kevin D. Quitt) Newsgroups: comp.lang.c Subject: Re: A define problem Keywords: define Message-ID: <1991Jan9.194303.20991@demott.com> Date: 9 Jan 91 19:43:03 GMT References: <440@bally.Bally.COM> <1991Jan8.012923.3390@oswego.Oswego.EDU> <4613@sactoh0.SAC.CA.US> Distribution: usa Organization: DeMott Electronics Co., Van Nuys CA Lines: 25 In article <4613@sactoh0.SAC.CA.US> jak@sactoh0.SAC.CA.US (Jay A. Konigsberg) writes: > >Look at what is being passed to "half()". > >i=5 >half(i-5) or half(5-5) or half(0) > >which becomes: (0)/2 - which is 0. > >It looks like it should be: > >printf( "i/2 = %d\n",half(i)); > >which produces 2, not 3 anyway. If you want to round up, you should >define the variables as a float, add .5 and cast to (int). or half(i+1) -- _ Kevin D. Quitt demott!kdq kdq@demott.com DeMott Electronics Co. 14707 Keswick St. Van Nuys, CA 91405-1266 VOICE (818) 988-4975 FAX (818) 997-1190 MODEM (818) 997-4496 PEP last