Exp(), Log(), Log10()

These functions are FoxPro's contribution to transcendental computing (which has nothing to do with transcendental meditation). EXP() stands for "e to the power," while LOG() and LOG10() compute logarithms for base e and base 10, respectively.

Usage

nResultValue = EXP( nPower )
EXP() raises the constant e to the specified power, as in enPower. You probably last saw this in college. Until now, so did we.nPower can be any of the numeric types, but EXP() returns Numeric regardless.

Example

?EXP(1)      && Returns 2.72 with default SET DECIMALS TO 2
SET DECIMALS TO 4
?EXP(1)      && Returns 2.7183
?EXP(-1)     && Returns 0.3679
?EXP(.5)     && Returns 1.6487

Usage

nResultValue = LOG( nValue )
nResultValue = LOG10( nValue )
These two functions compute logarithms—no need for log tables or interpolation (another couple of things you probably haven't thought about since college). If you're like us, whenever you see something like y = log10x, you have to stop and say "Oh yeah, that means that 10 to the y is x" and then it makes sense again. On the other hand, if you're a normal human being, and not a math nerd like us, you'll probably swear that you never saw this stuff before in your life—it's okay, it's really not that bad! LOG() computes natural logarithms; that is, logs with a base of e. LOG10() computes logs with a base of 10. LOG() and EXP() are inverse functions, so LOG(EXP(nValue))=nValue.As with EXP(), nValue can be any numeric type, but both functions return Numerics.

Example

?LOG(1)     && Returns 0
?LOG(100)   && Returns 4.6052
?LOG10(1)   && Returns 0
?LOG10(100) && Returns 2 - hey, this makes sense!

Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .