Skip to main content

$ZLOG (ObjectScript)

Returns the base 10 logarithm value of the specified positive numeric expression.

Synopsis

$ZLOG(n)

Argument

Argument Description
n Any positive, nonzero number, which can be specified as a value, a variable, or an expression.

Description

$ZLOG returns the base 10 logarithm value of n.

Specifying zero or a negative number results in an <ILLEGAL VALUE> error.

A non-numeric string is evaluated as 0 and therefore results in an <ILLEGAL VALUE> error. For evaluation of mixed numeric strings and non-numeric strings, refer to Strings As Numbers in Using ObjectScript.

The corresponding natural log (base e) function is $ZLN.

Examples

The following example writes the base 10 logarithms of the integers 1 through 10:

   FOR x=1:1:10 {
     WRITE !,"The log of ",x," = ",$ZLOG(x) 
     }
   QUIT

returns:

The log of 1 = 0
The log of 2 = .301029995663981195
The log of 3 = .477121254719662437
The log of 4 = .60205999132796239
The log of 5 = .698970004336018805
The log of 6 = .778151250383643633
The log of 7 = .845098040014256831
The log of 8 = .903089986991943586
The log of 9 = .954242509439324875
The log of 10 = 1
   WRITE $ZLOG($ZPI)

returns .4971498726941338541.

   WRITE $ZLOG(.5)

returns -.301029995663981195.

   WRITE $ZLOG(0)

issues an <ILLEGAL VALUE> error.

See Also

Feedback