delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/18/13:52:14

From: "Paul" <astralm AT home DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Powers and Roots
Lines: 22
X-Newsreader: Microsoft Outlook Express 4.72.3155.0
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0
Message-ID: <bubI2.867$rL2.2855@news1.rdc1.on.wave.home.com>
Date: Thu, 18 Mar 1999 18:20:55 GMT
NNTP-Posting-Host: 24.65.84.228
X-Complaints-To: abuse AT home DOT net
X-Trace: news1.rdc1.on.wave.home.com 921781255 24.65.84.228 (Thu, 18 Mar 1999 10:20:55 PST)
NNTP-Posting-Date: Thu, 18 Mar 1999 10:20:55 PST
Organization: @Home Network Canada
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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;
        }

Thanks in advance,
Paul Seropian


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019