LOG function
- Last Updated: February 19, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
Calculates the logarithm of an expression using a specified base and returns that logarithm as a DECIMAL value.
Syntax
|
- expression
- A decimal expression that you want the logarithm of. Expression must be greater than 0.
- base
- A numeric expression that is the base you want to use. If you do not
specify a base,
LOGreturns the natural logarithm, base (e). Base must be greater than 0 but not 1.
Example
This procedure prompts the user for a base and a number, and then displays
the log of the number. The VALIDATE option on the UPDATE
statement ensures that the user enters a base value greater than 1 and a number greater than
0.
r-log.p
|
Notes
- The
LOGfunction is accurate to approximately 10 decimal places. - After converting the base and exponent to floating-point format, the
LOGfunction uses standard system routines. On some machines, the logarithm routines do not handle large numbers well and might cause your terminal to hang. - If expression or base are less than or equal to 0,
the Unknown value (
?) is returned. If base is 1, a runtime error occurs.