Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!haven!umd5!ai04 From: ai04@umd5.umd.edu (CMSC 620) Newsgroups: comp.lang.c Subject: Re: sqroot of a 2**n number ? Summary: oops. Message-ID: <4893@umd5.umd.edu> Date: 14 May 89 19:47:45 GMT References: <1906@yunexus.UUCP> <4890@umd5.umd.edu> <1928@yunexus.UUCP> Reply-To: setzer@wam.umd.edu Organization: University of Maryland, College Park Lines: 20 In article <1928@yunexus.UUCP> oz@yunexus.UUCP (Ozan Yigit) writes: >In article <4890@umd5.umd.edu> setzer@wam.umd.edu writes: > >>int sqrt_of_2_to_the_n(n) >>int n; >>{ >> return (1 << (n / 2)); /* integer division */ >>} > >Say what ?? (1 << (16 / 2) == 256 !!! I always thought sqrt(16) == 4. Apparently my cancel didn't get through. After posting my message, I realized that your argument was 2**n instead of n. The argument of my programs is the exponent. BTW, if you send the value 'i' from your patch of code to my program, everything works fine. My apologies for the mixup. I'm going to find my article and try to kill it again. -- William Setzer setzer@wam.umd.edu