Caché ObjectScript Reference
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   

Returns the natural logarithm of the specified number.
n Any positive nonzero number, which can be specified as a value, a variable, or an expression.
$ZLN returns the natural logarithm (base e) value of n.
Specifying zero or a negative number results in an <ILLEGAL VALUE> error.
The corresponding natural logarithm power function is $ZEXP.
The following example writes the natural log of the integers 1 through 10:
   FOR x=1:1:10 {
     WRITE !,"The natural log of ",x," = ",$ZLN(x) 
The natural log of 1 = 0
The natural log of 2 = .6931471805599453089
The natural log of 3 = 1.098612288668109691
The natural log of 4 = 1.386294361119890618
The natural log of 5 = 1.609437912434100375
The natural log of 6 = 1.791759469228055002
The natural log of 7 = 1.945910149055313306
The natural log of 8 = 2.079441541679835929
The natural log of 9 = 2.197224577336219384
The natural log of 10 = 2.302585092994045684
The following example shows the relationship between $ZLN and $ZEXP:
   SET x=$ZEXP(1) ; x = 2.718281828459045236
   WRITE $ZLN(x)
returns 1.
   WRITE $ZLN(0)
issues an <ILLEGAL VALUE> error.
See Also