Difference between revisions of "Fixed Precision"
Jump to navigation
Jump to search
m (revert, silly mistake) |
|||
Line 4: | Line 4: | ||
string fixedPrecision(float input, integer precision) | string fixedPrecision(float input, integer precision) | ||
{ | { | ||
if(precision < | if((precision = (precision - 7 - (precision < 1))) & 0x80000000) | ||
return llGetSubString((string)input, 0, | return llGetSubString((string)input, 0, precision); | ||
return (string)input; | return (string)input; | ||
} | } | ||
</pre> | </pre> | ||
[[Category:LSL Examples]] | [[Category: LSL Examples]] |
Revision as of 20:40, 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; }