ln

用于表示自然对数的 OPL 函数

用途

用于返回自然对数的 OPL 函数。

类型
float

语法

ln(float f)

描述

返回浮点值的自然对数。 您可以通过指定 OPL 名称空间在 IBM ILOG Script 语句内使用此函数:

( Opl.xxx() )

示例

float a=1;
float b=exp(1);
float c=100;

float lnofa=ln(a);
float lnofb=ln(b);
float lnofc=ln(c);

execute
{
   writeln("ln(",a,") gives ",lnofa);
   writeln("ln(",b,") gives ",lnofb); 
   writeln("ln(",c,") gives ",lnofc); 
}

结果

ln(1) gives 0
ln(2.718281828459045) gives 1
ln(100) gives 4.605170185988092