Guardian Native C Library Calls Reference Manual (G06.28+, H06.04+)

ecvt(3) Guardian Native C Library Calls Reference Manual
NAME
ecvt - Converts a oating-point number to a string
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRESRL
G-series native OSS processes: /G/system/sysnn/zcresrl
H-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCREDLL
H-series OSS processes: /G/system/zdllnnn/zcredll
SYNOPSIS
#include <stdlib.h>
char *ecvt(
double value,
int ndigit,
int *decpt,
int *sign
);
PARAMETERS
value Is the oating-point number to be converted.
ndigit Is the length of the returned null-terminated string.
decpt Is a pointer to an integer that indicates the position of the radix character
(decimal point) relative to the beginning of the returned string.
sign Is a pointer to an integer that indicates the sign of value.
DESCRIPTION
The ecvt() function converts a oating-point number to a null-terminated string and returns a
pointer to that string.
The resulting string does not actually contain the radix character (decimal point). The position of
the radix character relative to the beginning of the string is stored in the integer pointed to by
decpt. A negative value of decpt indicates that the radix character is to the left of the returned
string. ecvt() also returns an integer indicating the sign of value in the location pointed to by the
sign parameter. If value is negative, the integer is nonzero; otherwise it is 0 (zero). The preci-
sion of the type double limits the total number of characters in the string.
NOTES
This function supports both IEEE Std 754-1985 oating-point and Tandem oating-point values.
IEEE values can include NaN and innity, and the sign of 0 (zero) can be either positive or nega-
tive. Refer to the fp_class(3) reference page for a description of IEEE value classes.
Guardian functions are available to convert between oating-point formats. Refer to the Guar-
dian Programmers Guide for a discussion of oating-point conversions.
The return value of the ecvt() function points to static data, which will be overwritten by future
calls to the function.
RETURN VALUES
The ecvt() function returns a pointer to a null-terminated string representation of value.
ERRORS
No errors are returned. This function does not set errno.
164 Hewlett-Packard Company 527192-005