toPrecision Summary Formats the integer value as a string to the given precision. Usage public string toPrecision(int precision) Returns The integer value formatted using to the given precision. Parameters precision The number of significant digits in the final formatted value. This number can be between 1 and 21 (inclusive). Description Formats the integer value to the given precision. The formatted value will be returned as a string. System.Exceptions.OutOfRangeException will be thrown if the supplied argument for the significant digits is not an integer between 1 and 21 (inclusive). Examples Basic Usage 1234567import System; unsigned int x = 1;Console.log(x.toPrecision(1)); // "1"Console.log(x.toPrecision(2)); // "1.0"Console.log(x.toPrecision(5)); // "1.0000"Console.log(x.toPrecision(7)); // "1.000000" Share HTML | BBCode | Direct Link