JS_ReportError(cx, "illegal radix %d", base);
char numBuf[12]; sprintf(numBuf, "%d", base); JS_ReportErrorNumber(cx, NULL, JSMSG_BAD_RADIX, numBuf);
num_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval){    jsval v;    jsdouble d;    jsint base, ival, dval;    char *bp, buf[32];    JSString *str;    if (!JS_InstanceOf(cx, obj, &number_class, argv))	return JS_FALSE;    v = OBJ_GET_SLOT(cx, obj, JSSLOT_PRIVATE);    if (!JSVAL_IS_NUMBER(v))	return js_obj_toString(cx, obj, argc, argv, rval);    d = JSVAL_IS_INT(v) ? (jsdouble)JSVAL_TO_INT(v) : *JSVAL_TO_DOUBLE(v);    if (argc != 0) {	if (!js_ValueToECMAInt32(cx, argv[0], &base))	    return JS_FALSE;	if (base < 2 || base > 36) {	    JS_ReportError(cx, "illegal radix %d", base);	    return JS_FALSE;	}	if (base != 10 && JSDOUBLE_IS_FINITE(d)) {	    ival = (jsint) js_DoubleToInteger(d);	    bp = buf + sizeof buf;	    for (*--bp = '\0'; ival != 0 && --bp >= buf; ival /= base) {		dval = ival % base;		*bp = (char)((dval >= 10) ? 'a' - 10 + dval : '0' + dval);	    }	    if (*bp == '\0')		*--bp = '0';	    str = JS_NewStringCopyZ(cx, bp);	} else {	    str = js_NumberToString(cx, d);	}    } else {	str = js_NumberToString(cx, d);    }    if (!str)	return JS_FALSE;    *rval = STRING_TO_JSVAL(str);    return JS_TRUE;}