sqroot of a 2**n number ?

CMSC 620 ai04 at umd5.umd.edu
Mon May 15 05:47:45 AEST 1989


In article <1928 at yunexus.UUCP> oz at yunexus.UUCP (Ozan Yigit) writes:
>In article <4890 at umd5.umd.edu> setzer at 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 at wam.umd.edu



More information about the Comp.lang.c mailing list