Progress
Language Reference


LOG Function

Interfaces
OS
SpeedScript
All
All
Yes

Calculates the logarithm of an expression using a specified base.

SYNTAX

LOG ( expression [ , base ] ) 

expression

A decimal expression that you want the logarithm of.

base

A numeric expression that is the base you want to use. If you do not specify a base, LOG returns the natural logarithm, base (e). The base must be greater than 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
DEFINE VARIABLE base AS DECIMAL FORMAT ">>>,>>>.9999".
DEFINE VARIABLE number AS DECIMAL.

REPEAT:
  UPDATE base
    VALIDATE(base > 1, "Base must be greater than 1").
  REPEAT:
    UPDATE number
      VALIDATE(number > 0, "Number must be positive").
    DISPLAY number LOG(number, base)
      LABEL "LOG(NUMBER, BASE)".
  END.
END. 

NOTES


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095