Template:Needs Translation/
函数名
|
Function: integer llRound( float val );
|
参数:• float val - 任何有效的浮点值
|
返回值:返回val最接近的整数。
如果十分位的绝对值小于或等于4,则val四舍五入;否则,val将四舍五入到正无穷。
|
注意事项
|
如果算术结果超出了有效整数的范围(-2147483648到2147483647包括在内),则返回值为-2147483648 (0x80000000)。
|
示例
|
示例1
default
{
state_entry()
{
llSay(0, "The rounded value of -4.9 is: "+(string)llRound(-4.9) );
//Returns "The rounded value of -4.9 is: -5"
llSay(0, "The rounded value of -4.1 is: "+(string)llRound(-4.1) );
//Returns "The rounded value of -4.1 is: -4"
llSay(0, "The rounded value of 4.5 is: "+(string)llRound(4.5) );
//Returns "The rounded value of 4.5 is: 5"
llSay(0, "The rounded value of 4.9 is: "+(string)llRound(4.9) );
//Returns "The rounded value of 4.9 is: 5"
llSay(0, "The rounded value of 4.1 is: "+(string)llRound(4.1) );
//Returns "The rounded value of 4.1 is: 4"
llSay(0, "The rounded value of -4.5 is: "+(string)llRound(-4.5) );
//Returns "The rounded value of -4.5 is: -4"
}
}
|