gcvt()

convert floating point number to string in printf() %g format 

Function


SYNOPSIS

#include <stdlib.h>

char *gcvt(double value, int ndigit, char *buf);


DESCRIPTION

The gcvt() function converts a floating-point number to a string. It converts value to a null-terminated string (similar to that of the %g format of printf()) in the array pointed to by buf and returns buf. It produces ndigit significant digits (limited to an unspecified value determined by the precision of a double) in %f if possible, or %e (scientific notation) otherwise. A minus sign is included in the returned string if value is less than 0. A radix character is included in the returned string if value is not a whole number. Trailing zeros are suppressed where value is not a whole number. The radix character is determined by the current locale.


PARAMETERS

value 

Is the floating point number to be formatted.

ndigit 

Is the number of significant digits.

buf 

Points to the array that is to hold the formatted data.


RETURN VALUES

The gcvt() function always returns buf.


CONFORMANCE

UNIX 98.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
ecvt(), fcvt(), printf()


PTC MKS Toolkit 10.4 Documentation Build 39.