# Board index » delphi » mathematical routine: log(n)

## mathematical routine: log(n)

Are there any built-in procedures for calculation of log(n)?

If not, have anybody got an idea how to make one?

--
-Helge Hannisdal

## Re:mathematical routine: log(n)

db95...@oliven.lhg.hib.no (Helge J. Hannisdal) wrote:

##### Quote
>Are there any built-in procedures for calculation of log(n)?

>If not, have anybody got an idea how to make one?

>--
>-Helge Hannisdal

Pascal do not carry the log function (Delphi 2.0 does). It do
however carry the Ln (natural log) function. With a bit of
maths it follows that :

Log(x) := ln(x)/ln(10);

So just write a function that impliments this.
--

Arno Theron
PC-Estim/PROJEVAL(7D2C)
Tel(012) 311-1824
082-569-2532
Fax(012) 311-4438
eMAIL : THERO...@TELKOM19.TELKOM.CO.ZA

## Re:mathematical routine: log(n)

In article <4kfspp\$...@ole.uninett.no>
db95...@oliven.lhg.hib.no "Helge J. Hannisdal" writes:

##### Quote
> Are there any built-in procedures for calculation of log(n)?

> If not, have anybody got an idea how to make one?

Try the `ln' function.

This gives logarithms to base `e'.

For base `b' (eg 10) use:

result:=ln(n)/ln(b);

.splitbung
--
* TQ 1.0 * The 'Just So Quotes'.
"To be or nut^H^H^H -- sh^Gt, how do I delete..^D^D^D Oh No Oh NO^D^D^D -- How
do I get out of this thing anyway (mumble mumble)
Bus error (core dumped)

## Re:mathematical routine: log(n)

In article <4kfspp\$...@ole.uninett.no>,
Helge J. Hannisdal <db95...@oliven.lhg.hib.no> wrote:

##### Quote
>Are there any built-in procedures for calculation of log(n)?

>If not, have anybody got an idea how to make one?

Try the simple mathematical identity.....

log  (x) = ln(x)
10     ------
ln(10)

Implementation is left as an exercise for the reader...

--
Dave Langstaff | Janet:d...@uk.ac.aber
Any views expressed are those of the author alone. | Phone:(01970)622838
After-life, After-shave, don't hold with any of it, bleugh!  - Sir Henry

## Re:mathematical routine: log(n)

db95...@oliven.lhg.hib.no (Helge J. Hannisdal) wrote:

##### Quote
>Are there any built-in procedures for calculation of log(n)?
>If not, have anybody got an idea how to make one?
>--
>-Helge Hannisdal

It is not a build in function.

You have only to use the relation: log(n) = ln(n) / ln(10)

It will do the job for n > 0.

---
Roger Gariepy                            Be :-) even if you feel :-(
email: rgari...@rocler.qc.ca