INtime SDK Help
ftoa

Converts a double value to a formatted string.

#include <stdlib.h>

char *ftoa(double value, char *string, unsigned int iplaces, unsigned int fplaces);

Parameters

value
Value to convert.
string
Pointer to a character array where a null-terminated character string is written.
iplaces
Desired number of significant integer digits (iii) in the string.
fplaces
Desired number of significant fractional digits (fff) in the string. An integer exponent (eee) also returns in the string.

Remarks

The converted string has this format:

[-]iii.fffE[-]eee

The value of the number is truncated, not rounded. The algorithm that ftoa uses is accurate to eighteen significant digits. If iplaces plus fplaces exceeds eighteen, they are adjusted so that only eighteen significant digits are used.

For portability, use the sprintf %e conversion specifier. Use the optional field width and precision to control the number of fractional digits. The sprintf %e conversion specifier produces a string in the format [-]d.dddE+ee, with one integer digit left of the decimal point.

Return Values

A pointer to the converted string.

Requirements

Versions Defined in Include Link to
INtime 3.0 intime/rt/include/stdlib.h stdlib.h clib.lib

See Also

sprintf