Fixed Precision: Difference between revisions

From Second Life Wiki
Jump to navigation Jump to search
Gigs Taggart (talk | contribs)
fixed precisions
 
Gigs Taggart (talk | contribs)
mNo edit summary
Line 10: Line 10:
</pre>
</pre>


[[Category: Examples]]
[[Category: LSL Examples]]

Revision as of 15:45, 4 March 2007

Here's a function to do fixed precision.

string fixedPrecision(float input, integer precision)
{
    if((precision = (precision - 7 - (precision < 1))) & 0x80000000)
        return llGetSubString((string)input, 0, precision);
    return (string)input;
}