19 lines
424 B
Plaintext
19 lines
424 B
Plaintext
// The below code is modified from the original at http://www.mpgh.net/forum/showthread.php?t=309318&p=4346157&viewfull=1#post4346157
|
|
|
|
roundFloat(floatValue, places)
|
|
{
|
|
expValue = exponent(10, places);
|
|
floatValue *= expValue;
|
|
floatValue += 0.5;
|
|
floatValue = int(floatValue);
|
|
floatValue /= expValue;
|
|
return floatValue;
|
|
}
|
|
|
|
exponent(basev, exp)
|
|
{
|
|
result = 1;
|
|
for(i = 0; i < exp; i++)
|
|
result *= basev;
|
|
return result;
|
|
} |