Format floating‐point value using the specified format.

Synopsis

Declared in <bslalg_numericformatterutil.h>

static
char*
toChars(
    char* first,
    char* last,
    double value,
    Format format) noexcept;

Description

Write the specified floating point value into the character buffer starting at the specified first and ending at the specified last, last not included, using the specified format with the {Shortest (Textual) Decimal Representation for Binary Floating Point Values} used in that format (that will produce the exact binary floating point value when converted back to the original type from text), but see possible exceptions under {Special Floating Point Values}. Return the address one past the last character (lowest order digit or last digit of the exponent) written on success, or 0 on failure. The only reason for failure is when the range [ first, last )] is not large enough to contain the result. The written result is to begin at first with leftover room following the return value. The behavior is undefined unless first <= last. Note that these functions do not null‐terminate the result.

Return Value

pointer past the last character written, or null on failure

Parameters

Name

Description

first

beginning of the output character range

last

end of the output character range

value

floating‐point value to format

format

floating‐point formatting style

Created with MrDocs