Don't click here unless you want to be banned.

LSL Wiki : ExampleMultiRound

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl338.us.archive.org
This function allows for easy rounding up or down of integers using mulitples.

integer MultiRound(integer input, integer UpDn, integer Multiple)
{
    integer r = input % Multiple;
    if (r)
    {
        if (UpDn)
        {
            return input + (Multiple - r);
        }
        return input - r;
    }
    return input;
}

Example Usage:
MultiRound(102, 1, 5) //would return 105.


HomePage | Examples
There is no comment on this page. [Display comments/form]