LSL Wiki Mirror 10-5-2006: llRound

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings ::
integer llRound(float value)

Returns value rounded to the nearest integer.

If value's decimal part is >= 0.5, then value is rounded to the next integer. If not, it is rounded down to the previous integer.

More precisely, if the absolute value of value's decimal is < 0.5, then value is rounded to the next integer closer to 0, otherwise it is rounded to the next integer further from 0.

Value Returns
-7.85 -8
1.29 1
584.32 584
685.96 686
9803.40928 9803

To aways round up to the nearest integer, use llCeil. To always round down, use llFloor or typecast directly to integer.

The usage of these functions can be tricky. For examples of potential issues see llFrand.


Functions | Math
There is no comment on this page. [Display comments/form]