Formats a decimal number into a string and keeps the result in a buffer. It is tuned for formatting a double, so it only works for a number of at most 17 significant digits.
Based on code by Giulietti.
Formats the number by the rules of ECMAScript chapter 6, as defined for the Number::toString operation at radix 10.
Number::toString