Difference between revisions of "Fixed Precision"
Jump to navigation
Jump to search
Huney Jewell (talk | contribs) m |
m (lsl code tagging) |
||
Line 4: | Line 4: | ||
Here's a function to do fixed precision. | Here's a function to do fixed precision. | ||
< | <lsl> | ||
string fixedPrecision(float input, integer precision) | string fixedPrecision(float input, integer precision) | ||
{ | { | ||
Line 11: | Line 11: | ||
return (string)input; | return (string)input; | ||
} | } | ||
</ | </lsl> | ||
{{LSLC|Examples|Fixed Precision}} | {{LSLC|Examples|Fixed Precision}} | ||
{{#vardefine:sort|Fixed Precision}} | {{#vardefine:sort|Fixed Precision}} |
Revision as of 16:19, 30 March 2008
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Function to do fixed precision
Here's a function to do fixed precision.
<lsl> string fixedPrecision(float input, integer precision) {
if((precision = (precision - 7 - (precision < 1))) & 0x80000000) return llGetSubString((string)input, 0, precision); return (string)input;
} </lsl>