fcvt()

convert floating point value to string with given number of digits after radix point 

Function


SYNOPSIS

#include <stdlib.h>

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


DESCRIPTION

The fcvt() function converts a floating-point value to a null-terminated string of ndigit digits (where ndigit specifies the number of digits desired after the radix point (decimal point)) and returns a pointer to the string. The total number of digits in the result string is restricted to an unspecified limit as determined by the precision of a double. The high-order digit is non-zero, unless the value is 0. The low-order digit is rounded. The position of the radix character 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 a floating-point number to be converted.

ndigit 

Is the number of digits after decimal point.

decpt 

Is the return pointer to the decimal point position.

sign 

Is the return pointer to the sign indicator.


RETURN VALUES

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


PTC MKS Toolkit 10.4 Documentation Build 39.