Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!samsung!crackers!m2c!wpi.WPI.EDU!kamal From: kamal@wpi.WPI.EDU (Kamal Z Zamli) Newsgroups: comp.lang.pascal Subject: Re: how can I get a log of a number? Message-ID: <1990Dec17.055021.11486@wpi.WPI.EDU> Date: 17 Dec 90 05:50:21 GMT References: <10684@uhccux.uhcc.Hawaii.Edu> Organization: Worcester Polytechnic Institute Lines: 24 In article <10684@uhccux.uhcc.Hawaii.Edu> webb@uhccux.UUCP (Thomas Webb) writes: > >I know that this must be a simple thing to do, but I can't think of a >decent way to get a log base 10 of a number. Since a log function >isn't included in Pascal (even turbo) I assume it is a simple matter >to derive one for the mathmatically inclined; not so for me. Any >help will be much appreciated. > >Thanks, > >-tom. Remember the old days of high school, the property of log functions (what ever base 2,8 etc )....... function logbase10 (anynumber:real):real; begin logbase10:=ln(anynmuber)/ln (10); end; Also, you might consider declaring anynumber and functionm logbase10 as extended just to make sure this function will have wide range.