From: ams AT ludd DOT luth DOT se (Martin Str|mberg) Newsgroups: comp.os.msdos.djgpp Subject: Re: Powers and Roots Date: 18 Mar 1999 18:45:08 GMT Organization: University of Lulea, Sweden Lines: 28 Message-ID: <7crhjk$h9i$5@news.luth.se> References: NNTP-Posting-Host: queeg.ludd.luth.se X-Newsreader: TIN [UNIX 1.3 950824BETA PL0] To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Paul (astralm AT home DOT com) wrote: : Without using MATH.H's POW(x,y) function and SQRT(x) function, I must create : a calculator that finds powers and roots. : : I pretty much have a decent power function, using FOR loops, but I want to : use this function to also find roots. : : Here's the code: : : double Power (double num1, double num2); : { : int i; : : for (i = 1; i <= num2; i++) : num1 *= num1; : : return num1; : } Hmm, I thought 2^0 = 1 != 2. Anyway for the (square) root of y (i. e. SQRT(y)) you might consider that you need to find the x with the property Power(x, 2) == y. Shostakovich, Symphony No. 5, MartinS