home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HomeWare 14
/
HOMEWARE14.bin
/
prog
/
ks94an.arj
/
__LOG.HDR
< prev
next >
Wrap
Text File
|
1994-04-24
|
3KB
|
87 lines
/******************************************************************************
The Klipper Library, for CA-Clipper 5.x
Copyright (c), 1994, Wallace Information Systems Engineering
FUNCTION:
_Logr(nNumber, nBase) --> nLog
PARAMETERS:
nNumber : number for which to derive logorithm
nBase : Log base (DEFAULT: Common Logarithm (Base 10))
SHORT:
Solve for any base log (not just the common log as Clipper's Log() does).
DESCRIPTION:
_Logr() is a logarithm function that solves for more than just the Common
Log. Any base can be specified.
_Logr() determines the logarithm of the given number in the given log base.
If nBase is not specified, _Log() calculates the Common Logarithm of
the given number (base 10).
The accuracy is calculated far beyond most calculator's 8 decimal places,
and greater than the accuracy obtained by using the natural log
(Clipper's LOG()) multiplied by .4343. Checking for peak accuracy at
8 decimal places is really more time consuming than simply letting the
thing calculate the remaining digits. You get the added precision to boot.
_Logr() will handle fractional logs (ie, _Logr(.00613))
Clipper's LOG() function returns the Natural Log of a number not it's
Common Log. For base 10 logs, you can quickly calculate the Common Log of
any number by multiplying the Natural Log by .4343, however _Logr() will
yield greater accuracy.
If you need the Natural Logarithm, use Clipper's LOG() function. If you need
the Common Log, it is probably quicker to use the Clipper (log()*.4343). If
you have logs with variable bases, this is the one.
The results from _Logr(n,10) can be converted to natural log by multiplying
by 2.3026.
NOTE:
Do not confuse the Common Log with the Natural Log.
DISCUSSION: For those of you new to logarithms:
Logs are strange. You are asked to find the question for a given answer.
Not unlike playing Jeopardy! In a Log, the givens are: The base of the log
(n - which if not specified is 10 [or the common logarithm] by default)
which will be used as the number being raised to some power.
If Log(10) x, then the equation is going to contain 10 ^(some power)
Exactly WHAT power is dependant on the given number (x). This second given
is the number that is the end result of raising the base of the log (n) to
the "some power". So what we are solving for is "what power?"
Stated: Solve for the exponent of the base of the log that results in
the given number.
Simple, right?
Stated again: The base (n) of the log raised to what power equals the
given number (x)?
EXAMPLE:
? _Logr(256) // 2.408239965
? _Logr(256,10) // 2.408239965
? _Logr(256,2) // 8.000000000
? _Logr(256,5) // 3.445412465
? _Logr(256,9) // 2.523719014
In the above examples, higher precision can be displayed by using a picture
of some sort:
TRANSFORM(_Logr(256),'99.999999999999')
******************************************************************************/