(sorry not sqroot) log_2 of an exact 2**n number ?
Ozan Yigit
oz at yunexus.UUCP
Mon May 15 06:28:48 AEST 1989
In article <1906 at yunexus.UUCP> oz at 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 at 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
More information about the Comp.lang.c
mailing list