ecvt

Converts its argument to a null-terminated string of ASCII digits and returns the address of the string. The string is stored in a thread-specific memory location created by the DEC C RTL.

Format

#include  <stdlib.h>

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

Arguments

value
An object of type double that is converted to a null-terminated string of ASCII digits.
ndigits
The number of ASCII digits to be used in the converted string.
decpt
The position of the decimal point relative to the first character in the returned string. A negative int value means that the decimal point is decpt number of spaces to the left of the returned digits, (the spaces being filled with zeros). A 0 value means that the decimal point is immediately to the left of the first digit in the returned string.
sign
An integer value that indicates whether the value argument is positive or negative. If value is negative, the function places a nonzero value at the address specified by sign. Otherwise, the function assigns 0 to the address specified by sign.

Description

This function converts value to a null-terminated string of length ndigits, and returns a pointer to it. The resulting low-order digit is rounded to the correct digit for outputting ndigits digits in C E-format. The decpt argument is assigned the position of the decimal point relative to the first character in the string.

Repeated calls to the ecvt function overwrite any existing string.

The ecvt, fcvt, and gcvt functions represent the following special values specified in the IEEE Standard for floating-point arithmetic:
Value  Representation 
Quiet NaN  NaNQ 
Signalling NaN  NaNS 
+Infinity  Infinity 
- Infinity  -Infinity 

The sign associated with each of these values is stored into the sign argument. In IEEE floating-point representation, a value of 0 (zero) can be positive or negative, as set by the sign argument.

See also gcvt and fcvt in this section.

Return Value
The value of the converted string. 


Previous Page | Next Page | Table of Contents | Index