Path: utzoo!yunexus!oz From: oz@yunexus.UUCP (Ozan Yigit) Newsgroups: comp.lang.c Subject: Re: (sorry not sqroot) log_2 of an exact 2**n number ? Message-ID: <1929@yunexus.UUCP> Date: 14 May 89 20:28:48 GMT Article-I.D.: yunexus.1929 References: <1906@yunexus.UUCP> Reply-To: oz@yunexus.UUCP (Ozan Yigit) Organization: York U. Communications Research & Development Lines: 18 In article <1906@yunexus.UUCP> oz@yunexus.UUCP I wrote: >given any number that is an exact power of two, finding the square >root... Somebody pointed out that what I am looking for is log_2, and not the square root. Sorry if that was confusing. The question as to a portable version of the code is still my interest. I however do not wish to waste more bandwith on this trivia. Please send mail. > if (n > 0) /* n > 0 && n == 2**X */ > for (i = 0; !(n & 1); i++) > n >>= 1; thnx.. oz -- use the source, luke !! Usenet: oz@nexus.yorku.ca uh... we forgot to tell you... ......!uunet!utai!yunexus!oz it is unintelligible, but hey, you Bitnet: oz@[yulibra|yuyetti] got it, for free (!). Phonet: +1 416 736-5257x3976