char *numEnd;
char *numEnd;                JSBool dtoaRet;
JS_dtostr(char *buffer, size_t bufferSize, JSDToStrMode mode, int precision, double d){    int decPt;                  /* Position of decimal point relative to first digit returned by JS_dtoa */    int sign;                   /* Nonzero if the sign bit was set in d */    int nDigits;                /* Number of significand digits returned by JS_dtoa */    char *numBegin = buffer+2;  /* Pointer to the digits returned by JS_dtoa; the +2 leaves space for */                                /* the sign and/or decimal point */    char *numEnd;               /* Pointer past the digits returned by JS_dtoa */    JS_ASSERT(bufferSize >= (size_t)(mode <= DTOSTR_STANDARD_EXPONENTIAL ? DTOSTR_STANDARD_BUFFER_SIZE :            DTOSTR_VARIABLE_BUFFER_SIZE(precision)));    if (mode == DTOSTR_FIXED && (d >= 1e21 || d <= -1e21))        mode = DTOSTR_STANDARD; /* Change mode here rather than below because the buffer may not be large enough to hold a large integer. */    if (!JS_dtoa(d, dtoaModes[mode], mode >= DTOSTR_FIXED, precision, &decPt, &sign, &numEnd, numBegin, bufferSize-2))        return 0;    nDigits = numEnd - numBegin;    /* If Infinity, -Infinity, or NaN, return the string regardless of the mode. */    if (decPt != 9999) {        JSBool exponentialNotation = JS_FALSE;        int minNDigits = 0;         /* Minimum number of significand digits required by mode and precision */        char *p;        char *q;        switch (mode) {            case DTOSTR_STANDARD:                if (decPt < -5 || decPt > 21)                    exponentialNotation = JS_TRUE;                else                    minNDigits = decPt;                break;            case DTOSTR_FIXED:                if (precision >= 0)                    minNDigits = decPt + precision;                else                    minNDigits = decPt;                break;            case DTOSTR_EXPONENTIAL:                JS_ASSERT(precision > 0);                minNDigits = precision;                /* Fall through */            case DTOSTR_STANDARD_EXPONENTIAL:                exponentialNotation = JS_TRUE;                break;            case DTOSTR_PRECISION:                JS_ASSERT(precision > 0);                minNDigits = precision;                if (decPt < -5 || decPt > precision)                    exponentialNotation = JS_TRUE;                break;        }        /* If the number has fewer than minNDigits, pad it with zeros at the end */        if (nDigits < minNDigits) {            p = numBegin + minNDigits;            nDigits = minNDigits;            do {                *numEnd++ = '0';            } while (numEnd != p);            *numEnd = '\0';        }                if (exponentialNotation) {            /* Insert a decimal point if more than one significand digit */            if (nDigits != 1) {                numBegin--;                numBegin[0] = numBegin[1];                numBegin[1] = '.';            }            JS_snprintf(numEnd, bufferSize - (numEnd - buffer), "e%+d", decPt-1);        } else if (decPt != nDigits) {            /* Some kind of a fraction in fixed notation */            JS_ASSERT(decPt <= nDigits);            if (decPt > 0) {                /* dd...dd . dd...dd */                p = --numBegin;                do {                    *p = p[1];                    p++;                } while (--decPt);                *p = '.';            } else {                /* 0 . 00...00dd...dd */                p = numEnd;                numEnd += 1 - decPt;                q = numEnd;                JS_ASSERT(numEnd < buffer + bufferSize);                *numEnd = '\0';                while (p != numBegin)                    *--q = *--p;                for (p = numBegin + 1; p != q; p++)                    *p = '0';                *numBegin = '.';                *--numBegin = '0';            }        }    }    /* If negative and neither -0.0 nor NaN, output a leading '-'. */    if (sign &&            !(word0(d) == Sign_bit && word1(d) == 0) &&            !((word0(d) & Exp_mask) == Exp_mask &&              (word1(d) || (word0(d) & Frac_mask)))) {        *--numBegin = '-';    }    return numBegin;}