Difference between revisions of "Fixed Precision"
Jump to navigation
Jump to search
m |
m (<lsl> tag to <source>) |
||
(5 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{LSL Header|ml=*}} | |||
== Function to do fixed precision == | |||
Here's a function to do fixed precision. | Here's a function to do fixed precision. | ||
< | <source lang="lsl2"> | ||
string fixedPrecision(float input, integer precision) | string fixedPrecision(float input, integer precision) | ||
{ | { | ||
Line 8: | Line 11: | ||
return (string)input; | return (string)input; | ||
} | } | ||
</ | </source> | ||
{{LSLC|Examples|Fixed Precision}} | {{LSLC|Examples|Fixed Precision}} |
Latest revision as of 13:57, 24 January 2015
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.
string fixedPrecision(float input, integer precision)
{
if((precision = (precision - 7 - (precision < 1))) & 0x80000000)
return llGetSubString((string)input, 0, precision);
return (string)input;
}