ecvt()

convert floating-point value to string of specified length 

Function


SYNOPSIS

#include <stdlib.h>

char *ecvt(double value, int ndigit, int *decpt, int *sign);


DESCRIPTION

The ecvt() function converts a floating-point value to a null-terminated string of ndigit digits (where ndigit is reduced to an unspecified limit determined by the precision of a double) and returns a pointer to the string. The high-order digit is non-zero, unless the value is 0. The low-order digit is rounded. The position of the radix character (decimal point) relative to the beginning of the string is stored in the integer pointed to by decpt (negative means to the left of the returned digits). If value is zero, it is unspecified whether the integer pointed to by decpt would be 0 or 1. The radix character is not included in the returned string. If the sign of the result is negative, the integer pointed to by sign is non-zero, otherwise it is 0.

If the converted value is out of range or is not representable, the contents of the returned string are unspecified.


PARAMETERS

value 

Is the floating-point number to be converted.

ndigit 

Specifies the number of digits after decimal point.

decpt 

Is the return pointer to the decimal point position.

sign 

Is the return pointer to sign indicator.


RETURN VALUES

The ecvt() function always returns a pointer to a null-terminated string of digits.


CONFORMANCE

UNIX 98.


MULTITHREAD SAFETY LEVEL

Unsafe.


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:
fcvt(), gcvt()


PTC MKS Toolkit 10.4 Documentation Build 39.