INFO: Buffer Size for fcvt() and ecvt() Is 349 Bytes (59070)



The information in this article applies to:

  • The C Run-Time (CRT), when used with:
    • Microsoft Visual C++ for Windows, 16-bit edition 1.0
    • Microsoft Visual C++ for Windows, 16-bit edition 1.5
    • Microsoft Visual C++, 32-bit Editions 1.0
    • Microsoft Visual C++, 32-bit Editions 2.0
    • Microsoft Visual C++, 32-bit Editions 4.0
    • Microsoft Visual C++, 32-bit Editions 5.0
    • Microsoft Visual C++, 32-bit Editions 6.0

This article was previously published under Q59070

SUMMARY

In Microsoft C, the ecvt() and fcvt() routines use a single, statically allocated buffer while converting floating point numbers to character strings. The buffer is currently defined as 349 bytes. However, the largest double-precision variable that can be used is 309 bytes, with 40 bytes for padding. It is set up to be large enough to accommodate the largest double- precision number plus 40 decimal places (even though you only have 16 digits of accuracy in a double-precision IEEE number).

Modification Type:MajorLast Reviewed:12/11/2003
Keywords:kbCRT kbinfo KB59070 kbAudDeveloper