Original Post
Say I have a float and I want to convert it to text, but when I do, I want to have a set precision (number of digits past the decimal). I was thinking something like this:
// defined and declared precision before hand
int multiple = 1;
for(int i = 0; i < precision; i++)
multiple*= 10;
int tempInt = floatToConvert*multiple;
float convertedFloat = (float)tempInt/(float)multiple;
string finalText = convertedFloat.ToString();
Of course, I''m using C# on this. I think this will work. That is, at least I''m passing on the logic, even if there are some bugs. Is there a way to do this that is faster?
--Vic--