home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!wupost!emory!ogicse!qiclab!leonard
- From: leonard@qiclab.scn.rain.com (Leonard Erickson)
- Newsgroups: comp.lang.pascal
- Subject: Re: powers in TURBO pascal
- Message-ID: <1993Jan2.171253.10580@qiclab.scn.rain.com>
- Date: 2 Jan 93 17:12:53 GMT
- Article-I.D.: qiclab.1993Jan2.171253.10580
- References: <30DEC92.02825818.0033@music.mus.polymtl.ca> <dmurdoch.262.725736007@mast.queensu.ca> <1992Dec30.174246.2523@news.uni-stuttgart.de> <1992Dec31.122326.7404@qiclab.scn.rain.com> <1993Jan1.004310.9816@ac.dal.ca>
- Reply-To: Leonard.Erickson@f51.n105.z1.fidonet.org
- Organization: SCN Research/Qic Laboratories of Tigard, Oregon.
- Lines: 29
-
- chip@ac.dal.ca writes:
-
- >> Function Power(a,b:real):real;
- >> begin
- >> {messy code goes here!}
- >> end;
-
- >NOTE:
- > y y * LN(x)
- >x = e
-
- >Therefore:
-
- >FUNCTION Power(Base, Power) : REAL;
- >BEGIN
- > EXP(Power * LN(Base));
- >END;
-
- >That's the messy code....
-
- That's also code that loses a *lot* of precision, and will crash on legal
- values of base and power because LN(Base) may yield a value that EXP can't
- deal with.
-
- --
- Leonard Erickson leonard@qiclab.scn.rain.com
- CIS: [70465,203] 70465.203@compuserve.com
- FIDO: 1:105/51 Leonard.Erickson@f51.n105.z1.fidonet.org
- (The CIS & Fido addresses are preferred)
-