code: function addDecimalSeparators(x, separator) {
    x += '';
    if (!separator) return x;
    var rgx = /(\d{3})(\d+)/;
    while (rgx.test(x)) {
      x = x.replace(rgx, '$1' + separator + '$2');
    }
    return x;
  }
docs: where x is already the decimal part of the number