return num_toString(cx, obj, 0, argv, rval);
char thousandsLength, decimalLength; const char *numGrouping, *tmpGroup; JSRuntime *rt; JSString *numStr, *str; char *num, *buf, *dec, *end, *tmpSrc, *tmpDest; int digits, size, remainder, nrepeat;   if (!num_toString(cx, obj, 0, argv, rval)) return JS_FALSE; JS_ASSERT(JSVAL_IS_STRING(*rval)); numStr = JSVAL_TO_STRING(*rval); num = js_GetStringBytes(numStr);   dec = strchr(num, '.'); digits = dec ? dec - num : (int)strlen(num); end = num + digits;  rt = cx->runtime; thousandsLength = strlen(rt->thousandsSeparator); decimalLength = strlen(rt->decimalSeparator);   size = digits + (dec ? decimalLength + strlen(dec + 1) : 0);  tmpGroup = rt->numGrouping; remainder = digits; if (*num == '-') remainder--;  while (*tmpGroup != CHAR_MAX && *tmpGroup != '\0') { if (*tmpGroup >= remainder) break; size += thousandsLength; remainder -= *tmpGroup; tmpGroup++; } if (*tmpGroup == '\0' && *rt->numGrouping != '\0') { nrepeat = (remainder - 1) / tmpGroup[-1]; size += thousandsLength * nrepeat; remainder -= nrepeat * tmpGroup[-1]; } else { nrepeat = 0; } tmpGroup--;  buf = (char *)JS_malloc(cx, size + 1); if (!buf) return JS_FALSE;  tmpDest = buf; tmpSrc = num;  while (*tmpSrc == '-' || remainder--) *tmpDest++ = *tmpSrc++; while (tmpSrc < end) { strcpy(tmpDest, rt->thousandsSeparator); tmpDest += thousandsLength; memcpy(tmpDest, tmpSrc, *tmpGroup); tmpDest += *tmpGroup; tmpSrc += *tmpGroup; if (--nrepeat < 0) tmpGroup--; }  if (dec) { strcpy(tmpDest, rt->decimalSeparator); tmpDest += decimalLength; strcpy(tmpDest, dec + 1); } else { *tmpDest++ = '\0'; }  str = JS_NewString(cx, buf, size); if (!str) { JS_free(cx, buf); return JS_FALSE; }  *rval = STRING_TO_JSVAL(str);  return JS_TRUE;
num_toLocaleString(JSContext *cx, JSObject *obj, uintN argc,                   jsval *argv, jsval *rval){/* *  For now, forcibly ignore the first (or any) argument and return toString(). *  ECMA allows this, although it doesn't 'encourage it'. *  [The first argument is being reserved by ECMA and we don't want it confused *  with a radix] */    return num_toString(cx, obj, 0, argv, rval);}