Talk:Float2String

From Second Life Wiki
Revision as of 06:12, 18 September 2008 by Garmin Kawaguichi (talk | contribs) (New page: Please be kind to totally review your text and code; examples are false, code is insufficiently implemented. Examples: string myFormattedFloat = Float2String(-7.1373699,3,"Round"); //roun...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Please be kind to totally review your text and code; examples are false, code is insufficiently implemented.

Examples: string myFormattedFloat = Float2String(-7.1373699,3,"Round"); //rounded returns -7.14

string myFormattedFloat = Float2String(-7.1373699,3,""); //not rounded returns -7.13

The real result is -7.137 for the both

Code:

   if (places == 0)
   {
       return neg + (string) ((integer)num );
   }

This is true if you want to truncate it, but false if you want to round it.

Other: To round it's written : "should be set to "Rounded" for Yes" in the expanations, //rnd (rounding) should be set to "Rounded" for Yes, "" for not rounded in a Comment Line and Yes in the code. Note that the wiki is first for people who want to study LSL.

Garmin Kawaguichi